Multiple Jump

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.
Message
Author
KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Multiple Jump

#1 Post by KarloPan »

Hello there,
Sorry i just want to ask annother thing if this Could he Possible

At this Moment i Use an Inefficient way of an Move Screen,
First i define in each label wich direction is Possible and then i define in an extra .rpy file that if this Direction is true you can go there

Code: Select all

label x:
$North = True
$South = True
label y:
The default is False
IN that extra .rpy file i run a code like

Code: Select all

                    if South == True and Player_position == "x":
                        textbutton "SW":
                            action [reset_w, Jump("y")]
the reset_w is a function which reset the whole variablies (North, South) to False :D

And i want to ask if it is Possible to use Mutliple Jumps

Code: Select all

                    if South == True:
                        textbutton "SW":
                            action [reset_w, Jump("y") or Jump("z)]
Because in the if line i determine in which direction you can go... but it don't worked for me with or, and or an extra label just with write every label by itself and this is a huge amount of text xD
Without the Additional Player_position Variable, just with the Coordinate variable

Thanks :D
Karlo

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#2 Post by Remix »

You would either need to include a conditional test or let Ren'py make a random choice... how else would it know whether to jump to "y" or "z"?

Code: Select all

textbutton "SW":
    if some conditional test:
        action [reset_w, Jump("y")]
    else:
        action [reset_w, Jump("z")]

or

textbutton "SW":
    action [reset_w, Jump(renpy.random.choice(["y", "z"]) ]
Typed on the fly for random choice so you might have to quicky search forum for correct syntax and usage
Frameworks & Scriptlets:

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#3 Post by Remix »

Sub-note:

If you are repeatedly using the same process and perhaps using similar python logic each time, you could code a function to return a 'target' label name and use that to re-interpret a known label jump...

Code: Select all

python:
    def end_up_at():
        if some conditional test:
            return 'label_1'
        else:
            return 'label_2'
    config.label_overrides = {'jump_to_me' : end_up_at() }
All jumps to 'jump_to_me' would then end up at label_1 or 2 depending on test
Frameworks & Scriptlets:

KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Re: Multiple Jump

#4 Post by KarloPan »

So with your Description i could use this code but change every direction to it unique thing

Code: Select all

python:
    def end_up_at():
        if South == True:
            return 'x'
        else:
            pass
    config.label_overrides = {'jump_to_me' : end_up_at() }
but how when i use the same direction like "South" multiple times?

Does i need to write this function 100 times? for every "South" i include?

Code: Select all

python:
    def end_up_at():
        if South_1 == True:
            return 'y'
        else:
            pass
    config.label_overrides = {'jump_to_me' : end_up_at() }

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#5 Post by Remix »

It rather depends on the logic of how you have your 'map' set up... if there is logic within that (by which I mean a move south always increases the letter by 5 or somesuch... e.g. player_position at "h" moves south one reaches "m"... moves south one more reaches "r" etc you could code the move_south() label function to use that logic to increment player_position...

To add further advice I/we would appreciate a quick look at how the map, movement choice and restrictions is set up... basically what tells ren'py that "x" is north or north east of "y" or "z" and why is there a choice...
Frameworks & Scriptlets:

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Multiple Jump

#6 Post by Alex »

Try to create the description of your game field like list of lists

Code: Select all

[ [0,1,0],
  [1,1,1],
  [0,1,0] ]
so player's position would be list_name[y][x] and you easily could change it by adding/substracting 1 to x/y.

Farther, instead of "1"s and "0"s make a description for each field like in what direction player can go from it

Code: Select all

[ [{"north": False, "east": False, "south": False, "west": False}, {"north": True, "east": False, "south": True, "west": False}, {"north": False, "east": False, "south": False, "west": False}],
  [{"north": False, "east": True, "south": False, "west": True}, {"north": True, "east": Truse, "south": True, "west": True}, {"north": False, "east": True, "south": False, "west": True}],
  [{"north": False, "east": False, "south": False, "west": False}, {"north": True, "east": False, "south": True, "west": False}, {"north": False, "east": False, "south": False, "west": False}] ]
you can fill the lists automaticaly or manualy.

And then you can check for current position if player can move north or south etc. like

Code: Select all

if list_name[y][x]["north"]

KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Re: Multiple Jump

#7 Post by KarloPan »

aha!!!
That'S the point why i don't understand you xD
I basicly do not have something like this in my renpy xD

I just use the Base Renpy functions i think xD

i made a screen where every Coordinate have his position (N, O, S, W)
And if i want that this coordinate is shown i use attibutes

Code: Select all

label Kitchen

    $ Player_position = "Kitchen"
    $ North = True # in the Bath
    $ South = True # in the Garden


label Bath

    $ Player_position = "Bath"
    $ South = True # From Bath in the Kitchen

label garden

    $ Player_position = "Garden"
    $ North = True # From garden in the Kitchen

like this looks my Rpy file
Then i made a screen and a button that is shown everytime "MOVE" and when the player press the textbutton this screen is shown
and if the player is in this room then renpy shows the specific Coordinate

Code: Select all


                    if South == True and Player_position == "Bath":
                        textbutton "S":
                            action [reset_w, Jump("Kitchen")]

                    if North == True and Player_position == "Garden":
                        textbutton "N":
                            action [reset_w, Jump("Kitchen")]

                    if North == True and Player_position == "Bath":
                        textbutton "N":
                            action [reset_w, Jump("Kitchen")]

this is my build ... i don't define something for renpy xD
as i said i am not good with this python things xD

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#8 Post by Remix »

It is all good... and perhaps a step on the way to becoming a programmer.
As Alex started to point out... try to think like a computer (adding ones and zeros (binary) is a lot easier for them than letters) and map (not cartographic, just umm map) your layout in easy numeric terms... let some process logic do all the hard work...

example

Code: Select all

# this bit would be in a python init
lil_map = [
    [0, 1, 0],
    [0, 2, 3],
    [4, 2, 0]
] # 0 is no go, 1 is kitchen, 2 corridor, 3 lounge, 4 toilet
player_pos = (0, 1) # first row (lists start at zero), second column... the kitchen

# now the computer knows a rough map and knows where the player is...
# let's let it calculate where he can move...

# we can do this in ren'py screen

screen movement_choice():
    modal True
    style_prefix "choice"
    vbox:
        # north ? (to go north we must be on row 1 or higher and have row-1, column(same) available, aka not zero
        if player_pos[0] > 0 and lil_map[ player_pos[0]-1 ][ player_pos[1] ] != 0:
            textbutton "Move North":
                action [ SetVariable( "player_pos", ( lil_map[ player_pos[0]-1, player_pos[1] ),
                           Jump( "label_{0}".format( lil_map[ player_pos[0]-1 ][ player_pos[1] ] ) )
                       ]
        # etc for other directions
Then each time we ask if they want to move, we 'show screen movement_choice()' (with one dialogue line below it to ask 'where next')and let the computer decide where is available...

If you can see the logic in that type of approach I hope you might try to code the south, east, west etc textbuttons and start dabbling in code
Frameworks & Scriptlets:

KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Re: Multiple Jump

#9 Post by KarloPan »

Argh xD
Sorry but i do not Really get it xD

Code: Select all

    lil_map = [
        [0, 1, 0],
        [0, 2, 3],
        [4, 2, 0]
    ] # 0 is no go, 1 is kitchen, 2 corridor, 3 lounge, 4 toilet
    player_pos = (0, 1) # first row (lists start at zero), second column... the kitchen
I understand this, this is the screen where we define a Specific Location... for the kitchen, korridor etc.
But what if i want another room? can i also use this pattern?

Code: Select all

screen movement_choice():
    modal True
    style_prefix "choice"
    vbox:
        # north ? (to go north we must be on row 1 or higher and have row-1, column(same) available, aka not zero
        if player_pos[0] > 0 and lil_map[ player_pos[0]-1 ][ player_pos[1] ] != 0:
            textbutton "Move North":
                action [ SetVariable( "player_pos", ( lil_map[ player_pos[0]-1, player_pos[1] ),
                           Jump( "label_{0}".format( lil_map[ player_pos[0]-1 ][ player_pos[1] ] ) )
                       ]
        # etc for other directions
This screen hates me ....
first if i try it i get an error

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 25: is not terminated with a newline. (Check strings and parenthesis.)
                    action [ Set Variable( "player_pos", ( lil_map[ player_pos[0]-1, player_pos[1] ]), Jump( "label_{0}".format( lil_map[ player_pos[0]-1 ][ player_pos[1] ) ) )]

Ren'Py Version: Ren'Py 6.99.12.4.2187
Second i try to understand it

the screen is no Problem for me but the if sentence...

if player_pos[0] > 0 and lil_map[ player_pos[0]-1 ][ player_pos[1] ] != 0:

So that means that if player_pos that is default 0 is bigger then 0 and (the rest i don't understand) is not equal to zero:

[ SetVariable( "player_pos", ( lil_map[ player_pos[0]-1, player_pos[1] ), Jump( "label_{0}".format( lil_map[ player_pos[0]-1 ][ player_pos[1] ] ) ) ]

and i do not really understand this whole sentence xD

I'am really sorry :( i am bad with this but try my best to understand things like this :D

And thanks all for the help until now!!!
Karlo

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#10 Post by Remix »

Next step toward learning some python... Lists, Tuples and Dicts

That should hopefully explain what player_pos[0] and [1] refer to.

As to the script error... I typed it on the fly so probably mismatched a brace or parenthesis... Will look further after a nap (a long through the night type nap)
Frameworks & Scriptlets:

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#11 Post by Remix »

Having had a sleep and taken the time to think about things, I believe the previous advice is slightly over complicating things.
After all, we basically only need info telling about each room/area and its connections.

This is most likely easiest done with a keyed dictionary such as:

Code: Select all

default location_info = {
    # key : [label name, button text, connections listed by key ]
    'kt' : ["kitchen_label", "Visit the Kitchen", "hw", "lg", "gd"],
    'hw' : ["hallway_label", "Enter Hallway", "kt", "wc", "lg", "xx"],
    'wc' : ["toilet_label", "Pop to the Lav", "hw"],
    'gd' : ["garden_label", "Brave the Outdoors", "kt"],
    'lg' : ["lounge_label", "The Lounge", "hw", "kt"],
    'xx' : ["mysterious_door_label", "Try the Mysterious Door", "hw"],
}

# A screen for movement

screen movement_choice(current_location="kt", extra_buttons=[]):
    modal True
    style_prefix "choice"
    vbox:
        $ location_opts = location_info[ current_location ]
        for connection in location_opts[2:]:
            $ label_name, button_text = location_info[ connection ][0], location_info[ connection ][1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]
        # Finally any *extra_buttons* we passed in
        # Presumes any were passed as [ ("label_name", "button text") ]
        for extra_button in extra_buttons:
            $ label_name, button_text = extra_button[0], extra_button[1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]

label start:
    "Start - We are in the hall"
    # A call like this will then show all movement options available to the key "hw"
    show screen movement_choice("hw")
    "Where to?"
As long as each location can say where it is connected to, we can use logic to build the movement choice screen dynamically.

I hope that way makes a bit more sense
Frameworks & Scriptlets:

KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Re: Multiple Jump

#12 Post by KarloPan »

Hello there,
First THANK YOU Remix and Alex!!!!
Really... wow xDThis makes things a lot easier to understand ...!

Code: Select all

default location_info = {
    # key : [label name, button text, connections listed by key ]
    'kt' : ["kitchen_label", "Visit the Kitchen", "hw", "lg", "gd"],
    'hw' : ["hallway_label", "Enter Hallway", "kt", "wc", "lg", "xx"],
    'wc' : ["toilet_label", "Pop to the Lav", "hw"],
    'gd' : ["garden_label", "Brave the Outdoors", "kt"],
    'lg' : ["lounge_label", "The Lounge", "hw", "kt"],
    'xx' : ["mysterious_door_label", "Try the Mysterious Door", "hw"],
}
"
Just a few questions to understand you right :D
1. you set the default for every Location that is Possible, how does renpy know that the first is the Label, the second the Button text and the third the connection? do you set it on the #key line? i thougt everything with # before the text, renpy will not read.
2. if i want to add something i just need to put a key and the other things in that brace, can i also use more then 2 keys? like "xxx" or whole words like "Kitchen"?

Code: Select all

# A screen for movement

screen movement_choice(current_location="kt", extra_buttons=[]):
    modal True
    style_prefix "choice"
    vbox:
        $ location_opts = location_info[ current_location ]
        for connection in location_opts[2:]:
            $ label_name, button_text = location_info[ connection ][0], location_info[ connection ][1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]
        # Finally any *extra_buttons* we passed in
        # Presumes any were passed as [ ("label_name", "button text") ]
        for extra_button in extra_buttons:
            $ label_name, button_text = extra_button[0], extra_button[1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]

i understand this screen, but i never thought that it's that easy... , first he wil read where you are and give you the options that you defined in the default section, then it gives you the buttons after you pressed one they hide and show everytime the label ends

label start:
"Start - We are in the hall"
# A call like this will then show all movement options available to the key "hw"
show screen movement_choice("hw")
"Where to?"

so you need this show screen movement_choice() after every label in that brace you put your current location of that room, can i also use a button to show that screen? yes right? xD
can i also use my screen with the different locations N, O, S, W and connect the Key's to it?

Code: Select all

    'hw' : ["hallway_label", "Enter Hallway", "kt[N]", "wc[O]", "lg[S]", "xx[W]"],
Something like this? or do you have to define another thing in the default section?

Anyway it works for me it's just a few additonal questions to understand xD
THANK YOU SO MUCH!!!!

Karlo

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#13 Post by Remix »

KarloPan wrote: Sat Jul 22, 2017 11:55 amJust a few questions to understand you right :D
1. you set the default for every Location that is Possible, how does renpy know that the first is the Label, the second the Button text and the third the connection? do you set it on the #key line? i thougt everything with # before the text, renpy will not read.
That is basically just a format I opted for to hold the data in. If you chose a different format, the script part to output the choice buttons would need amending to suit.
2. if i want to add something i just need to put a key and the other things in that brace, can i also use more then 2 keys? like "xxx" or whole words like "Kitchen"?
Yes, you could use any phrase or even number for the keys (as long as each is unique). Just remember to use the same key phrase when telling another location that it connects to that key.
i understand this screen, but i never thought that it's that easy... , first he wil read where you are and give you the options that you defined in the default section, then it gives you the buttons after you pressed one they hide and show everytime the label ends
Yup, basically:
$ location_opts = location_info[ current_location ]
will take the current_location and return the dictionary value relevant to that key, so for "kt" it would set
$ location_opts = ["kitchen_label", "Visit the Kitchen", "hw", "lg", "gd"]
It then iterates through [2:] which means all items after the second one, so "hw", "lg" and "gd"
For each one, it returns to the dictionary and reads the label name and button text relevant to that key
$ label_name, button_text = location_info[ connection ][0], location_info[ connection ][1]
# A call like this will then show all movement options available to the key "hw"
show screen movement_choice("hw")
"Where to?"

so you need this show screen movement_choice() after every label in that brace you put your current location of that room, can i also use a button to show that screen? yes right? xD
Basically, where-ever in your various labels you ask the player where they want to go, you would call that screen and pass it the key relating to that location.

If you chose to have a button that launched the movement choice screen you would probably want to store the current_location as a variable and change it within each label. You would need to tweak the screen parameters to reflect not passing that variable though.

screen movement_choice( current_location=None, extra_buttons=[] ):

label somewhere:
$ current_location = "somewhere_with_a_key_in_the_dict"
show screen movement_choice() # no parameters passed
can i also use my screen with the different locations N, O, S, W and connect the Key's to it?

Code: Select all

    'hw' : ["hallway_label", "Enter Hallway", "kt[N]", "wc[O]", "lg[S]", "xx[W]"],
Something like this? or do you have to define another thing in the default section?
You *could* include the compass directions like that, yes. Just you would have to add a few more keys as approaching somewhere from each direction would need its own key...
'w2kt' : ["kitchen_label", "Go West to Visit the Kitchen", "hw", "lg", "gd"], # lounge might use this one
's2kt' : ["kitchen_label", "Go South to Visit the Kitchen", "hw", "lg", "gd"], # hallway might use this one though
# they both there lead to the same label

So, yes, it is do-able. I would first ask yourself whether it benefits the story though. Does the player really need to know which direction the kitchen is in?

Sub-note: If approaching the kitchen from the hall resulted in different conversation than if approached from the lounge, you might want to use multiple keys leading to the same place.
Frameworks & Scriptlets:

KarloPan
Newbie
Posts: 14
Joined: Thu Jun 22, 2017 8:16 pm
Contact:

Re: Multiple Jump

#14 Post by KarloPan »

THANK YOU, THANK YOU, THANK YOU So much! :3
wow xD
Such a good Description of it wow!! ... i can't say thank you enaugh to thank you enaugh ... xD wow xD
I understand everything and you are right... it's not necessary that the player knows in which direction the kitchen is... only that if he klicks a button he will be in the kitchen !
I want to use a "GO" button because i have a menu in every label and want that the player can choose by itself if he wants to go in another room :D

I used what you said and put in two labels the different current location now it looks like this

Code: Select all

default location_info = {
    # key : [label name, button text, connections listed by key ]
    'kt' : ["kitchen_label", "Visit the Kitchen", "hw", "lg", "gd"],
    'hw' : ["hallway_label", "Enter Hallway", "kt", "wc", "lg", "xx"],
    'wc' : ["toilet_label", "Pop to the Lav", "hw"],
    'gd' : ["garden_label", "Brave the Outdoors", "kt"],
    'lg' : ["lounge_label", "The Lounge", "hw", "kt"],
    'xx' : ["mysterious_door_label", "Try the Mysterious Door", "hw"],
}

# A screen for movement

screen movement_choice(current_location="", extra_buttons=[]):
    modal True
    style_prefix "choice"
    vbox:
        $ location_opts = location_info[ current_location ]
        for connection in location_opts[2:]:
            $ label_name, button_text = location_info[ connection ][0], location_info[ connection ][1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]
        # Finally any *extra_buttons* we passed in
        # Presumes any were passed as [ ("label_name", "button text") ]
        for extra_button in extra_buttons:
            $ label_name, button_text = extra_button[0], extra_button[1]
            textbutton "[button_text]":
                action [ Hide("movement_choice"),
                         Jump( label_name )
                       ]
screen player_move_button:
    textbutton "GO" action [ Show("movement_choice")] align (.3,.01)
                
label start:
    
    $ current_location = 'kt'
    
    show screen player_move_button
    
    "Start - We are in the hall"
    
    "Where to?"
    
    jump start
  
label mysterious_door_label:
    
    $current_location = 'xx'
    
    "Door"
    
    "Where to?"
    
    jump mysterious_door_label
but if i start it and press the "GO" button i got this error

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 21, in execute
    screen movement_choice(current_location="", extra_buttons=[]):
  File "game/script.rpy", line 21, in execute
    screen movement_choice(current_location="", extra_buttons=[]):
  File "game/script.rpy", line 24, in execute
    vbox:
  File "game/script.rpy", line 25, in execute
    $ location_opts = location_info[ current_location ]
  File "game/script.rpy", line 25, in <module>
    $ location_opts = location_info[ current_location ]
KeyError: u''

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

Full traceback:
  File "lib/windows-i686/script.rpyc", line 52, in script
  File "F:\renpy-6.99.12.4-sdk\renpy\ast.py", line 613, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "F:\renpy-6.99.12.4-sdk\renpy\exports.py", line 1147, in say
    who(what, interact=interact)
  File "F:\renpy-6.99.12.4-sdk\renpy\character.py", line 877, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "F:\renpy-6.99.12.4-sdk\renpy\character.py", line 716, in do_display
    **display_args)
  File "F:\renpy-6.99.12.4-sdk\renpy\character.py", line 508, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "F:\renpy-6.99.12.4-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2793, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 399, in visit_all
    callback(self)
  File "F:\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2793, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "F:\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 409, in per_interact
    self.update()
  File "F:\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 578, in update
    self.screen.function(**self.scope)
  File "game/script.rpy", line 21, in execute
    screen movement_choice(current_location="", extra_buttons=[]):
  File "game/script.rpy", line 21, in execute
    screen movement_choice(current_location="", extra_buttons=[]):
  File "game/script.rpy", line 24, in execute
    vbox:
  File "game/script.rpy", line 25, in execute
    $ location_opts = location_info[ current_location ]
  File "game/script.rpy", line 25, in <module>
    $ location_opts = location_info[ current_location ]
KeyError: u''

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Test 1.0
and i do not know why...in my eyes this error means that he could not find the current_location... but i defined it ... also if i check the variables current_location has the variable "kt"

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Multiple Jump

#15 Post by Remix »

Oops, my bad...

A couple of minor amends...

Remove current_location parameter from screen
screen movement_choice( extra_buttons=[] ):

Actually that might be all that is truly needed, these others just to polish the code

Always define screens with parenthesis... code runs faster
screen player_move_button(): # the () stops ren'py from re-evaluating everything or somesuch

Set a default for our variable
default current_location = "hw"
Frameworks & Scriptlets:

Post Reply

Who is online

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