As I said in my first post, I am not a programmer at all, but Ren'Py and the community here are so user-friendly that I am on the brink of having the coding framework done for my modest game. I am stuck now, though, and would be most grateful for a little help. Apologies in advance for coding stupidity, as I am sure this is a super-easy problem to fix for even a beginning programmer.
I am trying to create a Stat screen overlay in the top-left corner that can be hidden. When it is hidden, a single image ("Show Stats") appears in the top left; clicking on it show the stat overlay once again.
I have had most parts of it working this morning: the overlay appears, images and bars and all, and is populated with the correct stats. But when I tried to create the "Hide Stats" and "Show Stats" funtionality, nothing at all appears now, as if the overlay isn't called to begin with.
Here is all of what I think is the relevant code:
Code: Select all
init:
$ maxpassion = 100
$ maxeloquence = 100
$ maxintelligence = 100
$ startpassion = 60
$ starteloquence = 5
$ startintelligence = 85
python:
def stats_visible():
#if not show_stats: <--I commented these out, thinking that the function was covered below. Didn't work when it was commented in, anyway
#return
if not show_stats:
ui.frame(xfill=False, yminimum=None, xalign=0.0, yalign=0.0)
ui.vbox()
ui.at(Position(xpos=10, ypos=10, xanchor='left', yanchor='top'))
ui.imagebutton("showstats.png", "showstats.png", clicked=ui.returns("showstats"))
ui.close()
result = ui.interact() # The "$" returned an error here, so I took it out. The code ran, but nothing appeared
if result == "showstats":
show_stats = True # The "$" returned an error here too, so I took it out. The code ran, but nothing appeared
return
return
if show_stats:
ui.frame(xfill=False, yminimum=None, xalign=0.0, yalign=0.0)
ui.vbox()
ui.at(Position(xpos=10, ypos=10, xanchor='left', yanchor='top'))
#ui.text("Passion", size=24)
ui.image("passionbutton.png")
ui.bar(range=maxpassion,value=startpassion,style="bar",xmaximum=150)
ui.at(Position(xpos=10, ypos=10, xanchor='left', yanchor='top'))
#ui.text("Eloquence", size=24)
ui.image("eloquencebutton.png")
ui.bar(range=maxeloquence,value=starteloquence,style="bar",xmaximum=150)
ui.at(Position(xpos=10, ypos=10, xanchor='left', yanchor='top'))
#ui.text("Intelligence", size=24)
ui.image("intelligencebutton.png")
ui.bar(range=maxintelligence,value=startintelligence,style="bar",xmaximum=150)
ui.imagebutton("hidestats.png", "hidestats.png", clicked=ui.returns("hidestats"))
ui.close ()
result = ui.interact()
if result == "hidestats":
show_stats = False
return
$ show_stats = False
#...
label start:
stop sound
scene black
pause (.5)
show feelinGroovy at Position(xpos = 0.5, xanchor=0.5, ypos=0.35, yanchor=0.5) with slowdissolve
$ renpy.pause(1)
hide feelinGroovy with slowdissolve
$ renpy.pause(1)
g "Hello, little light! Welcome to life!"
g "We have a lot of work to do, little light. But let's start at the beginning."
g "It's time for you to give yourself a name."
$ attemptanswer = ""
$ yname = renpy.input("What is your name?") or "Dulcimer"
y "Let it be so. Henceforth, I shall be known as %(yname)s."
scene library with slowdissolve
"Testing to see how the narrator's text looks."
g "You are trying to help Orlando. Here are his stats."
$ show_stats = True
"The stat bar should have appeared if the code is working correctly."
return