Page 1 of 1
Buttons for submenu [Solved]
Posted: Tue May 07, 2019 5:03 am
by senisanti
Hi Friends
I want to create buttons that redirect me to "submenu"
I have already created a little button that allows players to "leave the game"
and i want the submenu button to be in the same style
I'll put a small example of what i did because i dont know if i explain myself correctly and my inglish isnt very good
screen buttonoff:
vbox xalign 0.99 yalign 0.02:
spacing 20
imagebutton auto "ICON/buttonoff_%s.png":
action Call("bye")
label bye:
$ renpy.quit(False,0)
label start:
show screen buttonoff
above what i did for what i call the button "leave the game"
and below what i'm trying to do to offer the player a "submenu"
screen buttonchar:
vbox xalign 0.99 yalign 0.20:
spacing 20
imagebutton auto "ICON/buttonchar":
action Call("CHAR/jimena.png")
label start:
show screen buttonchar
what comes after action is for me unknown, i find all this on a tutorial but i dont understand what come after action and options that i may have.
I wish that the player can click the button at any time in the game and return to where he was in the game when he closes this menu.
I dont know how to finish this block and get what i want
I searched a lot and tried a lot of solution compared to what i already know but i dont succeed
in the tutorial renpy or youtube that i find i dont find the method i need and i dont really know where looking for again
if someone here knows the solution and can explain it to me i would be very grateful
sorry for my bad english and thanks in advance
Re: Buttons for submenu
Posted: Tue May 07, 2019 5:20 am
by Matalla
You don't call an image, like you do. What the code needs (and you want, if I understand you correctly) is to call a screen. You'll need to make that screen where you'll eventually put that image (and whatever content you want) and call it with the button.
Re: Buttons for submenu
Posted: Tue May 07, 2019 7:09 am
by senisanti
I still dont understand!
I dont know how to put in screen or image.
If i do,
Action Call ("screen characters")
it doesnt work, i dont know how i should proceed
and if i tried a lot of different possibility i do it randomly because i dont know why it should not be like i did
if i find or if you show me the solution i'll not know how to go back to the moment of the story when "player" has to click on the button characters
please, i know it's certainly very simple todo but i'm lost, obviously i'm going to say, "Ah goodness it's so easy" when i'm going to have the solution, but I'm starting all that and much things very often escape me
Re: Buttons for submenu
Posted: Tue May 07, 2019 9:07 am
by nature1996
This is the reference for what you can put after the keyword action (not exclusive, but contains a lot):
https://www.renpy.org/doc/html/screen_actions.html
You probably want to use that function instead:
https://www.renpy.org/doc/html/statemen ... renpy.show
to do so, you will have to pass by an intermidiary Function:
Code: Select all
action Function(renpy.show,"CHAR/jimena.png")
It should work. If you want to use transform, just add them in a list after the picture name:
Code: Select all
action Function(renpy.show,"CHAR/jimena.png", [right])
Also, in general, you might want to define picture you use often like so:
https://www.renpy.org/doc/html/displaya ... ml?#images
Code: Select all
# this is outside of any label, generally before the start label:
image Jimena = "CHAR/jimena.png"
It will be easier to use in general that way too.
Re: Buttons for submenu
Posted: Tue May 07, 2019 11:22 am
by senisanti
I dont understand, i studied the links you gave me, i did what you told me with Function.
the command i was looking for is, "hide"
I added the hide for close, i add the image of jimena and i put the line with function, but i receives an error code, i dont understand
I put the code below if someone succeeds in helping me, thank you!
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 80, in script
"Welcome to the small town of santirosa!"
File "renpy/common/000window.rpy", line 98, in _window_auto_callback
_window_show()
File "renpy/common/000window.rpy", line 60, in _window_show
renpy.with_statement(trans)
File "game/script.rpy", line 39, in execute
screen buttonchar:
File "game/script.rpy", line 39, in execute
screen buttonchar:
File "game/script.rpy", line 40, in execute
vbox xalign 0.02 yalign 0.20:
File "game/script.rpy", line 42, in execute
imagebutton auto "ICON/buttonchar":
File "renpy/common/00defaults.rpy", line 139, in _imagemap_auto_function
rv = auto_param % variant
TypeError: not all arguments converted during string formatting
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 80, in script
"Welcome to the small town of santirosa!"
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\ast.py", line 657, in execute
statement_name("say")
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\ast.py", line 45, in statement_name
i(name)
File "renpy/common/000window.rpy", line 98, in _window_auto_callback
_window_show()
File "renpy/common/000window.rpy", line 60, in _window_show
renpy.with_statement(trans)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\exports.py", line 1578, in with_statement
return renpy.game.interface.do_with(trans, paired, clear=clear)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 2240, in do_with
clear=clear)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 2690, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 3074, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 534, in visit_all
d.visit_all(callback, seen)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 534, in visit_all
d.visit_all(callback, seen)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 534, in visit_all
d.visit_all(callback, seen)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 534, in visit_all
d.visit_all(callback, seen)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\screen.py", line 424, in visit_all
callback(self)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\core.py", line 3074, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\screen.py", line 434, in per_interact
self.update()
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\display\screen.py", line 619, in update
self.screen.function(**self.scope)
File "game/script.rpy", line 39, in execute
screen buttonchar:
File "game/script.rpy", line 39, in execute
screen buttonchar:
File "game/script.rpy", line 40, in execute
vbox xalign 0.02 yalign 0.20:
File "game/script.rpy", line 42, in execute
imagebutton auto "ICON/buttonchar":
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\ui.py", line 937, in _imagebutton
idle = choice(idle, idle_image, "idle", required=True)
File "C:\Users\paho2\OneDrive\Bureau\renpy-7.2.2-sdk\renpy\ui.py", line 925, in choice
rv = renpy.config.imagemap_auto_function(auto, name)
File "renpy/common/00defaults.rpy", line 139, in _imagemap_auto_function
rv = auto_param % variant
TypeError: not all arguments converted during string formatting
Windows-8-6.2.9200
Ren'Py 7.2.2.491
Santirosa 1.0
Tue May 07 17:11:16 2019
Re: Buttons for submenu
Posted: Tue May 07, 2019 11:28 am
by nature1996
I would need your screen code to be able to understand all that, if not the whole code. Also, I speak french so if you want to continue that discussion in french, pm me.
Re: Buttons for submenu
Posted: Tue May 07, 2019 2:52 pm
by senisanti
thank you so much nature1996 and Matalla too
i've found my problem
the first; CHAR, i put my img in the folder CHAR in the folder image and that dont work
i've finaly put all my image in the folder image without subfolder and now that work perfectly with all methode, show , function, call... he works all, this bad subfolder!!!
merci beaucoup nature1996, comme je le dit très mal ci-dessus j'ai fini par reussir a regler mon problème... cela dit je reviendrais certainement par ici pour avoir des astuces et de l'aide, je commence a peine avec renpy et python et je fait conneries sur conneries
problem solved
Sorry!, i'm new in this forum, i dont know where is solved option
Re: Buttons for submenu
Posted: Tue May 07, 2019 3:10 pm
by nature1996
You eddit your first post and add [solved] to the subject