Hey Andredon and Valentin! I've been trying to add a choice system to your code that shows you choices within the messenger itself and not like the ones when you use 'menu'. It works swimmingly but there's a small problem. It'll be easier to explain if you just see the code:
Code: Select all
def msg(txt, choice1=False, choice2=False,choice3=False, who=False, sound=False): #Just added these variables 'choice'
store.m_msg.append((who, txt, choice1,choice2,choice3, sound))
store.yadj.value = store.yadj.range+300
for message in m_msg[::-1]:
$ who, txt, choice1,choice2,choice3, sound = message
$ xgn = 0.0 if who else 1.0
imagebutton auto "messenger/sound_%s.png" xalign xgn action Play("sound", sound)
elif choice1: #
frame background Frame("messenger/box.png"): #
align (0.1, 0.1) #Added
yalign 0.5 #Lines
textbutton "%s"%(choice1) hover_background "#00a" action Function(del_all_msg), Jump("window") #
textbutton "%s"%(choice2) hover_background "#00a" action Function(del_all_msg), Jump("door") #
button xalign xgn xmaximum 580 xpadding 20 ypadding 10 background Frame("messenger/box.png", 25, 25):
# image "charmander1.png"
text "%s"%(txt) style "txt_base"
Code: Select all
#in the script.rpy file
msg("You MUST get those cookies back!")
msg("But what can we do?...")
msg("We could sneak in from the window...", who=1)
msg("Or we could just walk in the front door!",who=1)
msg("What should we do?")
msg("", choice1="Sneak in through the window", choice2="Walk through the door")
msg("Kacha! You accidently broke the window")
msg("Your neighbour appears")
msg("Fi Fy Fo Fum broke my window, you Scum!")
msg("Your strength is insufficient. You can't even open a door!")
msg("You can smell your cookies")
msg("Your hunger increases and it gives you strength!")
msg("You push the door again and accidently break the house!")
See, the choices work as long as you click the textbuttons. But if I click outside the 'choice' frame the game moves on to the next label, irrespective of whether any choice is made or not!
I don't know how to fix this... I made a post with this question and it seems using the 'call' statement halts the game until a textbutton is pressed...but I don't know how to put 'call' in the code.
Do you have any idea on how to fix this? Or is this not the way to do it?
Help would be appreciated! I find myself coming back here often, and you guys are kind enough to always show me the way, so thanks a ton!
Have a great day~