Timers

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

noober
a lesser mummy
a lesser mummy
Posts: 71
Joined: Mon Mar 08, 2004 4:09 pm

Timers

Post by noober » Sun Jun 27, 2004 2:27 pm

Finally I found the way to use timers, thanks for the help.
Here is the working code.

Code: Select all

Sub Main
  
   /declare ThornsTimer timer Outer 0
   /Varset ThornsTimer 5s

   /declare SkinTimer timer outer 0
   /Varset SkinTimer 10s

   /declare SvDisTimer timer outer 0
   /Varset SvDisTimer 15s

   /echo Start Time = ${Time}
   :WaitForIt
        /doevents
        /delay 1s        
        /echo ${Time} 
|-----------------------------------------
| Put code here
|-----------------------------------------
        /goto :WaitForIt 
        } 
/return
/end

|Sub Event_Timer
|       /echo Casting Thorns
|       /Varset ThornsTimer 3m
|/return

Sub Event_Timer(tmrName)
   /if (${tmrName.Equal["ThornsTimer"]}) { 
      /Echo Casting Thorns 
      /Varset ThornsTimer 5s
   } 
   /if (${tmrName.Equal["SkinTimer"]}) { 
      /Echo Casting Skin 
      /Varset SkinTimer 10s
   } 
   /if (${tmrName.Equal["SvDisTimer"]}) { 
      /Echo Casting Resist Disease 
      /Varset SvDisTimer 15s
   } 
/return
Last edited by noober on Mon Jun 28, 2004 5:32 am, edited 9 times in total.

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sun Jun 27, 2004 2:31 pm

You need to declare the timer inside your main not outside. An there are some others errors.

Code: Select all

Sub Main
   /declare MyTimer timer outer 0
   /varset MyTimer 3m | setting timer for 3 min trigger
   :loop
   /doevents
   /delay 10
   /goto :loop
/endmacro

Sub Event_Timer
   /cast 1  | Cast Gem #1 
/return

User avatar
ieatacid
Developer
Developer
Posts: 2727
Joined: Wed Sep 03, 2003 7:44 pm

Post by ieatacid » Sun Jun 27, 2004 2:33 pm

Also, remove the comment after /varset MyTimer 3m. It's not setting the duration correctly with that there.

noober
a lesser mummy
a lesser mummy
Posts: 71
Joined: Mon Mar 08, 2004 4:09 pm

Post by noober » Sun Jun 27, 2004 2:35 pm

the sub should be:

Sub Event_Timer

or

Sub Event_Mytimer?

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sun Jun 27, 2004 2:50 pm

Event for ALL timers is

Code: Select all

Sub Event_Timer

noober
a lesser mummy
a lesser mummy
Posts: 71
Joined: Mon Mar 08, 2004 4:09 pm

Post by noober » Sun Jun 27, 2004 2:52 pm

How would you be able to tell appart 2 different timers if there is only one Sub that responds to all timers?

Falco72
a hill giant
a hill giant
Posts: 215
Joined: Fri Sep 26, 2003 3:24 am

Post by Falco72 » Sun Jun 27, 2004 2:57 pm

Code: Select all

Sub Event_Timer(tmrName)
   /if (${tmrName.Equal["MyTimer"]}) {
      /cast 1
   }
/return

noober
a lesser mummy
a lesser mummy
Posts: 71
Joined: Mon Mar 08, 2004 4:09 pm

Post by noober » Sun Jun 27, 2004 3:19 pm

Thank you for your help.