Menu and button help for a beginner? (Party/mission select)
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.
Menu and button help for a beginner? (Party/mission select)
Hi, so I'm not completely inexperienced with coding, but between a few factors (namely having not touched python in an age) I'm running into a wall.
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...
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...
- Kia
- Eileen-Class Veteran
- Posts: 1040
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: Menu and button help for a beginner? (Party/mission sele
it took me lots of time to write and debug something similar and I guess you'll need to spend even more on it, so forget about searching for a shortcut.
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.
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.
Re: Menu and button help for a beginner? (Party/mission sele
Since I'm bored at work, this is a simple two member selection screen. It's limited to the character selecting part of your post, because I'm lazy. It's also not meant to be a finished product, just a pointer for where you will eventually want to be going. However, I do think (or hope) that the code should be enough of a hint for you to figure out most of the other stuff you want to do. Do keep in mind that you will need to account for things like save/load, rollback, incorporating images, blah blah.
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.
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[0].name action Show("select2", slot=0)
textbutton party[1].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."
Re: Menu and button help for a beginner? (Party/mission sele
@Philat
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
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
- Ocelot
- Lemma-Class Veteran
- Posts: 2402
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Menu and button help for a beginner? (Party/mission sele
Screen language is a kind of markup language in RenPy. Like HTML, it describes how things are looking, what will happen if you hover on things, click them, etc..
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).
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).
< < insert Rick Cook quote here > >
Re: Menu and button help for a beginner? (Party/mission sele
The class objects are barebones examples to show how you refer to an object in a list and is attributes in screen elements (textbutton party[0].name). The point of the example code is the screens, which show basic examples of showing and hiding screens, passing a variable between screens, and using a custom function as a screen action. Beyond that, you're gonna have to just look through the documentation.
The imagebutton tutorial should work fine as far as I know.
The imagebutton tutorial should work fine as far as I know.
- Donmai
- Eileen-Class Veteran
- Posts: 1960
- 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, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: Menu and button help for a beginner? (Party/mission sele
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.
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Menu and button help for a beginner? (Party/mission sele
If you want examples of what screens look like, make a new project and look at the code for your screens and GUI ren'py files.
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
*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
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot], Nozori_Games