Page 1 of 1

Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 12:10 pm
by raeru
Been searching around for this solution here but laze came to me so I decided to ask now

I don't actually have much knowledge in ren'py so this "triggering Ending 1 with specific choice" is giving me a headache. I know this is a simple code but shame on me ;_;

So I actually have 2 choices(answers) to triggered to get into the Ending 1 but if fail to get the choices either the two of them, it'll be directed to Ending 2. Please help senpies ;_;

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 12:27 pm
by Divona
Not sure if I understand what you meant, but is this what you're looking for?

Code: Select all

label decision_time:

    "Here come first choice."

    menu:
        "Part 1 Choice 1":
            $ part_1_correct_answer = True
        "Part 1 Choice 2":
            $ part_1_correct_answer = False

    "Now, it's second choice."

    menu:
        "Part 2 Choice 1":
            $ part_2_correct_answer = False
        "Part 2 Choice 2":
            $ part_2_correct_answer = True

    if part_1_correct_answer == True and part_2_correct_answer == True:
        jump ending_1
    else:
        jump ending_2

label ending_1:

......

label engine_2:

......

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 12:54 pm
by raeru
Divona wrote:Not sure if I understand what you meant, but is this what you're looking for?

Code: Select all

label decision_time:

    "Here come first choice."

    menu:
        "Part 1 Choice 1"
            $ part_1_correct_answer = True
        "Part 1 Choice 2"
            $ part_1_correct_answer = False

    "Now, it's second choice."

    menu:
        "Part 2 Choice 1"
            $ part_2_correct_answer = False
        "Part 2 Choice 2"
            $ part_2_correct_answer = True

    if part_1_correct_answer = True and part_2_correct_answer = True:
        jump ending_1
    else:
        jump ending_2

label ending_1:

......

label engine_2:

......
Unlike the code you gave, first choice would jump to the continuing label, does this only applies to none jumpable choices? This is exactly what in my mind but the error ;_;

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 5041, in script
    if deathend = True and deathend2 = True:
SyntaxError: invalid syntax (game/script.rpy, line 5041)


Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 1:18 pm
by NocturneLight
raeru wrote:
Divona wrote:Not sure if I understand what you meant, but is this what you're looking for?

Code: Select all

label decision_time:

    "Here come first choice."

    menu:
        "Part 1 Choice 1"
            $ part_1_correct_answer = True
        "Part 1 Choice 2"
            $ part_1_correct_answer = False

    "Now, it's second choice."

    menu:
        "Part 2 Choice 1"
            $ part_2_correct_answer = False
        "Part 2 Choice 2"
            $ part_2_correct_answer = True

    if part_1_correct_answer = True and part_2_correct_answer = True:
        jump ending_1
    else:
        jump ending_2

label ending_1:

......

label engine_2:

......
Unlike the code you gave, first choice would jump to the continuing label, does this only applies to none jumpable choices? This is exactly what in my mind but the error ;_;

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 5041, in script
    if deathend = True and deathend2 = True:
SyntaxError: invalid syntax (game/script.rpy, line 5041)

It's just a minor typo. Just change

Code: Select all

 if deathend = True and deathend2 = True:
to

Code: Select all

 if deathend == True and deathend2 == True:
When you compare truth values, you use == to compare it with another truth value. You also use == when comparing strings and numbers as well.

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 1:29 pm
by raeru
NocturneLight wrote:
raeru wrote:
Divona wrote:Not sure if I understand what you meant, but is this what you're looking for?

Code: Select all

label decision_time:

    "Here come first choice."

    menu:
        "Part 1 Choice 1"
            $ part_1_correct_answer = True
        "Part 1 Choice 2"
            $ part_1_correct_answer = False

    "Now, it's second choice."

    menu:
        "Part 2 Choice 1"
            $ part_2_correct_answer = False
        "Part 2 Choice 2"
            $ part_2_correct_answer = True

    if part_1_correct_answer = True and part_2_correct_answer = True:
        jump ending_1
    else:
        jump ending_2

label ending_1:

......

label engine_2:

......
Unlike the code you gave, first choice would jump to the continuing label, does this only applies to none jumpable choices? This is exactly what in my mind but the error ;_;

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 5041, in script
    if deathend = True and deathend2 = True:
SyntaxError: invalid syntax (game/script.rpy, line 5041)

