So I'm working on my first ren'py game. I have no Python experience, but I do have Java experience. I want to change parts of the UI at runtime...and I'm having some trouble with something (well many things).
So here is the set up.
I have made a screen that has some frame and vboxes and a textbutton in them. I want to be able to add dialogue menus to the frames and enable and disable the button during runtime.
I mock up of my renpy code looks like this (a bit simplified):
File: controlscreen.rpy
Code: Select all
screen control:
frame:
id "cframe"
xalign 1.0
xpos 1.0
yalign 0.0
ypos 0.0
has vbox:
id "cfvbox"
style_group "inner"
frame:
id "div1frame"
add "top small"
frame:
id "uppercframe"
ymaximum 160
add "clock2" xanchor 0.5 yanchor 0.5
add "clock" xanchor 0.5 yanchor 0.5
add "clock1" xanchor 0.5 yanchor 0.5
frame:
id "div2frame"
add "top small"
frame:
id "midcframe"
yminimum 0.5
label _("Control Panel")
frame:
id "lowercframe"
has vbox
textbutton "Interrupt" action [SetVariable ("interrupts", interrupts +1), Return("smth")]
text "No of interrupts: [interrupts]"
add "bottom small"
Code: Select all
a "I'm going to give a long speech and you can't interrupt me now"
[color=#4000FF]disable interrupt button[/color]
a "blah blah blah blah"
b "I'm going to give a long speech and you can totally interrupt me anytime"
[color=#4000FF]enable interrupt button[/color]
b "blah blah blah blah"
a "so, you've hear both our proposals, which one person do side with?"
menu: [color=#4000FF]-- showing up in the midcframe[/color]
"I choose you Alphie!":
$ alphie_love += 1
"I choose you Bebe!":
$ bebe_love += 1
Something like (the grammar will be off, but you'll hopefully understand what I mean.):
*during initialization
controlS = new Screen();
dialogueF = new Frame ();
interruptB = new TextButton("Interrupt");
then during the code part I'd just do this:
Code: Select all
a "I'm going to give a long speech and you can't interrupt me now"
[color=#4000FF]interruptB.setEnabled(false);[/color]
a "blah blah blah blah"
b "I'm going to give a long speech and you can totally interrupt me anytime"
[color=#4000FF]interruptB.setEnabled(false);[/color]
b "blah blah blah blah"
a "so, you've hear both our proposals, which one person do side with?"
dialogueF.addMenu(
"I choose you Alphie!":
$ alphie_love += 1
"I choose you Bebe!":
$ bebe_love += 1);
Also, where exactly is the menu object defined? I assume that somewhere in there it says to show up on the overlay layer of the game screen(?)...but I want to tell it to show up in the dialogueF instead...how do I talk to it when it doesn't seem to have a name?
So...I know what I want to do...I know how I'd do it in Java, but I don't know how it works in Ren'py/Python. Help?
(For those who say: just write the thing in Java...creating an entire VN engine in java with all the wonderful functionality of Ren'py seems like it would be a real pain, and why reinvent the wheel when something completely awesome is already here!)
Looking in the ren'py folder, it looks like the version of Python we are using is 2.7...so if I want to look up Python tutorials and documentation I should be looking at 2.7 stuff, yes? Also, what is the relationship between Pygame an Ren'py?
Note: while this question is about this specific conundrum that I alluded to in my last post, this one is really about instances of objects in general...how does object oriented programming work in ren'py? How do I know what methods and fields text or imagebuttons or labels etc have?
Thank for any replies! I'm tying to work this out!