HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Convert Real to Integer ?

11-15-2003, 12:03 AM#1
FerretDruid
How could I do that with this code?

local texttag DamageText = CreateTextTagLocBJ( R2S(GetEventDamage()), GetUnitLoc(GetTriggerUnit()), 0, 8, 100.00, 100, 100.00, 0 )

I know almost nothing about JASS, I cnp'ed that from Element_5's war2 conversion demo. I had a non-JASS version of this working decently and I can convert real to integer easily with normal non JASS triggers, but even converting them to custom text didn't show me enough of a difference to figure out what numbers to change. Everything I've tried does nothing :(
11-15-2003, 08:14 AM#2
KaTTaNa
Well, you convert real to integer like this:

R2I( real to convert )

The code you gave us creates the floating text (texttag) which displays the damage dealt.
11-28-2003, 05:00 AM#3
Aristotle
I don't think you can convert real to integer, it's best to do everything in real if that's the case.
11-28-2003, 08:20 AM#4
KaTTaNa
You can so convert real to integer, it just rounds down to the nearest lower integer.
Note that R2I(2.99) will return 2 and not 3 like you might expect.