Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Thu May 23, 2013 9:09 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jul 28, 2012 4:39 pm 
Newbie

Joined: Sat Jul 28, 2012 4:28 pm
Posts: 6
Hi everyone,

I'm currently trying to hash out an extremely simple HP system - basically just a variable which gets changed when certain choices are made. I want to be able to display this variable on screen, and I discovered ui.text, which pretty much does what I want it to do! There's just one problem -- it only lasts for one screen. I want it to be persistent and display at all times.

(I know that the DSE has a stat system in it, too, but I couldn't figure out how to make it so that you got a game over when you hit 0 in your stats. As a last resort I could always use it alongside a variable, but I feel like there's a simpler solution.)

Here's my code for the UI box, if that helps.

Code:
    $ HP = 100
    $ ui.frame()
    $ ui.hbox()
   
    $ ui.text("HP: %d" % (HP))
   
    $ ui.close()


Top
 Profile Send private message  
 
PostPosted: Sat Jul 28, 2012 8:45 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10776
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
Use a screen.

Code:
screen hp_screen:
    frame:
         text "HP: [HP]"


Then show it at the start of the game:

Code:
label start:
    $ HP = 9
    show screen hp_screen

    # ...

_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt


Top
 Profile Send private message  
 
PostPosted: Sat Jul 28, 2012 9:09 pm 
Newbie

Joined: Sat Jul 28, 2012 4:28 pm
Posts: 6
That answers my question perfectly. Thank you!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group