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.
Currently in the middle of trying(and failing) basic menu building for a game and I'm beating my head trying to understand calling screens, utilizing buttons etc. I'm trying to go through the wiki and get some lernin' done as the documentation is leaving me confused. I tried looking through the cookbooks and whenever I found promising bits, such as the image button tutorial, it was either not working out for me or it had a caution about being dated.
I just need some good advice on how to start the suckers and then using them to pass appropriate variables.
For staffing, the idea is this:
Four Slot Choice Grid. Player clicks portrait areas over each ‘background’. This activates the right side panel, which has the list of characters. Clicking the character’s portrait chooses them, and places their portrait in the original frame. Resetting is done by clicking the portrait again and selecting someone else. The player cannot progress until all four slots are full. (I was also fiddling with the idea of drag & drop) From there it would set various flags based on mission number, who was selected, etc.
For mission select, we're aiming at just having two boxes with image and then mouseover shows data on the right side panel.
I'm totally lost on how to actually utilize and call screens and going through the Tutorial code for the dayplanner, the ui class is used but is depreciated.
The idea is they'll be called say around 10 times through the game, but with big conditional shifts.
The other thing I'm not cure how it works is the Tutorial uses separate script files that it jumps to based on buttons, and based on where we're planning to go for structure that seems better than one fat script file.
I'm not interested in making anything have flashy bits or anything yet, I just want to have a path forward on making these suckers function, and then scan for conditionals and set some flags.
i really want to utilize renpy as half my favorite VNs were put together with this and now for someone that's done a decent bit of coding and has been building simple stuff in gamemaker for a few weeks (but not the things I aim to make), I am getting frustrated at my inability to understand simple menu-making...
- Miko-Class Veteran
- Posts: 912
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Skype: KiaAzad
first thing first, you need to learn everything about screens https://www.renpy.org/doc/html/screens.html specially buttons.
then you need to list your characters in lists, if your characters have stats you need to include that information as well. then all you need is few "for" loops and "if" statements to bring them to the screen and probably some python functions to calculate the stats.
if it's your first project, I suggest to tackle something easier first, like customizing your GUI.
I just reread your post and you also want SensitiveIf for the done button in select1, but I'm too lazy to add it now. As Kia suggested above, you can also use for loops to avoid some tedious hard coding, but I didn't bother since I'm just providing two slots and characters. I'm not touching any of the stat stuff either.
As for your files, renpy treats all files as one big file. It makes no difference whether you have one script.rpy file with a bunch of labels or labels broken off into their own files.
Code: Select all
screen select1(): vbox: xalign 0.1 yalign 0.1 textbutton party.name action Show("select2", slot=0) textbutton party.name action Show("select2", slot=1) textbutton "Done" action Return() screen select2(slot=1): vbox: xalign 0.9 yalign 0.1 textbutton "Char 1" action [Function(setlistindex, party, slot, char1), Hide("select2")] textbutton "Char 2" action [Function(setlistindex, party, slot, char2), Hide("select2")] textbutton "None" action [Function(setlistindex, party, slot, charnone), Hide("select2")] init -2 python: class Char(): def __init__(self, name): self.name = name charnone = Char("None") def setlistindex(lst, index, char): lst[index] = char default party = [charnone, charnone] label start: python: char1 = Char("Char1") char2 = Char("Char2") call screen select1 $ printparty = [x.name for x in party] "Party: [printparty]" if char1 in party: "Char1 is in your party." else: "Char1 is not in your party."
See, that looks more like python code, more like what my brain thinks of regarding creating objects and instances.
I'm more mystified as far as how screens work and the like and utilizing the built-in methods because I'm having trouble finding examples.
There's no stats, the idea is you're the boss, and you just pick who is on the job for the particular scenario.
What I'm more lost on is how calling a screen works, and scanning buttons and the rest for states
Calling a screen is like calling a function, it means to show the screen and stop executing code until screen will return something (via Return action or some inherent property of some displayables, like input area reaction on Enter key).
The imagebutton tutorial should work fine as far as I know.
- Eileen-Class Veteran
- Posts: 1885
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
- Projects: Slumberland
- Location: Brazil
I've seen people reporting problems trying to use the Imagebutton Framework with latest Ren'Py. viewtopic.php?p=433180#p433180philat wrote:The imagebutton tutorial should work fine as far as I know.
TOIRE NO HANAKO (A Story About Fear)
- Lemma-Class Veteran
- Posts: 3710
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
*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?) http://lemmasoft.renai.us/forums/viewto ... 51&t=21978