Need help with Events

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

RADCODE
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 05, 2002 6:34 pm

Need help with Events

Post by RADCODE » Sat Sep 28, 2002 10:04 am

I need little help to better understand how custom events work. Tell me if this is right and if there is a better/faster way to do this

edit:rizwank added brackets

Code: Select all

#Event Trivial "You can no longer advance your skill from making this item."
#Event Success "You have fashioned the items together to create something new!"
#event Failed  "You lacked the skills to fashion the items together."

Sub Main
 :mainloop
 /doevents
 /if "$v1"=="0" /echo Failed
 /if "$v1"=="1" /echo Success
 /if "$v2"=="1" /echo Trivial
 /goto :mainloop
/return

Sub Event_Trivial
 /if "$p0"=="You can no longer advance your skill from making this item." { 
  /varset v2 1
   } 
/return

Sub Event_Success
 /if "$p0"=="Your have fashioned the items together to create something new" { 
  /varset v1 1
   } 
/return

Sub Event_ Failed
 /if "$p0"=="Your lacked the skills to fashion the items together." { 
  /varset v1 0
   } 
/return
I am wondering, when you do /doevents which line(s) in the chat box it reads, is it just the last one or does it reads more then 1? If it reads more then 1 line my guess I would need to echo something to the screen to clear up previous message of the last attempt.

Another question is if you have filter skills all and it's spamming screen (and I do believe that I need to have that on to be able to use this event thing) Does it slow down the macro preformance?

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sat Sep 28, 2002 10:15 am

Well, yes there's a better way to do this...

Code: Select all

#Event Trivial "You can no longer advance your skill from making this item." 
#Event Success "You have fashioned the items together to create something new!" 
#event Failed "You lacked the skills to fashion the items together." 

Sub Main 
   :mainloop 
      /doevents 
      /if "$v1"=="0" /echo Failed 
      /if "$v1"=="1" /echo Success 
      /if "$v2"=="1" /echo Trivial 
   /goto :mainloop 
/return 

Sub Event_Trivial 
   /varset v2 1 
/return 

Sub Event_Success 
   /varset v1 1 
/return 

Sub Event_ Failed 
   /varset v1 0 
/return

The event handlers already do the check for you to see if that's the proper text, else how would it get into the event to begin with?

RADCODE
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 05, 2002 6:34 pm

Post by RADCODE » Sat Sep 28, 2002 10:24 am

I see, thanks.
Would it also be possible to do these events if you have /filter skills none?

And would like to know how much of text in the chat box it actualy scans when you do events.