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 Fri May 24, 2013 9:02 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  [ 7 posts ] 
Author Message
PostPosted: Sat Mar 31, 2012 8:43 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1160
Location: United States
Projects: Coming Out On Top
I've seen two examples of defining characters in Renpy.

Why would you want to use one over the other? And why the use of 'quotes' versus "quotation marks"?

Any advice appreciated, thank you!

Code:
define e = Character('Eileen', color="#c8ffc8")


vs.

Code:
define e = Character("Eileen", who_color="#c8ffc8")

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


Top
 Profile Send private message  
 
PostPosted: Sat Mar 31, 2012 10:12 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10778
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
There isn't any functional difference here.

The color property is an alias to who_color, which is the color of the name of the character that is speaking. So there's no difference there.

Python allows a string to be introduced with single or double quotes, as long as you're consistent. That lets you avoid escaping in some circumstances, since you can just use the other string type:

Code:
define gkar = Character("G'Kar")
define vir = Character('Vir "Abrahamo Lincolni" Cotto')


[code]

_________________
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 Mar 31, 2012 10:47 pm 
Regular

Joined: Sun Jul 26, 2009 7:07 pm
Posts: 69
Location: Fredericton, NB, Canada
When you've defined a character, how do you retrieve its color information?

I've tried
Code:
$a = Character("Anne",color="#faa")
a "Hello, I am {color=[a.color]}Anne{/color}."


But Renpy says "AttributeError: 'ADVCharacter' obejct has no attribute 'color'"

_________________
Flash To Ren'Py Exporter
See the Cookbook thread


Top
 Profile Send private message  
 
PostPosted: Sat Mar 31, 2012 10:53 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10778
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
You don't. You'd have to store it yourself if you want to get it back again. The internals of Character, with some minor exceptions, are opaque - so I can change them in the future.

_________________
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: Sun Apr 01, 2012 12:02 am 
Regular

Joined: Sun Jul 26, 2009 7:07 pm
Posts: 69
Location: Fredericton, NB, Canada
OK. I've made some wrapper functions for my character stable, so it's not a problem.

_________________
Flash To Ren'Py Exporter
See the Cookbook thread


Top
 Profile Send private message  
 
PostPosted: Sun Apr 01, 2012 1:18 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10778
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
That's the right way to do it, as it means that your code doesn't depend on Ren'Py internals. (And at the same time, I don't have to expose a huger public API.)

_________________
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: Sun Apr 01, 2012 7:39 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Mar 09, 2012 6:58 pm
Posts: 1160
Location: United States
Projects: Coming Out On Top
Thank you, PyTom! That helped clear things up.

_________________
Coming Out On Top - An Adult B/B Game
Wordpress Tumblr Twitter FB


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

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: saruri


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