Text tags in a variable?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Joey
Regular
Posts: 123
Joined: Tue Aug 02, 2011 4:51 am
Projects: Water's Edge
Organization: Etoranze
Contact:

Text tags in a variable?

#1 Post by Joey »

People have been expressing their dislike for the fact that I use text tags like "{w=0.1}" after punctuation marks in the game I'm making so I've been trying to figure out a way to turn that on/off. (I personally like it though because it gives the illusion that the character is speaking... but it's a personal preference.)

So I was thinking that I could use a variable in place of punctuation marks and have the player set their preference for pausing on/off by themselves, like so:

Code: Select all

$ com = ','

    if pausing == True:
        $ com == ',{w=1.0}' #not using 1.0 of course i just wanted to see the result clearly
        
    y "Hi[com] how are you today?"       
    a "Fine[com] thank you!"
(probably not the most efficient way to go about it but ;;)

But when I tested it it seems like the text tag is ignored completely? On/off yields the same result, a comma but no pause. Any way I can get around this/is there a different method to do the same thing?
Last edited by Joey on Tue May 29, 2012 1:52 pm, edited 2 times in total.
Image
Image (devblog) || devtwitter | devtumblr

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Text tags in a variable?

#2 Post by Alex »

This works for me - check if "pausing" set to "True" in your script.
Pretty much the same way of doing this

Code: Select all

    $ x = 4
    "Text,{w=[x]} some more text."

Joey
Regular
Posts: 123
Joined: Tue Aug 02, 2011 4:51 am
Projects: Water's Edge
Organization: Etoranze
Contact:

Re: Text tags in a variable?

#3 Post by Joey »

Oh, never thought of doing it that way! Thanks so much!

EDIT: ACK! no! It doesn't work because {w=0.0} still causes a pause. I want to remove it (the {w=xx}) entirely ;-;
Image
Image (devblog) || devtwitter | devtumblr

Another
Regular
Posts: 82
Joined: Sun Apr 18, 2010 8:57 am
Contact:

Re: Text tags in a variable?

#4 Post by Another »

Joey wrote:EDIT: ACK! no! It doesn't work because {w=0.0} still causes a pause.
It should work though. I noticed a minor typo in your first post that may cause this, if it's still present in your current code:

Code: Select all

$ com == ',{w=1.0}' # only one equals sign is needed here
Here's an example I've tested. In your preferences screen, add somewhere:

Code: Select all

frame:
    style_group "pref"
    has vbox

    label "Pausing"
    textbutton "Yes" action SetField(persistent, "com", 1.0)
    textbutton "No" action SetField(persistent, "com", 0.0)
Then, your script will look like this:

Code: Select all

init:
    $ if persistent.com!=0.0: persistent.com=1.0

label start:
    y "Hi,{w=[persistent.com]} how are you today?"
    a "Fine,{w=[persistent.com]} thank you!"

Joey
Regular
Posts: 123
Joined: Tue Aug 02, 2011 4:51 am
Projects: Water's Edge
Organization: Etoranze
Contact:

Re: Text tags in a variable?

#5 Post by Joey »

Whoops yes it does work, I was working on a netbook and the graphics were cocking up. Thanks so much!
Image
Image (devblog) || devtwitter | devtumblr

Post Reply

Who is online

Users browsing this forum: tim640