Mathematical functions (Solved)
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.
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.
- JQuartz
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Mathematical functions (Solved)
Hello.
I was wondering if Renpy supported any mathematical functions other than the +-=<>)(. Can anyone point me to the right direction.
Thanks in advance.
I was wondering if Renpy supported any mathematical functions other than the +-=<>)(. Can anyone point me to the right direction.
Thanks in advance.
Last edited by JQuartz on Mon Nov 19, 2007 9:29 pm, edited 1 time in total.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
Re: Mathematical functions
I might be confusing with another language but there's some "^" or "Pow()" for X at the power of Y. Square root should be possible then (Power of 1/2 as someone here pointed out once ^^)... or am I mixing things up >.>..?...
The best is to say what you're looking for.
The best is to say what you're looking for.
- 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: Mathematical functions
Actually, in python, power is **. For example, 2 ** 8 = 64.
A list of numeric operators is at: http://docs.python.org/lib/typesnumeric.html and http://docs.python.org/lib/bitstring-ops.html .
You can also import the python math module, using code like:
This gives you a bunch of mathematical operations. For example:
The math module documentation is here:
http://docs.python.org/lib/module-math.html
A list of numeric operators is at: http://docs.python.org/lib/typesnumeric.html and http://docs.python.org/lib/bitstring-ops.html .
You can also import the python math module, using code like:
Code: Select all
init:
$ import math
Code: Select all
$ a = math.sin(b)
http://docs.python.org/lib/module-math.html
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
Re: Mathematical functions
I *always* mix it up XD...Actually, in python, power is **
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
Re: Mathematical functions
Well, a lot of other modern languages use Math.Pow() or some variant, so you have a good excuse.monele wrote:I *always* mix it up XD...Actually, in python, power is **
- JQuartz
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Re: Mathematical functions
Thanks Pytom and Monele. The links was very helpful.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
Who is online
Users browsing this forum: Bing [Bot], _ticlock_


