Need help getting a timer to work

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Need help getting a timer to work

#1 Post by Mushroomstamp »

I'm trying to get a timer to work as referenced here;
http://www.solarstrike.net/phpBB3/viewt ... r&start=20
But character never runs backward.

Code: Select all

<!-- #  1 --><waypoint x="2226" z="2489" y="401">	
	targetObj = player:findNearestNameOrId("Okander \"Mad Man\" Mallen")
	player:target(targetObj)
	player:update()	
	player:cast("WARRIOR_SURPRISE_ATTACK")
	_t = os.time()
</waypoint>

Code: Select all

<onSkillCast>
	if _t ~= nil then
		leaptime = os.difftime(os.time(), _t)
		if ( leaptime > 24000 and 28000 > leaptime ) then
			keyboardHold( settings.hotkeys.MOVE_BACKWARD.key )
			yrest(4000)
			keyboardPress(key.VK_SPACE)
			yrest(500)
			keyboardRelease( settings.hotkeys.MOVE_BACKWARD.key )
		else
			print(_t)
		end
	end
</onSkillCast>
Shouldn't the value from print(_t) change during the fight?
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Need help getting a timer to work

#2 Post by rock5 »

No, _t is the start time so it doesn't change. What should have been printed was the "leaptime". If you did you would have seen that the printed value was in seconds, not miliseconds, and yes I'm aware that I wrote it like that. I'm not infalible. :D

Try,

Code: Select all

      if ( leaptime > 24 and 28 > leaptime ) then
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Post Reply