Save-Point
Call Script RealNumbers - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Call Script RealNumbers (/thread-182.html)



Call Script RealNumbers - ark - 05-31-2010

Hi!

I've got another problem with my stuff, please hlep me, I'd appreciate it very very much!

My problem is...

I would like to calculate a number between 1 and 3 and I'm tinkering with the call script command...
I'm calculating these numbers according to the players screen_y coordinate...

I made up this rough code to do the calculating...
y =1+(sx-300)/100
where sy is the screen_y coordinate which I check as a game variable. I put the 300 for a reason, please ignore that...
If I'm in sy=350 it should give me y=1.5.

There is no problem with this calculating the problem I have is that in the call script command I don't know how to make a variable in realnumber format.

It just gives naturalnumber format..

So instead of getting numbers like: 1.42 or 2.31, I either get a 1 or a 2.

Can you help me with this?

Here is the full call script I use after chacking the screen_y and making it to game_varibale 2:

Code:
sy = $game_variables[2]

y =1+(sx-300)/100

print y



Call Script RealNumbers - Trickster - 05-31-2010

y = 1 + (sx-300.0)/100


Call Script RealNumbers - ark - 05-31-2010

Thank you. You're awesome!