About returning to a certain point in the game (?)

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.
Post Reply
Message
Author
Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

About returning to a certain point in the game (?)

#1 Post by Jelenie08 »

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!

Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

Re: About returning to a certain point in the game (?)

#2 Post by Jelenie08 »

I need help.

User avatar
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 (?)

#3 Post by SilverxBlue »

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?
Image Image
"A fool who doesn't think is more foolish than a fool who foolishly thinks." - Franziska Von Karma
Weeeeeee~
不愉快です !!!

Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

Re: About returning to a certain point in the game (?)

#4 Post by Jelenie08 »

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:

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)
After that are labels and stuff where:

Code: Select all

    $ show_display_stat = True
That's always set to True. Then, the label where the textbutton jumps to is here:

Code: Select all

label statistics2:
    $ show_display_stat = False
    stat "Day %(day)s \n%(dayname)s \nMoney: %(money)s \nHP: %(hp)s\n"
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. ^^

Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

Re: About returning to a certain point in the game (?)

#5 Post by Jelenie08 »

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:

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)
After that are labels and stuff where:

Code: Select all

    $ show_display_stat = True
That's always set to True. Then, the label where the textbutton jumps to is here:

Code: Select all

label statistics2:
    $ show_display_stat = False
    stat "Day %(day)s \n%(dayname)s \nMoney: %(money)s \nHP: %(hp)s\n"
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. ^^

User avatar
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 (?)

#6 Post by SilverxBlue »

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.
Image Image
"A fool who doesn't think is more foolish than a fool who foolishly thinks." - Franziska Von Karma
Weeeeeee~
不愉快です !!!

Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

Re: About returning to a certain point in the game (?)

#7 Post by Jelenie08 »

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.
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! :)

roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Re: About returning to a certain point in the game (?)

#8 Post by roankun »

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/

VenusEclipse
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 (?)

#9 Post by VenusEclipse »

- Add

Code: Select all

ccinc = renpy.curried_call_in_new_context
- 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.

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)

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.

Code: Select all

$ ui.textbutton("Go Back", clicked=ui.jumps("goback"))

label goback:
    return
This is the way I do it.

Jelenie08
Newbie
Posts: 15
Joined: Tue Apr 19, 2011 5:49 am
Contact:

Re: About returning to a certain point in the game (?)

#10 Post by Jelenie08 »

VenusEclipse wrote:- Add

Code: Select all

ccinc = renpy.curried_call_in_new_context
- 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.

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)

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.

Code: Select all

$ ui.textbutton("Go Back", clicked=ui.jumps("goback"))

label goback:
    return
This is the way I do it.
Oh, thank you very much! It worked. :) Thanks everyone who helped me!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot]