Big series of "if a > b" forks

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
LordIllidan
Newbie
Posts: 9
Joined: Wed Aug 26, 2009 12:13 am
Contact:

Big series of "if a > b" forks

#1 Post by LordIllidan »

Hi all.

I think I'm overlooking something very obvious, because I seem to be having a hard time getting a simple bit of coding to work.

Code: Select all

    (Some dialogue)
    if silica_regard == dimona_regard:
        if game_cleared >= 1:
            if dimona_regard > fenrir_disregard:
                $arc == 3
            else:
                $arc ==0
        else:
            $arc ==0
    else:
        if silica_regard > dimona_regard:
            $arc == 1
        else:
            $arc ==2
    if arc ==0:
        (Some dialogue)
    if arc ==1:
        (Some dialogue)
    if arc ==2:
        (Some Dialogue)
    if arc ==3:
        (Some Dialogue)
    nvl clear
    (Some Dialogue)
Now, if I'm reading this right, this code should first be checking whether or not silica_regard and dimona_regard are equal. If so, it checks to see if game_cleared is greater than or equal to one. If so, it checks to see if these variables are greater than fenrir_disregard. If so, it sets arc to 3. If one of the last two conditions are not met, though, arc is set to 0.

If these two variables are not equal, it checks to see which variable is the biggest out of fenrir_disregard, silica_regard, and dimona_regard, and sets arc to either 0, 1, or 2 respectively.

Ideally, that's how it should be working. However... It's not. I've tested this bit of code twice so far, and it doesn't seem to be working. Both times, fenrir_disregard and game_cleared was set to 0. The first time, silica_regard was at 4 and dimona_regard at 2, the second time, dimona_regard was at 4 and silica_regard was at -1.

I've checked to make sure all capitalization is in order and that all variables have been defined properly, and yet... Both of my tests so far have caused the game to leave arc at 0. What am I doing wrong?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Big series of "if a > b" forks

#2 Post by PyTom »

== is the equality operator, while = is the assignment operator. So when you write:

Code: Select all

           $arc == 3
You're testing if arc is equal to 3, and then not doing anything with the result. Changing it to:

Code: Select all

           $ arc = 3
will be beneficial.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

LordIllidan
Newbie
Posts: 9
Joined: Wed Aug 26, 2009 12:13 am
Contact:

Re: Big series of "if a > b" forks

#3 Post by LordIllidan »

PyTom wrote:== is the equality operator, while = is the assignment operator. So when you write:

Code: Select all

           $arc == 3
You're testing if arc is equal to 3, and then not doing anything with the result. Changing it to:

Code: Select all

           $ arc = 3
will be beneficial.
Aha, I knew it had to be something obvious XD

That seems to have worked. Thanks! :D

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]