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.
I'm sorry, but an uncaught exception occurred.
File "game/screens/my_screens.rpy", line 449, in keywords
textbutton _("Bad E") action [NullAction(), hovered [Show("tooltip", tooltip=skill_tooltip, my_tt_ypos=693)], unhovered [Hide("tooltip")], SensitiveIf(rank_b==True and not rank_d)]
File "<screen language>", line 449, in <module>
NameError: name 'hovered' is not defined
Last edited by UselessCoder on Thu Jul 28, 2016 12:01 pm, edited 1 time in total.
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/screens.rpy", line 177, in execute
screen main_menu():
File "game/screens.rpy", line 177, in execute
screen main_menu():
File "game/screens.rpy", line 187, in execute
frame:
File "game/screens.rpy", line 192, in execute
has vbox
File "game/screens.rpy", line 199, in execute
textbutton _("Bad E") action NullAction() hovered Show("navigation") unhovered [Hide("tooltip"), SensitiveIf(rank_b==True and not rank_d)]
File "game/screens.rpy", line 199, in keywords
textbutton _("Bad E") action NullAction() hovered Show("navigation") unhovered [Hide("tooltip"), SensitiveIf(rank_b==True and not rank_d)]
NameError: name 'rank_b' is not defined
I did some syntax editing and messed with Show to get it into some manner of progress. Unfortunately my random piecing of coding knowledge ends here.
*I didn't look at sensitiveif in the renpy documentation, but removing it compiles the statement.
Anyhow, I don't have the same things as you defined, so this is my best final answer at the moment.
textbutton _("Bad E"):
action NullAction()
hovered [Show("tooltip", tooltip=skill_tooltip, my_tt_ypos=693)]
unhovered [Hide("tooltip")], SensitiveIf(rank_b==True and not rank_d)]
thanks andrew, but that didn't work either...there was an extra "]" at the end of your code, anyway...however, the error I get now is "SensitiveIf" is not a valid textbutton argument.
But like I said, thanks for trying
The [ ] are only needed to make lists of actions.
In your former examples, there are errors because there are brakets not closed or not opened or closed twice.
xavimat wrote:The [ ] are only needed to make lists of actions.
In your former examples, there are errors because there are brakets not closed or not opened or closed twice.
Yes xavimat, thanks...I've found out myself by making mistakes over mistakes. The thing is I was considering "hovered" and "unhovered" as "stand-alone" actions, while they are to be considered as parts of an action...Thanks for taking your time to answer this, tho.
UselessCoder wrote:The thing is I was considering "hovered" and "unhovered" as "stand-alone" actions, while they are to be considered as parts of an action...Thanks for taking your time to answer this, tho.
No, no. You were right.
"action" is triggered when the button (or textbutton/imagebutton/hotspot) is clicked (or touched in a touch screen, etc.)
"hovered" is triggered when the button gains focus (hovered with the mouse, touched in a touch-screen...).
"unhovered" is triggered when the button loses focus.
"alternate" is triggered whith the "alternate click" (secondary button of the mouse, long touch in touch-screen...)
All four are independent and can have one action or a list of actions (using [ ] ).
Ok, so...I'm totally clueless about how on earth that last attempt worked. lol
Seriously, especially in regard of "action[SensitiveIf"...I mean, how can a button sensitive/non-sensitive status be considered an "action"? (but still...somehow it worked.. )
Well, you are right again.
I said that the four "triggers" are independent, but with an exception: if action is None (or not defined), then the others (hovered, unhovered and alternate) can't work, because the button is insensitive. This is the reason why the empty NullAction() exists (to have a button that does nothing on click but is able to trigger the others).
In your example you have used SensitiveIf that is originally intended to work in a list with other actions https://www.renpy.org/doc/html/screen_a ... ensitiveIf , you don't have other actions in that list but there are other actions in other "triggers", and SensitiveIf does its work.
xavimat wrote:Well, you are right again.
I said that the four "triggers" are independent, but with an exception: if action is None (or not defined), then the others (hovered, unhovered and alternate) can't work, because the button is insensitive. This is the reason why the empty NullAction() exists (to have a button that does nothing on click but is able to trigger the others).
In your example you have used SensitiveIf that is originally intended to work in a list with other actions https://www.renpy.org/doc/html/screen_a ... ensitiveIf , you don't have other actions in that list but there are other actions in other "triggers", and SensitiveIf does its work.
Now this makes a lot of sense! Thanks for this explanation Xavi. tbh I've red the docs you've linked before opening the topic, but I didn't get much of it before you took your time to explain in depth. Docs can be helpful, but are probably written for those who know python syntax basics already...Definitely not my case.