KarloPan wrote: ↑Sat Jul 22, 2017 11:55 amJust a few questions to understand you right
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.