Multiple True False statements and Imagemap

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
User avatar
Napalm_Biscuit
Newbie
Posts: 5
Joined: Sat Aug 18, 2012 8:26 pm
Contact:

Multiple True False statements and Imagemap

#1 Post by Napalm_Biscuit » Sat Sep 01, 2012 10:26 pm

Multiple true-false statements

Hi everyone. I’m looking to make an image-map that sends the player to a specific point in the game. I’d like to do this with True/False statements.

For example, the player has just completed conversation A, now they go to the imagemap and go to the shop and buy an item. Now they go back to the image map and select the “conversation button,” which sends them to conversation B.

Now, after the player completes conversation B they go back to the imagemap and buy another item. Only when they click the “conversation button” they will be sent back to “conversation B” instead of “conversation C”

Up until now I’ve circumvented this problem by making a lot of specific imagemap labels for each conversation. But this has gotten very tedious and made my code quite long and unwieldy.

Rather, I’d like to make things easier on myself by using True/False statements. If the player completes conversation A then $ conversation A = True. Thus, the imagemap will automatically send the player to conversation B.

However, I have not been able to get this to work with multiple True/False statements.

Lets say that I want 5 or so conversations, and the player has completed 4 of them.

Thus,
$ A = True
$ B = True
$ C = True
$ D = True

When, and only when, these 4 specific variable are true, I want the imagemap to send the player to the 5th conversation, conversation E.


The problem is that if any one of the aforementioned variables is $ = True, the player is sent to conversation E.

Any ideas on how to fix the problem?

Please let me know if I have not explained the problem properly.

Also, if anyone has a better solution to my querie than true/false statements, that is also welcomed.

Any help is greatly appreciated!

LittleUrchin
Regular
Posts: 43
Joined: Sat Aug 11, 2012 4:53 pm
Location: Trapped inside a snow cone with a purple walrus and a broken jukebox
Contact:

Re: Multiple True False statements and Imagemap

#2 Post by LittleUrchin » Sat Sep 01, 2012 10:38 pm

Maybe you need to specify that the player can only go to conversation E if all the previous conversations have been completed.

Code: Select all

if A == True and B == True and C == True and D == True:
    jump conversationE
else:
    jump conversationD
Or something to that effect?[/color]

User avatar
Napalm_Biscuit
Newbie
Posts: 5
Joined: Sat Aug 18, 2012 8:26 pm
Contact:

Re: Multiple True False statements and Imagemap

#3 Post by Napalm_Biscuit » Sun Sep 02, 2012 12:16 am

Code: Select all

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
define c = Character('Cynthia', color="#c8ffc8")
define n = Character('Nick', color="#c8ffc8")

init:
    $ con1 = True
    $ con2 = False
    $ con3 = False
    

# The game starts here.
label start:
n "lets do this"
label menu1:
    menu:
        "Conversation":
            if con1 == True:
                jump con1
            if con2 == True:
                jump con2
            if con3 == True:
                jump con3
            else:
                jump room
                
        "Shop":
            "Lalala, this is nice"
            jump shop
        "Restroom":
            "Ahh that was nice"
            jump room
    
    
label con1:
    $ con1 = False
    $ con2 = True
    n "Hi"
    c "Hello"
    jump menu1

label con2:
    $ con2 = False
    $ con3 = True
    n "Where are you?"
    c "I don't know"
    jump menu1
    
label con3:
    $ con3 = False
    n "I hope this works"
    c "Me too"
    jump menu1
    
label shop:
    "So many things to buy"
    jump menu1
    
label room:
    "All done!"
    jump menu1
Thanks for the help. I tried using your method, but it kept looping me to the label "con2"

However, I found that by making previous statements false, I was able to jump the player to the proper conversation.

This may not be the best method, but it gets the job done.

But, if anyone has a more efficient code I'm all ears. I've put the code I'm currently using above.

