Dr.Jack
That's Cap'n to you!
- Reaction score
- 109
Well this was supposed to be a data to timer attachment system. However after testing (Thanks Artificial for testing!!) it appears as this system's speed is no match to TU,KT2,T32 (damn J4L you are good ) etc.... I think however that the concept behind has never been tried before so I thought about sharing it, perhaps a better Jasser could use this. Presenting Manipulated Periods (after some massive cleaning) to anyone remotely interested. Anyway while working on this I learned a bit of small reals, can't be a bad thing.
Basically this attaches data to a timer by using periods. It take's the timer period and slightly increase it by converting the data to a real small real and adding it. Than when retrieving data it uses the period.
Edit: Untested, removed strings from the attach function.. Don't know why I didn't do it this way in the first place.
Now if there was anyway to remove string use from the LocalGetData func...
Basically this attaches data to a timer by using periods. It take's the timer period and slightly increase it by converting the data to a real small real and adding it. Than when retrieving data it uses the period.
JASS:
function SetPeriod takes real p, integer i returns real
if i < 10 then
return p + S2R("0.0000000" + I2S(i)) + 0.00000001
elseif i < 100 then
return p + S2R("0.000000" + I2S(i)) + 0.00000001
elseif i < 1000 then
return p + S2R("0.00000" + I2S(i)) + 0.00000001
else
return p + S2R("0.0000" + I2S(i)) + 0.00000001
endif
return 0.
endfunction
function LocalGetData takes real p returns integer
local integer i = R2I(p * 100000000)
local string s = I2S(i)
set i = StringLength(s)
set s = SubString(s,i-4,i)
return S2I(s)
endfunction
Edit: Untested, removed strings from the attach function.. Don't know why I didn't do it this way in the first place.
Now if there was anyway to remove string use from the LocalGetData func...