About returning to a certain point in the game (?)
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.
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.
About returning to a certain point in the game (?)
I have this textbutton that appears on the screen all the time. When you click it, it jumps to a label. What I want to do is after jumping to that label, the game returns to the part or point of the game when or before the button is clicked. Is that possible? Or does anyone even understand what I'm saying, because I don't know how to explain it further. Thanks!
- SilverxBlue
- Miko-Class Veteran
- Posts: 962
- Joined: Sat Jan 01, 2011 1:22 pm
- Completed: Caught in Between: A childhood prologue
- Projects: MDLS, Alice Hunt(Temporarily on-hold), The Guardian's Spell and one other unannounced thing.
- Location: Philippines
- Contact:
Re: About returning to a certain point in the game (?)
Eh? I think I understand half of it but I'm not sure. Could you post the code you used, and a screen shot of what happens?
Re: About returning to a certain point in the game (?)
I don't think the code is necessary because there really is no problem with it right now, but i'll show you anyway ^^.
Under the init python, I wrote the code for the textbutton and the others that go with it:
After that are labels and stuff where:
That's always set to True. Then, the label where the textbutton jumps to is here:
Those are the code.
For example, I'm in the middle of narration in a label, let's say in "label 1". And I clicked the textbutton, so I'd jump to "label statistics2". After everything else in "label statistics2" the game should jump back to the last part in the game before I clicked the textbutton. So that the narration would continue where it stopped. What I need is the code for jumping back to the last part before the textbutton is clicked. And another problem is how would I know when and at what part of the game the player clicked the button so it would jump back there.
Does that make it clearer or I'm only confusing you more? Sorry if I'm making it harder to understand; I have problems expressing myself in English. ^^
Under the init python, I wrote the code for the textbutton and the others that go with it:
Code: Select all
#stats overlay
def display_stat():
if show_display_stat:
ui.frame()
ui.vbox(xpos=0.03, ypos=0.03)
ui.text("Day %s" %day)
ui.text("%s" %dayname)
ui.text("Money: $ %s" %money)
ui.text("HP: %s" %hp)
ui.textbutton("Statistics", clicked=ui.jumps("statistics2"))
ui.close()
config.overlay_functions.append(display_stat)
Code: Select all
$ show_display_stat = True
Code: Select all
label statistics2:
$ show_display_stat = False
stat "Day %(day)s \n%(dayname)s \nMoney: %(money)s \nHP: %(hp)s\n"
For example, I'm in the middle of narration in a label, let's say in "label 1". And I clicked the textbutton, so I'd jump to "label statistics2". After everything else in "label statistics2" the game should jump back to the last part in the game before I clicked the textbutton. So that the narration would continue where it stopped. What I need is the code for jumping back to the last part before the textbutton is clicked. And another problem is how would I know when and at what part of the game the player clicked the button so it would jump back there.
Does that make it clearer or I'm only confusing you more? Sorry if I'm making it harder to understand; I have problems expressing myself in English. ^^
Re: About returning to a certain point in the game (?)
I don't think the code is necessary because there really is no problem with it right now, but i'll show you anyway ^^.
Under the init python, I wrote the code for the textbutton and the others that go with it:
After that are labels and stuff where:
That's always set to True. Then, the label where the textbutton jumps to is here:
Those are the code.
For example, I'm in the middle of narration in a label, let's say in "label 1". And I clicked the textbutton, so I'd jump to "label statistics2". After everything else in "label statistics2" the game should jump back to the last part in the game before I clicked the textbutton. So that the narration would continue where it stopped. What I need is the code for jumping back to the last part before the textbutton is clicked. And another problem is how would I know when and at what part of the game the player clicked the button, like what label and where in that label(?), so it would jump back there.
Does that make it clearer or I'm only confusing you more? Sorry if I'm making it harder to understand; I have problems expressing myself in English. ^^
Under the init python, I wrote the code for the textbutton and the others that go with it:
Code: Select all
#stats overlay
def display_stat():
if show_display_stat:
ui.frame()
ui.vbox(xpos=0.03, ypos=0.03)
ui.text("Day %s" %day)
ui.text("%s" %dayname)
ui.text("Money: $ %s" %money)
ui.text("HP: %s" %hp)
ui.textbutton("Statistics", clicked=ui.jumps("statistics2"))
ui.close()
config.overlay_functions.append(display_stat)
Code: Select all
$ show_display_stat = True
Code: Select all
label statistics2:
$ show_display_stat = False
stat "Day %(day)s \n%(dayname)s \nMoney: %(money)s \nHP: %(hp)s\n"
For example, I'm in the middle of narration in a label, let's say in "label 1". And I clicked the textbutton, so I'd jump to "label statistics2". After everything else in "label statistics2" the game should jump back to the last part in the game before I clicked the textbutton. So that the narration would continue where it stopped. What I need is the code for jumping back to the last part before the textbutton is clicked. And another problem is how would I know when and at what part of the game the player clicked the button, like what label and where in that label(?), so it would jump back there.
Does that make it clearer or I'm only confusing you more? Sorry if I'm making it harder to understand; I have problems expressing myself in English. ^^
- SilverxBlue
- Miko-Class Veteran
- Posts: 962
- Joined: Sat Jan 01, 2011 1:22 pm
- Completed: Caught in Between: A childhood prologue
- Projects: MDLS, Alice Hunt(Temporarily on-hold), The Guardian's Spell and one other unannounced thing.
- Location: Philippines
- Contact:
Re: About returning to a certain point in the game (?)
Oh! I get it now! Gosh I'm so slow...
I think what you need is some sort of "return" to game button or something.
I'm not really sure but maybe this topic would help.
http://lemmasoft.renai.us/forums/viewto ... f=8&t=9808
Sorry if it wont help at all.
I think what you need is some sort of "return" to game button or something.
I'm not really sure but maybe this topic would help.
http://lemmasoft.renai.us/forums/viewto ... f=8&t=9808
Sorry if it wont help at all.
Re: About returning to a certain point in the game (?)
I added "return" at the end of the label but it goes back to the main menu. I don't think that's what you're saying but I tried it anyway. ^^ So, I went to the link you sent me and most of the things there confused me. I can understand some parts of it somehow, but I think the code there is much advanced for me. I'm just new to python. Sorry ^^. I still don't know what exact code should I place there, but I really appreciated your help. Uhm, can you give me the code (from that link) you think is the solution? I'm sorry for asking too much. ^^ Thank you very much!SilverxBlue wrote:Oh! I get it now! Gosh I'm so slow...
I think what you need is some sort of "return" to game button or something.
I'm not really sure but maybe this topic would help.
http://lemmasoft.renai.us/forums/viewto ... f=8&t=9808
Sorry if it wont help at all.
Re: About returning to a certain point in the game (?)
um, I think in this case, you'd use call, instead of jump, so that when you add return, it goes back to the point when you clicked the one that triggers call. not sure though.
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/
http://roankun.wordpress.com/
-
- Veteran
- Posts: 348
- Joined: Fri Mar 13, 2009 5:26 pm
- Completed: Princess of Ruin, Frozen Essence, Heartstring Bugs
- Organization: Unbroken Hours
- Tumblr: unbrokenhours
- Deviantart: venus-eclipse
- Location: Canada
- Contact:
Re: About returning to a certain point in the game (?)
- Add
- Replace ui.jumps (jumping) with ccinc (calling.)
- Return will jump back to that part where you left off.
-Every time you call, you will use return will go back to that spot you left off. I hope I make sense.
-If you use return without a call, you will end the game... something like that.
The return in your stat screen will work.
This is a non-programmer's way of explaining things. =D
For your stat screen, add this.
This is the way I do it.
Code: Select all
ccinc = renpy.curried_call_in_new_context
- Return will jump back to that part where you left off.
-Every time you call, you will use return will go back to that spot you left off. I hope I make sense.
-If you use return without a call, you will end the game... something like that.
Code: Select all
#stats overlay
def display_stat():
if show_display_stat:
ccinc = renpy.curried_call_in_new_context
ui.frame()
ui.vbox(xpos=0.03, ypos=0.03)
ui.text("Day %s" %day)
ui.text("%s" %dayname)
ui.text("Money: $ %s" %money)
ui.text("HP: %s" %hp)
ui.textbutton("Statistics", clicked=ccinc("statistics2"))
ui.close()
config.overlay_functions.append(display_stat)
This is a non-programmer's way of explaining things. =D
For your stat screen, add this.
Code: Select all
$ ui.textbutton("Go Back", clicked=ui.jumps("goback"))
label goback:
return
Princess of Ruin is officially out! (Current version is v1.5)
New in Development: Shrouded in Haze
Free:: Frozen Essence, Legend of the Piper Girl, Heartstring Bugs
Re: About returning to a certain point in the game (?)
Oh, thank you very much! It worked. Thanks everyone who helped me!VenusEclipse wrote:- Add- Replace ui.jumps (jumping) with ccinc (calling.)Code: Select all
ccinc = renpy.curried_call_in_new_context
- Return will jump back to that part where you left off.
-Every time you call, you will use return will go back to that spot you left off. I hope I make sense.
-If you use return without a call, you will end the game... something like that.The return in your stat screen will work.Code: Select all
#stats overlay def display_stat(): if show_display_stat: ccinc = renpy.curried_call_in_new_context ui.frame() ui.vbox(xpos=0.03, ypos=0.03) ui.text("Day %s" %day) ui.text("%s" %dayname) ui.text("Money: $ %s" %money) ui.text("HP: %s" %hp) ui.textbutton("Statistics", clicked=ccinc("statistics2")) ui.close() config.overlay_functions.append(display_stat)
This is a non-programmer's way of explaining things. =D
For your stat screen, add this.
This is the way I do it.Code: Select all
$ ui.textbutton("Go Back", clicked=ui.jumps("goback")) label goback: return
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot]