Code: Select all
screen my_scr(places):
frame:
pos (0.1, 0.2)
xysize(200,400)
vbox:
text "Places:"
null height 5
for place in places:
button:
text place["place"]
action [Show("img_scr", i=place["img"]), Show("my_2_scr",l=place["actions_list"])]
null height 5
screen img_scr(i):
add i pos(0.4,0.2)
screen my_2_scr(l):
frame:
pos (0.4, 0.5)
xysize(400,220)
vbox:
text "Actions:"
null height 5
if not renpy.get_screen("say"):
for act in l:
if act.has_key("res"): #New
button:
text act["act_name"]
action Return(act["res"])
null height 5
elif act.has_key("jump"): #New
button:
text act["act_name"]
action Jump(act["jump"])
null height 5
image pl_1:
size(150,150)
Solid("#c00")
image pl_2:
size(150,150)
Solid("#00c")
# The game starts here.
label start:
$ day0_1200 = [ {"place":"Place 1", "img":"pl_1", "actions_list":[{"act_name":"Look around", "res":"It's Place 1 here."}, {"act_name":"Listen", "res":"It's quiet here."},]},
{"place":"Place 2", "img":"pl_2", "actions_list":[{"act_name":"Look around", "res":"It's Place 2 here."}, {"act_name":"Listen", "res":"Hey, there's some music playing..."},]},
{"place":"Place 3", "img":"pl_3", "actions_list":[{"act_name":"Look around", "res":"It's Place 3 here."}, {"act_name":"Naoya", "jump": 'naoya_01'},]}
]
"..."
show screen my_scr(day0_1200)
label day0_map1:
window hide
$ txt = ui.interact()
"[txt]"
jump day0_map1
label naoya_01:
hide screen my_scr
"Naoya challenges you to a battle."
#The game goes on, loop has exited succesfully
it displays the corresponding dialogue. If the key is "jump", it jumps to the corresponding label, exiting the loop. If you want further behavior you can add more elifs and more keys with more values. I hope that made sense.
I'm still trying to figure out the multiple lines dialogue but I hope this solves the jumping issue.