Is there a way to have a button cover an area of the screen in-game?
I want the red button to cause the game to quit, but I don't know how to make it happen.
Is there a way to completely disable right-clicking?
Seems straightforward enough, but I can't seem to figure it out.
Is there a way to disable rollback?
Once again, I can't figure it out.
Is there a way to disable the "Are you sure you want to quit?" message?
It bugs me in every game I make.
In-game buttons and disabling of certain features...(SOLVED)
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.
In-game buttons and disabling of certain features...(SOLVED)
Last edited by brofisto on Thu Nov 18, 2010 10:10 am, edited 2 times in total.
Re: In-game buttons and disabling of certain features...
To quit, call renpy.quit() as a python function, or jump to the label _quit. These methods also bypass the confirm-quit prompt.
If you want to instead send the player back to the main menu, call renpy.full_restart() as a python function. Again, this disables the associated prompt.
To disable rollback, $ config.rollback_enabled = False.
The effect of right-clicking (and also ESC) is disabled by $_game_menu_screen = None. (This is how it appears in the documentation; it may be inaccurate in that it might need a space after the $.)
To remove the game menu's confirm-quit prompt, modify the Quit button (this, I'm not sure of how, but I know it's in the docs) to jump to _quit instead of calling _quit_prompt.
(This is not suggested, even if it annoys you as a maker. Having a user accidentally quit before they have a chance to save is even more of an annoyance to them.)
All of this is in the documentation and FAQ (Except maybe the _quit label). Please, in the future, read the docs and make cursory explorations before asking easy questions. That's what it's there for.
If you want to instead send the player back to the main menu, call renpy.full_restart() as a python function. Again, this disables the associated prompt.
To disable rollback, $ config.rollback_enabled = False.
The effect of right-clicking (and also ESC) is disabled by $_game_menu_screen = None. (This is how it appears in the documentation; it may be inaccurate in that it might need a space after the $.)
To remove the game menu's confirm-quit prompt, modify the Quit button (this, I'm not sure of how, but I know it's in the docs) to jump to _quit instead of calling _quit_prompt.
(This is not suggested, even if it annoys you as a maker. Having a user accidentally quit before they have a chance to save is even more of an annoyance to them.)
All of this is in the documentation and FAQ (Except maybe the _quit label). Please, in the future, read the docs and make cursory explorations before asking easy questions. That's what it's there for.
-
- Veteran
- Posts: 322
- Joined: Sun Oct 03, 2010 11:49 pm
- Completed: Memoirs of an Angel (2010)
- Projects: Memoirs of an Angel (Remake); W.I.S.H
- Location: United States
- Contact:
Re: In-game buttons and disabling of certain features...
Creating an on-screen button can be found in the Cookbook (Button Game Menu).
Just replace "textbutton" with "imagebutton". You can format it like...
The above assumes that you'll want the button to appear at certain times and disappear at others, so you can toggle it using
$ show_whatever_button = True/False
Or you can actually add a button a little easier with the new screen language.
In the above example, you would need to make six images:
button_idle, button_hover, button_insensitive, button_selected_idle, button_selected_hover, button_selected_insensitive
Both methods do the same thing - show a button on the screen. However, if you plan for the button to go to a pre-defined Ren'py label (such as jump to the main menu, a game menu, or the confirm quit screen), then you'll want to use the first method so that the button disappears when you go to that screen.
Just replace "textbutton" with "imagebutton". You can format it like...
Code: Select all
show_whatever_button = False
def whatever_button():
if show_whatever_button:
ui.hbox(xpos = 100, xalign=0, ypos = 100, yalign=0)
ui.imagebutton("idle.png", "hover.png", clicked=renpy.curried_call_in_new_context("label_to_jump_to"))
ui.close()
config.overlay_functions.append(whatever_button)
$ show_whatever_button = True/False
Or you can actually add a button a little easier with the new screen language.
Code: Select all
screen whatever:
hbox xalign 0 yalign 0:
imagebutton auto "button_%s.png" action Jump('label_to_jump_to') pos (100,100)
## Here's an example of how to toggle the button to show or disappear.
label start:
show screen whatever
"Now you see it..."
hide screen whatever
"...And now you don't."
button_idle, button_hover, button_insensitive, button_selected_idle, button_selected_hover, button_selected_insensitive
Both methods do the same thing - show a button on the screen. However, if you plan for the button to go to a pre-defined Ren'py label (such as jump to the main menu, a game menu, or the confirm quit screen), then you'll want to use the first method so that the button disappears when you go to that screen.
Re: In-game buttons and disabling of certain features...
Thanks for your help, everything working fine now.
Sorry, I should have read the documentation more carefully, but I appreciate all your help.
Sorry, I should have read the documentation more carefully, but I appreciate all your help.
Who is online
Users browsing this forum: Bing [Bot], Princesky