Page 1 of 1

Help with looping an action ever x seconds

Posted: Fri Dec 24, 2010 1:14 am
by slick2175
After a few hours of failing at this figured id come here and maybe get some insight..

I could careless if its done with an ingame macro or if its somehting that starts when the bot loads..

What im looking for is for every 5 seconds for the bot to target pet, assist pet, and attack

What I had in game with macro was

/run TargetUnit("pet")

/run AssistUnit("pet")

/run UseAction(1) -- Reg Attack

/wait 1

/script if UnitHealth("player") > 0 then UseAction(7); end; -- I figured id run a if statement to check if my hp is greater then 0 to keep using action 7 which is where the macro is set on the actionbar.

I just cant get it to loop. If i manually press it, it works but it wont loop. Any help be much appreicated

Re: Help with looping an action ever x seconds

Posted: Fri Dec 24, 2010 1:32 am
by Administrator
Use a waypoint script.

Code: Select all

<onLoad>
function myTimedEvent()
   -- do stuff here.
   RoMScript("TargetUnit('pet')");
  RoMScript("AssistUnit('pet')");
  RomScript("UseAction(1)");
end

registerTimer("whatever_you_want", secondsToTimer(5), myTimedEvent);

while(true) do
  yrest(1);
end
</onLoad>

Re: Help with looping an action ever x seconds

Posted: Fri Dec 24, 2010 2:00 am
by slick2175
FIXED didnt realize its case sensitive.

Re: Help with looping an action ever x seconds

Posted: Fri Dec 24, 2010 2:29 am
by slick2175
Hrm well i guess it did for what I asked.. Lol but not what i wanted.

Now its just in a constant loop of assisting the pet and not going to waypoints, Just wanted it to check to see if my pet was still fighting anything every 5-10 seconds and assist it instead of moving on to the next waypoint of monster.

I tried to have it only run at each waypoint but I got an error of nil, im assuming its because the pet had no target and the bot shuts down.

Re: Help with looping an action ever x seconds

Posted: Fri Dec 24, 2010 3:14 am
by Administrator
Then just remove the while loop.