It's just a minor typo. Just change

Code: Select all

 if deathend = True and deathend2 = True:
to

Code: Select all

 if deathend == True and deathend2 == True:
When you compare truth values, you use == to compare it with another truth value. You also use == when comparing strings and numbers as well.
New error came ;_;

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 5038, in script
    if deathend == True and death_end_two == True:
  File "game/script.rpy", line 5038, in <module>
    if deathend == True and death_end_two == True:
NameError: name 'deathend' is not defined

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 2:13 pm
by Divona
Sorry about the typo before in my code. It hasn't been tested, and it's very late at night here. :oops:

Code: Select all

NameError: name 'deathend' is not defined
This mean that you have not define 'deathend' variable. Probably misspell the name of variable 'death_end'.

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 2:20 pm
by raeru
I also did tried to change the name but still error, it's also mid-night here I'll give this one a rest for today ;_; Hope you would test it out senpai ;_;

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 2:22 pm
by Divona
raeru wrote:I also did tried to change the name but still the error it's also mid-night here I'll give this one a rest for today ;_; Hope you would test it out senpie ;_;
Post up your code, so we can actually see where it went wrong. Either me or someone else coming along would help out fixing and cleaning up, eventually. :wink:

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 2:25 pm
by raeru
You mean the script.py?

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 2:26 pm
by Divona
raeru wrote:You mean the script.py?
Just the 'menu' part you're working on should be fine.

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 11:44 pm
by raeru
Here's the code (don't mind the indentation I did just copy paste on notepad). Please help me senpais ;_;

Didn't include the actual dialogues since it's unnecessary ;_;

Code: Select all

    menu:
        
        "group with Rain.":
            $ death_end = True
            jump rain
            
        "group with Illia.":
            $ death_end = False
            jump illia

label rain:

"...."

jump cont

label illia:

"...."

jump cont

label cont:

    menu:
        
        "We should look for him":
            $ alter_end = True
            jump lookiel
            
        "He's probably roaming around.":
            $ alter_end = False
            jump roamkiel

label lookiel:

   "....."
   jump conto

label roamkiel:

   "....."
   jump conto

label conto:

   "......"


    if death_end == True and alter_end == True:
        jump true
        
    else:
        jump false
        
label true:
    
    "woooi"
    
label false:
    
    "watanays"
    

Re: Specific choice/s to trigger to get into Ending 1

Posted: Wed Oct 05, 2016 11:51 pm
by Divona
Look like you have already fixed the script by change variable name 'deathend' to 'death_end'. It should no longer show:

Code: Select all

NameError: name 'deathend' is not defined
Does it still give an error? What would be the traceback this time?

Oh and don't give label name as 'true' and 'false', just in case.

Re: Specific choice/s to trigger to get into Ending 1

Posted: Thu Oct 06, 2016 12:48 am
by raeru
Divona wrote:Look like you have already fixed the script by change variable name 'deathend' to 'death_end'. It should no longer show:

Code: Select all

NameError: name 'deathend' is not defined
Does it still give an error? What would be the traceback this time?

Oh and don't give label name as 'true' and 'false', just in case.
already changed the label true and false here. Here's the full traceback ;_;

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 5038, in script
    if death_end == True and alter_end == True:
  File "game/script.rpy", line 5038, in <module>
    if death_end == True and alter_end == True:
NameError: name 'death_end' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 5038, in script
    if death_end == True and alter_end == True:
  File "C:\Users\acer\Desktop\OJT BRYLLE\None\New folder\renpy-6.99.11-sdk\renpy\ast.py", line 1647, in execute
    if renpy.python.py_eval(condition):
  File "C:\Users\acer\Desktop\OJT BRYLLE\None\New folder\renpy-6.99.11-sdk\renpy\python.py", line 1670, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\acer\Desktop\OJT BRYLLE\None\New folder\renpy-6.99.11-sdk\renpy\python.py", line 1665, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 5038, in <module>
    if death_end == True and alter_end == True:
NameError: name 'death_end' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
7th Day 0.5

Re: Specific choice/s to trigger to get into Ending 1

Posted: Thu Oct 06, 2016 1:19 am
by raeru
Finally solved the problem. Thanks for helping me ;_;

Code: Select all

init:
    default death_end = 0
    default alter_end = 0
This code is needed before label start