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.
-
sashaaero
- Regular
- Posts: 45
- Joined: Mon Jul 13, 2015 6:08 pm
- Projects: Everlasting Cold
- Organization: OverDream Development
- Github: sashaaero
- Skype: sashaaero
-
Contact:
#1
Post
by sashaaero » Thu Aug 27, 2015 2:29 pm
I have following code block
Code: Select all
python:
load = 1
def set_load(l):
load = l
def get_load():
return load
for i in range(10):
button:
action FileAction(i)
#action set_load(i)
With 'FileAction(i)' button are working. If i set my own function there - buttons not even clicking or hovering.
What's wrong here?
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#2
Post
by trooper6 » Thu Aug 27, 2015 2:55 pm
Are you coming from Java? You don't need set and get functions. You can just access the variable directly in Python.
In this case you'd want to use the SetVariable screen action for your button. It is noted here:
http://www.renpy.org/doc/html/screen_actions.html
I can't give you an example in code because I am in a cafe and don't have access to my computer.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
sashaaero
- Regular
- Posts: 45
- Joined: Mon Jul 13, 2015 6:08 pm
- Projects: Everlasting Cold
- Organization: OverDream Development
- Github: sashaaero
- Skype: sashaaero
-
Contact:
#3
Post
by sashaaero » Thu Aug 27, 2015 4:07 pm
trooper6 wrote:Are you coming from Java? You don't need set and get functions. You can just access the variable directly in Python.
In this case you'd want to use the SetVariable screen action for your button. It is noted here:
http://www.renpy.org/doc/html/screen_actions.html
I can't give you an example in code because I am in a cafe and don't have access to my computer.
That
Code: Select all
$ store.load = 1
for i in range(10):
button:
#action FileAction(i)
action SetVariable("load", i)
does nothing
Okay. Actually, maybe i'm doing it wrong.
I just want to have a list of saving, when you click on it, screenshot of saving is appearing in right side of screen and there is a button "Load".
-
synedraacus
- Regular
- Posts: 58
- Joined: Tue Jun 09, 2015 8:10 am
- Github: synedraacus
-
Contact:
#5
Post
by synedraacus » Thu Aug 27, 2015 11:02 pm
If you want it to just run your python function, use the Function() action:
Or, better yet, define the custom Action. You'll get checks for sensitive/insensitive state for your buttons.
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#7
Post
by trooper6 » Fri Aug 28, 2015 3:46 am
That is from the wiki and it is out of date (that page is 7 years old!), you should use the current documentation.
I can't help you much with load/save stuff as that is not anything I've experimented with yet...but I'd look in the screens.rpy file and really study what is there. Also look at the screen language documentation more generally.
Also, you might want to do a search here in the forum Question Board for save and image or save and screenshot or save and thumbnail because I know people have asked questions like that before.
For example, here are a few threads that might be useful for you to look over:
http://lemmasoft.renai.us/forums/viewto ... +thumbnail
http://lemmasoft.renai.us/forums/viewto ... 51&t=14237
http://fuckyeahrenpy.tumblr.com/post/91 ... eload-menu
Otherwise, you'll probably need one of the more advanced programmers to stop by this thread and help you out.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
SinnyROM
- Regular
- Posts: 166
- Joined: Mon Jul 08, 2013 12:25 am
- Projects: Blue Birth
- Organization: Cosmic Static Games
-
Contact:
#8
Post
by SinnyROM » Fri Aug 28, 2015 7:14 am
I agree with trooper6, avoid the wiki like the plague. There are more outdated articles than updated so you're better off looking at the current documentation or asking.
If you're looking for how to have a selectable save/load screen that displays the screenshot of the currently selected save, then I have this snippet from when I helped another person to achieve the same thing.
https://bitbucket.org/snippets/sinnysta ... matic-save This has the automatically generated file description function which is optional.
If it's the scrolling save list, then it's a case of wrapping the elements in a scrollable viewport:
http://www.renpy.org/doc/html/screens.html#viewport
I can help you with implementing it later on as I have to go to work now, but feel free to explain more on what you want to achieve.
-
DragoonHP
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
-
Contact:
#9
Post
by DragoonHP » Fri Aug 28, 2015 9:44 am
I don't have the source code of that layout but here is a screen version of it:
http://pastebin.com/qCbSwK8j
-
sashaaero
- Regular
- Posts: 45
- Joined: Mon Jul 13, 2015 6:08 pm
- Projects: Everlasting Cold
- Organization: OverDream Development
- Github: sashaaero
- Skype: sashaaero
-
Contact:
#10
Post
by sashaaero » Fri Aug 28, 2015 1:54 pm
This is it!
But last question, how can I set size for
?
Cause it's very small.
-
orz
- Regular
- Posts: 126
- Joined: Tue Apr 21, 2015 10:19 pm
-
Contact:
#11
Post
by orz » Fri Aug 28, 2015 7:30 pm
Make a fixed: or something like it that contains it.
Or you could try manipulating the displayable/image directly. Probably something with an image manipulator, if you go that route.
-
DragoonHP
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
-
Contact:
#12
Post
by DragoonHP » Fri Aug 28, 2015 11:43 pm
Change these values
Code: Select all
config.thumbnail_height = 180
config.thumbnail_width = 320
-
sashaaero
- Regular
- Posts: 45
- Joined: Mon Jul 13, 2015 6:08 pm
- Projects: Everlasting Cold
- Organization: OverDream Development
- Github: sashaaero
- Skype: sashaaero
-
Contact:
#13
Post
by sashaaero » Sat Aug 29, 2015 5:12 am
Thanks everyone for help! I did all I want

Users browsing this forum: Ocelot