User avatar
Minnfae
Regular
Posts: 106
Joined: Mon Dec 07, 2009 5:01 am
Projects: Undecided
Contact:

Re: Multiple True False statements and Imagemap

#4 Post by Minnfae » Sun Sep 02, 2012 12:34 am

I'm not quite sure if I got what you wanted right, but here's some code.
You get 3 conversation choices, only after you've talked about all 3 you get a different outcome

Code: Select all

define e = Character('Eileen', color="#c8ffc8")


# The game starts here.
label start:
    e "Hello"
    $ talk1=False
    $ talk2=False
    $ talk3=False
    jump jump1

label jump1:
    if talk1 and talk2 and talk3:
        jump jump2
    menu:

        "Let's talk about 1":
            e "Ok"
            $ talk1= True
            jump jump1
            
        "Let's talk about 2":
            e "Ok"
            $ talk2= True
            jump jump1

        "Let's talk about 3":
            e "Ok"
            $ talk3= True
            jump jump1

label jump2:
    e "We have talked about 1, 2 and 3"
    return
My avatar art is a freebie by SilverHyena. Thanks a lot!

User avatar
Napalm_Biscuit
Newbie
Posts: 5
Joined: Sat Aug 18, 2012 8:26 pm
Contact:

Re: Multiple True False statements and Imagemap

#5 Post by Napalm_Biscuit » Sun Sep 02, 2012 1:12 am

Thanks for the code, unfortunately, it doesn't do quite what I want it to. The problem is that because $ talk1 and $ talk2 are true the game keeps jumping to the label "room." Even when talk1, talk2, and talk3 all equal true, the game keeps jumping to the label "room." The problem is that I want it to jump to the label "room2," when, and only when all three variables are true.

Basically, I want the player to have these conversations in a certain order, but I also want to give them the freedom to do other things in-between the conversations through a menu or imagemap , and then return the proper conversation.

Here is the code I modified.

Code: Select all

label start:
n "Hello"
$ talk1=False
$ talk2=False
$ talk3=False

jump jump1

label jump1:
    menu:

        "Let's talk about 1":
            n "Ok"
            $ talk1 = True
            jump jump1
           
        "Let's talk about 2":
            n "Ok"
            $ talk2 = True
            jump jump1

        "Let's talk about 3":
            n "Ok"
            $ talk3 = True
            jump jump1
            
        "Go somewhere else":
            jump jump3
            
label jump3:
    if talk1 and talk2:
        jump room
    elif talk1 and talk2 and talk3:
        jump room2
    else:
       jump jump1 
 
label room:
    "Nooooo!!"
    "Yeeess!!"
    jump jump1
label room2:
    n "Get outta here!!"
    jump jump1

User avatar
Minnfae
Regular
Posts: 106
Joined: Mon Dec 07, 2009 5:01 am
Projects: Undecided
Contact:

Re: Multiple True False statements and Imagemap

#6 Post by Minnfae » Sun Sep 02, 2012 1:25 am

Of course it will jump to room, because of this:

Code: Select all

if talk1 and talk2:
        jump room
    elif talk1 and talk2 and talk3:
        jump room2
    else:
       jump jump1 
the first situation (talk1 and talk2 being true) is a subset of the second situation (all of them being true).

if you replace it with:

Code: Select all

if talk1 and talk2 and talk3:
        jump room2
elif talk1 and talk2:
        jump room
jump jump1
Of course, if you do that, the order in the which the person activates all three will be important
My avatar art is a freebie by SilverHyena. Thanks a lot!

LittleUrchin
Regular
Posts: 43
Joined: Sat Aug 11, 2012 4:53 pm
Location: Trapped inside a snow cone with a purple walrus and a broken jukebox
Contact:

Re: Multiple True False statements and Imagemap

#7 Post by LittleUrchin » Sun Sep 02, 2012 11:24 am

Ah, sorry it didn't work. I hope someone's able to help you out with this better. Sorry I wasn't of much help. D:

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot, zyric