Showing Math equations in choices and dialog (exponents)?

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
roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Showing Math equations in choices and dialog (exponents)?

#1 Post by roankun » Tue Nov 08, 2011 9:20 am

So my teacher found out I could create games, and asked me to make a short game for her math class. Is there any way I could show all those x^2+y^2 on choices and dialog without the "^" and have them properly "raised"? I also kinda have a problem with the x/y things...

If worse comes to worst and there isn't, then I'll probably just make images of those but... >.< Deadline: tomorrow!
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Showing Math equations in choices and dialog (exponents)

#2 Post by Aleema » Tue Nov 08, 2011 9:28 am

I don't think there is a sub/superscript tag for text. But I do believe there are ALT codes that generate the numbers like that (1-3). But your font would have to support it, I think.

As for your slash problem, if you double them up (//) then it should show.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Showing Math equations in choices and dialog (exponents)

#3 Post by PyTom » Tue Nov 08, 2011 9:38 am

The superscripts are available as characters you. As long as you're using the default (DejaVuSans) font, you should be able to just copy them from this post into your game.

awesomebola(x) = x⁹ + x⁸ + x⁷ + x⁶ + x⁵ + x⁴ + x³ + x² + x¹ + x⁰

Graphs on Wolfram Alpha
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Re: Showing Math equations in choices and dialog (exponents)

#4 Post by roankun » Tue Nov 08, 2011 12:00 pm

Thanks for the help on the exponents!
Aleema wrote:As for your slash problem, if you double them up (//) then it should show.
Is there any way that... instead of a slash, it will be displayed as that big underline thing like in fractions?

like... uhhh... It should appear like this.
x+y
x-y
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: Showing Math equations in choices and dialog (exponents)

#5 Post by netravelr » Tue Nov 08, 2011 12:10 pm

You could put it like:

Code: Select all

say "{u}x+y{/u} \n x-y"
{u} puts the text in underlines and \n means a newline (so pressing enter basically)
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Showing Math equations in choices and dialog (exponents)

#6 Post by PyTom » Tue Nov 08, 2011 5:13 pm

I'll note that Ren'Py really wasn't meant for math rendering, which is a tricky field. If you want really good math rendering use TeX or something to make an image. (But I don't know an easy way to do that.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
roankun
Regular
Posts: 94
Joined: Fri Jun 11, 2010 4:01 am
Projects: RHS
Contact:

Re: Showing Math equations in choices and dialog (exponents)

#7 Post by roankun » Sun Nov 13, 2011 12:34 pm

Thanks for the all help! I managed to manage, somehow. :D
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/

Post Reply

Who is online

Users browsing this forum: Google [Bot]