Mathematical functions (Solved)

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
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)

#1 Post by JQuartz »

Hello.

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.

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Mathematical functions

#2 Post by monele »

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.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
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

#3 Post by PyTom »

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:

Code: Select all

init:
    $ import math
This gives you a bunch of mathematical operations. For example:

Code: Select all

$ a = math.sin(b)
The math module documentation is here:

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
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Mathematical functions

#4 Post by monele »

Actually, in python, power is **
I *always* mix it up XD...

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

#5 Post by Criptych »

monele wrote:
Actually, in python, power is **
I *always* mix it up XD...
Well, a lot of other modern languages use Math.Pow() or some variant, so you have a good excuse. :P
Computers are useless. They can only give you answers. —Pablo Picasso

Image

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

#6 Post by JQuartz »

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.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot