HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I2R (if it actually exists) How does it work?

07-23-2006, 01:07 AM#1
darkwulfv
How do I use I2R (integer to real)? I want to make an integer into a real (obviously), the integer being the level of an ability x 2, and the real being damage and an amount of time. So basically, I want to make the amount the integer comes out to be into a real so that it is usable in damage amounts and times. Any help received, thanks ahead of time! Also, someone may need to make the JASS for me, as I don't know if that's an extra function or whatever, I'm very new to JASS that isn't straight from GUI and slighty changed... Again, thanks ahead of time.
07-23-2006, 01:31 AM#2
PipeDream
the JASS compiler automatically generates code to convert integers to reals when necessary. This is faster than using I2R(someinteger) manually. Just be careful about integer arithmetic (7/5 = 1).
07-23-2006, 02:04 AM#3
darkwulfv
huh? I...Don't...Get it... sry... So uhhh what should I do? If I made a local integer I = levelofability whatever x 2 (this isn't jass, just what I want), then use I in a real (like dealing damage) it will convert it into a real for me? I was having this issue when using GUI, so I thought i'd go to JASS... Guess it's all fixed for me... But what do you mean by integer arithmatic? Is that just the integer rounding? Becuase what I'm using should be a flat number. The only reason I need it to be a real is becuase stupid ass GUI doesn't accept it, go figure. So I guess I'm all fixed!
07-23-2006, 04:39 AM#4
FatalError
For example:
Collapse JASS:
local integer i = whatever
local real r = i * 2.
No need for I2R, it does it automatically.