PDA

View Full Version : Is there a check to see if you're in cast roundtime?



Tgo01
03-02-2014, 04:07 PM
Is there a check option to see if you're in roundtime/cast roundtime without actually waiting for the roundtime to be over?

Like for example could I do:

echo "Hello!" if castrt?

So it would echo hello if I currently have a castrt but it wouldn't wait for the castrt to be over then echo hello.

BigWorm
03-02-2014, 04:32 PM
From lich.rb:



def waitcastrt?
rt = XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f + "0.6".to_f
if rt > 0
sleep rt
end
end


which is pretty gross, probably because of "reasons", but I'm ok with cargo culting it if it works:



def castrt?
(XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f + "0.6".to_f) > 0
end


which worked when I did some quick testing.

This (and probably something like roundtime?) seems like a good API method for lich to expose IMO.

Tillmen
03-02-2014, 07:14 PM
echo "Hello!" if checkcastrt > 0
also checkrt

Tgo01
03-02-2014, 07:26 PM
Thank ya very much, Tillmen :D