#Event .... having a problem.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Miseaujeu
a lesser mummy
a lesser mummy
Posts: 32
Joined: Mon Nov 24, 2003 6:25 pm

#Event .... having a problem.

Post by Miseaujeu » Mon Jan 05, 2004 12:33 pm

Code: Select all

#Event SLAINBY "You have been slain by "


Sub Main
   :Loop
.
<kill stuff>
.
   /goto :Loop
/endmacro

|This should happen when you die!
Sub Event_SLAINBY
   /echo  "You Dead!"
   /endmacro
/return

I THING that it should work as above ( from what I've stolen from various other macros ) ... but in my current bot this doesn't work. Is there something that I'm missing? Just by declaring the #Event is that enought to make it "active"? Also, the correct syntax is Sub Event_<#event title>?

Guess that's all I got today =)

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Post by SimpleMynd_01 » Mon Jan 05, 2004 1:47 pm

This should fix it.

Code: Select all

#Event SLAINBY "You have been slain by " 


Sub Main 
   :Loop 
. 
<kill stuff> 
[color=cyan]/doevents[/color]
. 
   /goto :Loop 
/endmacro 

|This should happen when you die! 
Sub Event_SLAINBY 
   /echo  "You Dead!" 
   /endmacro 
/return 
-SimpleMynd

Miseaujeu
a lesser mummy
a lesser mummy
Posts: 32
Joined: Mon Nov 24, 2003 6:25 pm

Post by Miseaujeu » Mon Jan 05, 2004 2:55 pm

Indeed ! See, it's just the little things .... and the medium ones .... sometimes the big things .... er. ....


Well, anyway thanks a lot. :)

Lord2dragson
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sun Jan 11, 2004 10:05 pm

#event problems

Post by Lord2dragson » Sun Jan 11, 2004 10:15 pm

OK, well first post and all so i'll give it a shot.
I'm trying to cast invs then go pick up ground spawns then cast invs again, I cant get it to recasts IF i have been intrupted or fizzled. The events are not working can anyone help me?

Code: Select all

| GroundCollect.mac  - v 1. 2. 1  by FreQuency 10/24/03 
| Still kinda Incomplete but gonna release as a start for expansion 
|  ~ Obstruction Code basis borrowed from Scrime who borrowed from GrimJack 
|   Collects groundspawns from Misty, Butcherblock and Wakening Lands 
|  ~Known Issues 
|   *   Will not filter spawns considered to be out of reach. 
|   *   obstruction code may not get charecter around all areas 
|   ***    Many others 
| Must be monitored to ensure character does not get stuck 


#event fizzle "Your spell fizzles!" 
#event interrupt "Your spell is interrupted." 
#event turbo 

#include routines.mac 

Sub Main 
   /cleanup 
   /call DefineGlobals 
   /if $cursor()!=NULL /click left auto 
   /if $invpanel==True /press I 
   /Call DoLog Begining Collection in zone $zone 
:Next 
   /cast "Gather Shadows"
   /delay 5s 
   /doevents
   /call FindItem *Green 
   /call MoveToTarget 
   /call PickUpItem 
   /goto :Next 
    
/return 

Sub event_fizzle 
/return 

Sub event_interupt 
   /cast "Gather Shadows"
/return

Sub DefineGlobals 
/declare CollectedItem global 

/declare LastY global 
/declare LastX global 
/declare ObstCount global 

/declare NotFound global 
/return 

Sub FindItem 
:NotFoundReturn 
   /varset NotFound 0 
   /seterror clear 
   /itemtarget @Param0 
   /if "$getlasterror"=="ITEM_NOTFOUND" /call NotFound @Param0 
   /if "$getlasterror"=="ITEM_NOTFOUND" /varset NotFound $return 
   /if n @NotFound==1 /goto :NotFoundReturn 
   /call DoLog "Item found at: $ground(y), $ground(x)." 
/return 

Sub MoveToTarget 
:KeepMoving 
   /call CheckForObst 
   /face loc $ground(y), $ground(x) 
   /sendkey down up 
   /if n $distance(item)>15 /goto :KeepMoving 
:StopMoving 
   /sendkey up up 
/return 

Sub PickUpItem 
   /face item 
   /click left item 
   /press i 
   /delay 1s
   /mouseto 500 400
   /delay 1s
   /click left
   /press i
   /press Home 
/return 

Sub CheckForObst 
   /if n $char(x)==@LastX /if n $char(y)==@LastY { 
      /varadd ObstCount 1 
   } else { 
      /varset ObstCount 0 
   } 
    
   /varset LastX $char(x) 
   /varset LastY $char(y) 
    
   /if n @ObstCount>3 { 
      /call DoLog "Obstruction at $char(y), $char(x)" 
      /call GoAroundObst 
   } 
/return 

Sub GoAroundObst 
   /sendkey up up 

   /sendkey down down 
   /delay (2+$rand(5))s 
   /sendkey up down 


   /if n "$rand(20)">="10" { 
      /sendkey down left 
      /delay 5 
      /sendkey up left 
      /sendkey down up 
      /delay 7s 
      /sendkey up up 
   } else { 
      /sendkey down right 
      /delay 5 
      /sendkey up right 
      /sendkey down up 
      /delay 7s 
      /sendkey up up 
   } 
/return 

Sub NotFound 
   /call DoLog "Item: ~~  @Param0  ~~ not found. Waiting 1 min. . ." 
   /delay 1m 
/return 1 

Sub DoLog 
   /mqlog @Param0 
   /echo @Param0 
/return 

I have edited this for my own use so if anyone could Plz help me new at this whole thing lol

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Mon Jan 12, 2004 1:34 am

Have you even thought to look at SpellCast.inc?
Have you tried USING SpellCast.inc to handle this for you?

...and....why is turbo an #event?
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Mon Jan 12, 2004 7:57 am

Check your spelling on event names:

Code: Select all

#event interrupt "Your spell is interrupted." 

Sub event_interupt 
   /cast "Gather Shadows" 
/return 
Not 100% positive if this is case sensitive:

Code: Select all

/if $invpanel==True /press I


Your Sub Event_fizzle doesn't do anything by the way. It doesn;t even return a value to tell the macro that a fizzle occurred.

You might want to rethink what you want done with Events and ask some questions about how they should be done. It looks more like you were just copy/pasting things without knowing what they were doing.

Lord2dragson
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sun Jan 11, 2004 10:05 pm

Post by Lord2dragson » Mon Jan 12, 2004 2:10 pm

Not really copying and pasteing just trying to figure out stuff lol, havent ever programed and was trying to figure it out, but i guess i sould try reading up on a little bit more stuff before i go trying things out. But thank you for your time and my stupid errors, we all gotta learn some where!
Thanks