Using {p1} as shorthand for {w=0.5}?

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
User avatar
Zodai
Newbie
Posts: 15
Joined: Sat Feb 04, 2012 1:53 am
Contact:

Using {p1} as shorthand for {w=0.5}?

#1 Post by Zodai »

As {w=0.5}, and additionally {w=0.25} are honestly quite tedious to write multiple times over in the making of a game - as a result, I have been trying to code in {p1} as shorthand equal to {w=0.5}, and {p2} as shorthand to {w=0.25}, but I have been unable to find anything on this subject.

Could I get some help?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Using {p1} as shorthand for {w=0.5}?

#2 Post by PyTom »

There isn't an easy way to add your own text tags that function. (As opposed to updating style information.)

What you can do is define a variable:

Code: Select all

define p1 = "{w=0.5}"
and substitute it in:

Code: Select all

"This is a [p1]short pause."
Which should give a similar effect, and be easier to type. (But you do have to remember to use the square brackets.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: Using {p1} as shorthand for {w=0.5}?

#3 Post by Elmiwisa »

EDIT: Opps, did not notice PyTom's 2nd part. :oops:

You can however, use a variable to store text tag. Something like:

Code: Select all

$p1="{w=0.5}"
mc "I [p1] think [p1] I [p1] am [p1] stu[p1]tter[p1]ing"
Note that the bracket is the square one []. This is because it's a variable substitution.
Last edited by Elmiwisa on Wed Oct 23, 2013 5:24 pm, edited 1 time in total.

User avatar
Zodai
Newbie
Posts: 15
Joined: Sat Feb 04, 2012 1:53 am
Contact:

Re: Using {p1} as shorthand for {w=0.5}?

#4 Post by Zodai »

PyTom wrote:There isn't an easy way to add your own text tags that function. (As opposed to updating style information.)

What you can do is define a variable:

Code: Select all

define p1 = "{w=0.5}"
and substitute it in:

Code: Select all

"This is a [p1]short pause."
Which should give a similar effect, and be easier to type. (But you do have to remember to use the square brackets.)
Ah; that should help. Thanks!

There's one more release-related bug I seem to be encountering in the Alpha builds; but I'll see you in another thread for that :3

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]