Problems with variables on map screen

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
Tolwyn
Newbie
Posts: 1
Joined: Wed Aug 24, 2022 3:12 pm
Contact:

Problems with variables on map screen

#1 Post by Tolwyn » Wed Aug 24, 2022 3:23 pm

noob question

i have a weird behavior trying to build a map screen.
currently there are one 2 locations and depending on some variables different imagebuttons are shown and jumps are made

so the expected order would be getting scene 1, 2 , 3
BUT
if i just start and run i end up with 1, 2, 2, 3
sometimes even with
1, 1, 2, 2, 3
BUT
if i press shift-o and then Esc on the map screen everything works perfectly
which smells like some init problem?
all variable have the correct content (checked via showing it at the top of the map screen itself)
so it shows the correct values but doesn t act like them

here s the code for the map

Code: Select all

screen MapK():
    tag MapK
    frame:
        xalign 0.0
        yalign 0.0
        xsize 1920
        ysize 1080
        background "k.png"
        textbutton  "sta [story_status] emb [map_embassy] pal [map_palace]"

        if map_krissa_embassy == True:
            imagebutton:
                xpos 1346
                ypos 551
                idle "embassy active.png"
                hover "embassy.png"
                if story_status == 201:
                    action Jump ("b1c02_201")
                else:
                    action NullAction()
        else:
            imagebutton:
                xpos 1346
                ypos 551
                idle "embassy idle.png"
                action NullAction()

        if map_palace == True:
            imagebutton:
                xpos 935
                ypos 126
                idle "palace active.png"
                hover "palace.png"
                if story_status == 202:
                    action Jump ("b1c02_202")
                elif story_status == 203:
                    action Jump ("b1c02_203")
                else:
                    action NullAction()
        else:
            imagebutton:
                xpos 935
                ypos 126
                idle "palace idle.png"
                action NullAction()

and here for the calls
1
$ map_embassy = True
$ map_palace = False
$ story_status = 201
call screen MapK
2
$ map_embassy = False
$ map_palace = True
$ story_status = 202
call screen MapK
3
$ map_embassy = False
$ map_palace = True
$ story_status = 203
call screen MapK
Last edited by Tolwyn on Thu Aug 25, 2022 4:47 am, edited 1 time in total.

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Problems with variables on map screen

#2 Post by m_from_space » Thu Aug 25, 2022 4:42 am

Please embed your code into [ code ]...[ /code ] tags first (without the spaces). It's too annoying to read it this way.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot]