Stuck in Tooltips Part 2: Stuck in wrong context [Unsolved]
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.
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Stuck in Tooltips Part 2: Stuck in wrong context [Unsolved]
Hello forums,
For months spanning miscellaneous WIPs I've been able to figure things out through lurking or faking my way through obstacles with whatever works but now it looks like I'm going to have to come out and ask questions. I'm using the Tooltip code from here http://lemmasoft.renai.us/forums/viewto ... 420#p58420 to get tooltips for some imagebuttons and I use a 'call' to bring up those buttons up, but there doesn't seem to be a clean way of advancing away from those buttons. After clicking one of the buttons which calls a label with a jump to the next part of the game in it, the game will continue to advance and the menu can even be brought up again to advance even further into the game, but after the first use of those buttons rollback stops working and any attempts to save the game from that point on bring me back to the moment before calling the menu for the very first time. What should I attach to those buttons so that I can move on without being haunted by them?
I started this in 6.10.2 and would prefer not to upgrade for this project as it would mean a lot of janitor work un-breaking the deprecated.
If anybody is curious or wants to suggest something completely different, the ultimate aim here is to be able to bring up (and cancel/dismiss if desired) a menu with hover messages for each button. The buttons are for making correct choices which advance the game (and the player is stuck in a loop until they bring up the menu and choose correctly).
For months spanning miscellaneous WIPs I've been able to figure things out through lurking or faking my way through obstacles with whatever works but now it looks like I'm going to have to come out and ask questions. I'm using the Tooltip code from here http://lemmasoft.renai.us/forums/viewto ... 420#p58420 to get tooltips for some imagebuttons and I use a 'call' to bring up those buttons up, but there doesn't seem to be a clean way of advancing away from those buttons. After clicking one of the buttons which calls a label with a jump to the next part of the game in it, the game will continue to advance and the menu can even be brought up again to advance even further into the game, but after the first use of those buttons rollback stops working and any attempts to save the game from that point on bring me back to the moment before calling the menu for the very first time. What should I attach to those buttons so that I can move on without being haunted by them?
I started this in 6.10.2 and would prefer not to upgrade for this project as it would mean a lot of janitor work un-breaking the deprecated.
If anybody is curious or wants to suggest something completely different, the ultimate aim here is to be able to bring up (and cancel/dismiss if desired) a menu with hover messages for each button. The buttons are for making correct choices which advance the game (and the player is stuck in a loop until they bring up the menu and choose correctly).
Last edited by EightHeadedDragon on Mon Aug 01, 2011 3:46 am, edited 3 times in total.
Re: Stuck in Tooltips
Hm, the code example would be helpfull. And what do you mean "I use a 'call' to bring up those buttons up"? Maybe it would be better to make an overlay function, that shows buttons (like http://www.renpy.org/wiki/renpy/doc/coo ... _Game_Menu), instead of call a label?
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
Code: Select all
label tooltipstart:
show crecords
python:
ccinc = renpy.curried_call_in_new_context
ui.hbox(xpos=0.120, ypos=0.155, xanchor='left', yanchor='center', spacing=34)
tt = Tooltip(0, 500, "tooltip desc snipped")
ui.imagebutton(im.Grayscale("ev-autopsy.png"), "ev-autopsy.png", clicked=ccinc("present_autopsy"), hovered=tt.show, unhovered=tt.hide)
tt = Tooltip(0, 500, "tooltip desc snipped")
ui.imagebutton(im.Grayscale("joustlance.png"), "joustlance.png", clicked=ccinc("present_jlance"), hovered=tt.show, unhovered=tt.hide)
tt = Tooltip(0, 460, "tooltip snipped")
ui.imagebutton(im.Grayscale("flarphb.png"), "flarphb.png", clicked=ccinc("present_flarphb"), hovered=tt.show, unhovered=tt.hide)
tt = Tooltip(0, 500, "tooltip snipped")
ui.imagebutton(im.Grayscale("daglance.png"), "daglance.png", clicked=ccinc("present_daglance"), hovered=tt.show, unhovered=tt.hide)
ui.close()
ui.hbox(xpos=0.120, ypos=0.420, xanchor='left', yanchor='center', spacing=34)
tt = Tooltip(0, 500, "tooltip snipped")
ui.imagebutton(im.Grayscale("evbloodstains.png"), "evbloodstains.png", clicked=ccinc("present_oblood"), hovered=tt.show, unhovered=tt.hide)
ui.close()
ui.vbox(xpos=0.820, ypos=0.610, xanchor='left', yanchor='center', spacing=34)
ui.textbutton("Cancel", clicked=ui.returns(False), xminimum=80)
ui.close()
ui.interact()
hide crecords
return
Code: Select all
label Present:
$ in_object = False
call tooltipstart
$ in_object = True
returnYeah my Cancel button was more or less completely neglected for not knowing the proper way to implement it, but at some points in the game it actually works as intended and at some points in the game (that it probably won't be used in anyway) it ends the game. Go figure, I've been making things happen by tossing in whatever works.
Re: Stuck in Tooltips
Well... I'm not a programmer, but will try to explain (someone please correct me if I'll make mistake).
About call smth in new context and return back.
Imagin, that you read a book and found unknown word. Then you put your book away, google some about this word and find its meaning. After that you return back to reading.
In Ren'py, all starts in main menu context.
____When you push "start" button, it jumps out of this context to game context.
________Also, you can call some code in new context.
____________... and from this context you can call smth in new context...
____________And after that, you should return
________to previouse context, and if neccesary, return
____to previouse context.
____But if you'll try to return from game context,
it will bring you back to main menu context.
So, your "cancel"button works fine. When "label Present" executed, it calls "tooltipstart" in new context. If you click "Cancel", interaction is made, so Ren'py hides "crecords" and returns to the next line of "label Present". Here it sets "in_object" to True and trying to return from game context. As result, you see main menu. (if you add some lines of text before this <return>, you'll be able to see them).
But if you click one of the buttons in "tooltipstart", it will call a label in new context. And if you just "jump" (not "return") from that label to "label Present", you still in that context, and "Cancel" button will return you to game context, and only after that, you can click it again to return to main menu.
Phew... hope you understand what I mean...))
My suggestions are:
1. change <renpy.curried_call_in_new_context> to <ui.jumps>
2. At the end of labels "present_autopsy", "present_jlance", "present_daglance", "present_oblood" use <return> command, to return from "tooltipstart" context to "label Present" context.
About call smth in new context and return back.
Imagin, that you read a book and found unknown word. Then you put your book away, google some about this word and find its meaning. After that you return back to reading.
In Ren'py, all starts in main menu context.
____When you push "start" button, it jumps out of this context to game context.
________Also, you can call some code in new context.
____________... and from this context you can call smth in new context...
____________And after that, you should return
________to previouse context, and if neccesary, return
____to previouse context.
____But if you'll try to return from game context,
it will bring you back to main menu context.
So, your "cancel"button works fine. When "label Present" executed, it calls "tooltipstart" in new context. If you click "Cancel", interaction is made, so Ren'py hides "crecords" and returns to the next line of "label Present". Here it sets "in_object" to True and trying to return from game context. As result, you see main menu. (if you add some lines of text before this <return>, you'll be able to see them).
But if you click one of the buttons in "tooltipstart", it will call a label in new context. And if you just "jump" (not "return") from that label to "label Present", you still in that context, and "Cancel" button will return you to game context, and only after that, you can click it again to return to main menu.
Phew... hope you understand what I mean...))
My suggestions are:
1. change <renpy.curried_call_in_new_context> to <ui.jumps>
Code: Select all
ccinc = ui.jumps-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
It did not work. Adding returns there would only take me back to that menu rather than advancing the game, and using ui.jump causes the game to restart if the button tries to return to the menu.
ui.jumpsoutofcontext seems to do what I want, but if the button doesn't (isn't supposed to) advance the game with that function attached that ends the game too. But at least I'm getting closer to where I want to be.
ui.jumpsoutofcontext seems to do what I want, but if the button doesn't (isn't supposed to) advance the game with that function attached that ends the game too. But at least I'm getting closer to where I want to be.
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
Also, I suppose I should clarify. Each button is linked to a label that will check what flags are set, and then determine if the button should cause a jump or return the player where he left off. Directly giving a button ui.jumpsoutofcontext does exactly what I want it to do, but the problem is it shouldn't be making that jump unless the conditions are appropriate. Yet, I'll get errors if I try to use ui.jumpsoutofcontext and yet renpy.jump_out_of_context or renpy.jump do not exit properly; I'm guess guessing because the next label is another context to deal with.
An example of what each button is linked to, with the basic jump being what I was using before I first started this topic:
Would it make sense (or even be possible) for the buttons themselves to have arguments on how to react when clicked?
An example of what each button is linked to, with the basic jump being what I was using before I first started this topic:
Code: Select all
label present_flarphb:
hide crecords # (it's just some imagery)
if wstatement == "AT4":
call presentwin
$ renpy.jump_out_of_context("crtd1a")
# jump crtd1a
else:
call presentfail
return
Re: Stuck in Tooltips
That's because you use <ccinc = renpy.curried_call_in_new_context> - return kicks you back to "label tooltipstart".Adding returns there would only take me back to that menu rather than advancing the game
Hm... if you <call> "label tooltipstart", then <return> should work properly. But if you have smth like thisusing ui.jump causes the game to restart if the button tries to return to the menu
Code: Select all
label start:
#blah blah
label tooltipstart:
#code-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
Okay since it has stopped me dead in my tracks I created bare bones copies of the scripts that duplicate the problem in case seeing it first hand would help.
- Attachments
-
- game.rar
- (1.82 KiB) Downloaded 27 times
Re: Stuck in Tooltips
Sorry, I'm unable to solve it...(
Looks like it's impossible to save or rollback if you call a label from overlay function.
Looks like it's impossible to save or rollback if you call a label from overlay function.
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
Well, thank you for taking the time to help me anyway, Alex.
Next I suppose I will try setting up lots and lots of labels so I can use ui.jumpsoutofcontext to break free of the menu, fortunately that option is somewhat possible, if a little tedious.
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Stuck in Tooltips
I'll note that 6.12.1 will have a new way of doing tooltips, which may be easier. Check out the dev docs here:
http://www.renpy.org/dev-doc/html/scree ... ml#Tooltip
http://www.renpy.org/dev-doc/html/scree ... ml#Tooltip
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips
Hello again forum, so after a sending the ol' project to someone and getting feedback on the bugs, I decided to experiment with 6.12.1 a little and the tooltips looks pretty nice. However it looks like the problem I was having before still continues on so I'll take another stab at it in case something new has since made it possible. Rather than hitting it from the angle of toppling the bug though, maybe this time I'll approach it from "how can this be done."I'll note that 6.12.1 will have a new way of doing tooltips, which may be easier. Check out the dev docs here:
http://www.renpy.org/dev-doc/html/scree ... ml#Tooltip
So in my story, sections of the game loop indefinitely. The only way to progress forward is to pull up a menu (currently done with buttons that show up when the menu may be used) and to push the correct button. In other words, my game requires multiple "islands" of infinitely looping scenarios that are bridged by use of a menu.
The problem is that after using the menu, rollback and saving cease working as the game remains stuck back at the context that the menu was first used at. I thought I had resolved the problem by making the correct button a ui.jumpsoutofcontext while the wrong buttons were callsinnewcontext, but that only worked for me because I happened to know exactly what the right choices were. For someone I showed the game to, somehow a couple of wrong choices would disrupt my fix in inconsistent ways.
I have a bit of an audience anticipating this game, so if someone could please show me how to use a callable menu to move between these looping isles without getting trapped in an inner context, I would be very grateful! There has to be a way.
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Stuck in Tooltips Part 2: Stuck in wrong context
I don't get why you would call (or worse, call in a new context) menus here. Why not jump to the menu?
Code: Select all
screen my_menu_screen:
vbox:
textbutton "A" action Jump("a")
textbutton "B" action Jump("b")
textbutton "C" action Jump("done")
label my_menu:
call screen my_menu_screen
label a:
"You chose poorly."
jump my_menu
label b:
"You chose poorly, again."
jump my_menu
label done:
"..."
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
EightHeadedDragon
- Newbie
- Posts: 20
- Joined: Fri Jul 02, 2010 4:44 am
- Completed: Alternian Turnabout
- Contact:
Re: Stuck in Tooltips Part 2: Stuck in wrong context
Pardon the late response, my computer had a bit of a disaster. That almost works, but would anyone know how to get the menu to return to the spot it was used from with the failed results, and the screen language way to close the menu? My early attempts at conversion are causing a lot of abrupt returns to the title screen.
Also, a little less related to that central problem, could someone a bit more polished translate this from newbie into actual code, assuming it is possible?
Another quick stab at making my buttons more sophisticated, yeah.
Also, a little less related to that central problem, could someone a bit more polished translate this from newbie into actual code, assuming it is possible?
Code: Select all
textbutton "Present" action
(If(in_object=True,Jump('Present'),Jump('None'))Who is online
Users browsing this forum: No registered users