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 Tue May 21, 2013 12:01 am

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  [ 8 posts ] 
Author Message
PostPosted: Wed Feb 29, 2012 2:10 am 
Regular
User avatar

Joined: Sat Jun 12, 2010 11:27 am
Posts: 71
Projects: Rogue Of Heart, Awakened With A Crimson Kiss
okay, so I have a few questions about a screen I'm putting together as a python function. basically it just displays the health and the name above a character. I'm pretty sure I got the original code from the rpg frame from the renpy cookbook, in fact.

the whole code of my screen goes like this:

Code:
def EnemyFrame(character, **properties):
        ui.frame(xfill=False, yminimum=None, **properties)
       
        ui.vbox()
        ui.text([character[1]], size=20)
        ui.hbox()
        ui.text("HP", size=20)
        ui.null(width=5)
        ui.vbox()
        ui.hbox()
        ui.text([character[4]], size=10)
        ui.text(" / ", size=10)
        ui.text([character[3]], size=10)
        ui.close()
        ui.bar(character[3], character[4],
                xmaximum=100,
                left_bar=Frame("art/battlesprites/effects/hpslider_full.png", 12, 0),
                right_bar=Frame("art/battlesprites/effects/slider_empty.png", 12, 0),
                thumb=None,
                thumb_shadow=None)
        ui.close()
        ui.close()
        ui.close()


for starters, is it possible to change the colour of the frame? I want some to be one colour, and others another, but I'm not sure if it's possible to set frames to different colours. and if it is possible, can you also do it in regular screen language? some frames are a little gross to look at because of colour clashing, so it'd be great to be able to change the colours of the frame on the fly.

for secondsies, renpy doesn't seem to like me displaying numbers in ui.text? character[1] is "Bro", and that displays fine. character[3] and character[4] are both 500 atm, no quotes, because I need to edit them in the battle. but when I run it, it says "Exception: Cannot display 500 as text.", so I'm clearly doing something wrong here. putting ""s around the variable names just gives me an "KeyError: 'character'" error, so I don't think that's it either. idk. does anyone have any ideas?

and thirdly and finally, I'm having a bit of trouble with the bar itself. I included a screenshot of the problem, but basically the thing is that although the bar should be full (both character[3] and [4] are the same value), it's not displaying as totally full. it doesn't help that I don't really understand the bar code, so can anyone help me with that? even just understanding what the magic numbers are standing in for would be super great.


Attachments:
screenshot.png
screenshot.png [ 251.38 KiB | Viewed 369 times ]

_________________
VNs In Progress:
» Awakened With a Crimson Kiss «
» Rogue of Heart «
Top
 Profile Send private message  
 
PostPosted: Wed Feb 29, 2012 7:05 am 
Crawling Chaos
User avatar

Joined: Mon Feb 13, 2012 5:37 am
Posts: 1110
Location: Kimashi Tower, Japan
Completed: SMAR,AAA
Projects: DMC
vociferocity wrote:
for starters, is it possible to change the colour of the frame? I want some to be one colour, and others another, but I'm not sure if it's possible to set frames to different colours. and if it is possible, can you also do it in regular screen language? some frames are a little gross to look at because of colour clashing, so it'd be great to be able to change the colours of the frame on the fly.


Sorry, I don't know how to duplicate and change ren'py's default frames. But if you have images to use frame backgrounds yourself, it's not difficult to do it with the screen language.

Quote:
for secondsies, renpy doesn't seem to like me displaying numbers in ui.text? character[1] is "Bro", and that displays fine. character[3] and character[4] are both 500 atm, no quotes, because I need to edit them in the battle. but when I run it, it says "Exception: Cannot display 500 as text.", so I'm clearly doing something wrong here. putting ""s around the variable names just gives me an "KeyError: 'character'" error, so I don't think that's it either. idk. does anyone have any ideas?


I don't know.. didn't ui.text("[character[3]]") work?

Quote:
]and thirdly and finally, I'm having a bit of trouble with the bar itself. I included a screenshot of the problem, but basically the thing is that although the bar should be full (both character[3] and [4] are the same value), it's not displaying as totally full. it doesn't help that I don't really understand the bar code, so can anyone help me with that? even just understanding what the magic numbers are standing in for would be super great.


I think it's a bug. One solution is adding blanks on the each side of the bar images. For example, if your bar images are width 200, then open them with Gimp and change the canvas size to 210. The transparency area of the both sides will kill that glitches.

_________________


Top
 Profile Send private message  
 
PostPosted: Wed Feb 29, 2012 7:15 am 
Regular
User avatar

Joined: Sat Jun 12, 2010 11:27 am
Posts: 71
Projects: Rogue Of Heart, Awakened With A Crimson Kiss
ui.text("[character[3]]") is what brings up the "keyerror: character" error, so nope :( maybe I'll just skip that part haha. thanks for the tips about the bar and the frame, I'll give them a shot in the morning :)

_________________
VNs In Progress:
» Awakened With a Crimson Kiss «
» Rogue of Heart «


Top
 Profile Send private message  
 
PostPosted: Tue Mar 06, 2012 5:47 am 
Regular
User avatar

Joined: Sat Jun 12, 2010 11:27 am
Posts: 71
Projects: Rogue Of Heart, Awakened With A Crimson Kiss
doubleposting, sorry!

changing the size of the bar eventually worked for me, so thanks for that fix :D! I still don't seem to be able to display the health stat of the character, though?

this gives me a "can't display 300 as text" error:
Code:
ui.text([character[3]])


and this gives me a "keyerror: 'character'" error:
Code:
ui.text("[character[3]]")


does anyone have any ideas?

_________________
VNs In Progress:
» Awakened With a Crimson Kiss «
» Rogue of Heart «


Top
 Profile Send private message  
 
PostPosted: Tue Mar 06, 2012 1:35 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10773
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
You probably want something like:

Code:
ui.text("{0}".format(character[3]))

_________________
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: Tue Mar 06, 2012 6:10 pm 
Regular
User avatar

Joined: Sat Jun 12, 2010 11:27 am
Posts: 71
Projects: Rogue Of Heart, Awakened With A Crimson Kiss
awesome, thanks! I'll try that out asap :)

_________________
VNs In Progress:
» Awakened With a Crimson Kiss «
» Rogue of Heart «


Top
 Profile Send private message  
 
PostPosted: Tue Mar 06, 2012 11:49 pm 
Crawling Chaos
User avatar

Joined: Mon Feb 13, 2012 5:37 am
Posts: 1110
Location: Kimashi Tower, Japan
Completed: SMAR,AAA
Projects: DMC
If you interested, there is a RPG frame I made with the new screen language. You can see the code at here

_________________


Top
 Profile Send private message  
 
PostPosted: Wed Mar 07, 2012 2:27 am 
Regular
User avatar

Joined: Sat Jun 12, 2010 11:27 am
Posts: 71
Projects: Rogue Of Heart, Awakened With A Crimson Kiss
ah, it's fine, that was the last thing I needed to fix for my rpg-style battle minigame for my game :) but thanks! I'll definitely check yours out to see how you tackled things like hp bars and stuff

_________________
VNs In Progress:
» Awakened With a Crimson Kiss «
» Rogue of Heart «


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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