Page 1 of 1

Arch.mac #event issue? I need help :)

Posted: Sat Sep 25, 2004 3:43 pm
by loadingpleasewait
I've been having an issue with my archery macro.

I have it detect snare resists using an event. I've tried using ${Macro.Return} that Spell_Routines.inc provides, which didnt work. I've tried adding a local #event right in my macro, which didnt work.

I dont know whats wrong. The thing is, it used to work?!?

The whole macro can be found here: http://macroquest2.com/phpBB2/viewtopic ... highlight=

Heres the subsroutines where issues can be found:
The #event being used:

Code: Select all

#event Resisted            "Your target resisted the #*# spell#*#" 
The actual snare routine, within the battle subroutine:

Code: Select all

         /if (${snaretoggle} && ${needsnare} && ${Target.PctHPs}<60 && ${Target.Distance}<150) { 
         /if (${Ini[ArchSettings.ini,General,SnareSpell].Equal[Entrap]}) {
            /call Cast "Entrap" Alt
         } else {
            /call Cast ${snarespell} gem4 10s
         }
         /varset needsnare FALSE 
         /delay 5
         /doevents 
    /if (${verbose} && ${immunetosnare}) /if (${verbose}) /gsay %t is Immune to snare 
    /if (${verbose} && !${immunetosnare} && !${needsnare}) /gsay %t has successfully been snared 
}
The sub event_resisted:

Code: Select all

sub event_Resisted
/echo RESISTED Event Fired
/varset needsnare TRUE
/echo Needsnare=${needsnare}
/return
the /echos in the subroutines are debugging I've tried. Basically, the event IS firing, but the needsnare variable isnt beeing set to TRUE. I dont get it.. anyone have any help? I really need it. Thanks!

Posted: Tue Sep 28, 2004 3:37 pm
by loadingpleasewait
Ok, I still cant get this to work.. Currently, since I'm using Spell_Routines.inc, I'm trying to get this to work using the ${Macro.Return} variable. Heres the code:

Code: Select all

         /if (${snaretoggle} && ${needsnare} && ${Target.PctHPs}<60 && ${Target.Distance}<150) { 
         /Popup Attempting To Snare ${Target.CleanName}...
         /if (${Ini[ArchSettings.ini,General,SnareSpell].Equal[Entrap]}) {
            /call Cast "Entrap" Alt
         } else {
            /call Cast ${snarespell} gem4 10s
         }
         /varset needsnare FALSE 
         /delay 5
         /doevents 
               /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needsnare TRUE
               /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) {               
                     /varset needsnare FALSE 
                     /varset immunetosnare TRUE
                     /if (${verbose}) /gsay %t is Immune to snare
               }
    /if (${verbose} && !${immunetosnare} && !${needsnare}) /gsay %t has successfully been snared 
}
Ok, the immune check works as intended, but it still doesnt recast snare on a resist.

The problem isnt in the event, as the event DOES fire. However the variable does not change to TRUE?!?

This is driving me nuts. Can someone PLEASE give me a heads up?

True, I am not a donator, however I have donated alot of code for the years I have been in this community. I have attempted to donate, but paypal doesnt seem to like me (or my bank maybe?!?). If donating would give me help, then make creditcard donations without paypal available. /sigh I need help.

Posted: Tue Sep 28, 2004 3:49 pm
by Ranger_Space
I'm still a newbie macro'er, but couldn't you use /declare outers instead of varset?

Just trying to help. Smack me if I'm wrong. :)

Posted: Tue Sep 28, 2004 4:20 pm
by loadingpleasewait
I'm sorry if it wasnt apparent, but all the variables have already been declared at the start of the macro within the sub main. You can see that if you go to where the macro is posted in the macro depot.

Thanks tho, but thats not it..

Posted: Tue Sep 28, 2004 4:27 pm
by Ranger_Space
Try putting in debug code to check the state before the /varset and after the varset, like so:

Code: Select all

               /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) {
                   /echo Needsnare Before Assign == ${needsnare}
                   /varset needsnare TRUE
                   /echo Needsnare After Assign == ${needsnare}
               }
               /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) {              
                     /echo Needsnare Before == ${needsnare}
                     /echo ImmuneToSnare  Before == ${immunetosnaresnare}
                     /varset needsnare FALSE
                     /varset immunetosnare TRUE
                     /echo Needsnare After == ${needsnare}
                     /echo ImmuneToSnare  After == ${immunetosnaresnare}
                     /if (${verbose}) /gsay %t is Immune to snare
               } 

Posted: Tue Sep 28, 2004 4:34 pm
by Space-Boy
try this see if it works for you, events are silly

Code: Select all

#event Resisted #*#Your target resisted#*#


Posted: Tue Sep 28, 2004 4:38 pm
by loadingpleasewait
I've put /popups and /echos in the event Sub Event_Resisted.. the event IS firing, so thats not the issue.

Some reason its not changing the variable.. Thats the issue I'm dealing with, or not dealing with as the case seems.

Thats why this is driving me crazy, it should work, but it doesnt.. = (

Posted: Tue Sep 28, 2004 4:48 pm
by dman

Code: Select all

  /if (${Ini[ArchSettings.ini,General,SnareSpell].Equal[Entrap]}) { 
            /call Cast "Entrap" Alt 
         } else { 
            /call Cast ${snarespell} gem4 10s 
         } 
         /varset needsnare FALSE 
         /delay 5 
         /doevents 
               /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needsnare TRUE 
               /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) {                
                     /varset needsnare FALSE 
                     /varset immunetosnare TRUE 
                     /if (${verbose}) /gsay %t is Immune to snare 
               } 
The potential problem I see with this code is the /doevents in between the /call cast, and your checking of the ${Macro.Return}. In that /delay 5, you may have several events that will fire and ${Macro.Return} will be based off of those subs, instead of the value returned by Sub Cast.


Edit: Also, polling a variable in memory is very much faster than polling the ini file on your harddrive everytime your macro loops. It means you can't change the ini file on the fly and expect the macro to respond immediately, but would improve execution speed.

Posted: Tue Sep 28, 2004 4:59 pm
by loadingpleasewait
Your absolutely right about the ini polling, thats a newbie mistake on my part and honestly I dont know what I was thinking.. hehe.

so, for the snare, what do you suggest? reduce the /delay before doevents? even if I do, like I've mentioned, the event is firing.. = ( I'm so confused.. maybe I'll go old school again, and change the bool back to an int and change the needsnare varsets to 1 or 0.. I mean, it used to work.. = \

Posted: Tue Sep 28, 2004 5:15 pm
by dman
First things first, try cleaning up the duplicate subs from between Spell_Routines.inc and your macro. If you are using the include to handle spell casting you should let it handle all spell casting and use Sub_Cast's returns to determine what happened. I would remove and rework all these events into the main macro as having the same line of text trying to trigger several different sub's is only going to cause heartache and debugging troubles.

Code: Select all

#Event reroot              "Your target resisted the #*# Roots spell#*#"
#event Immune              "Your target is immune to changes in its run speed#*#" 
#event Resisted            "Your target resisted the #*#" 

sub event_Resisted 
/varset needsnare TRUE 
/return 

sub event_Immune 
            /varset needsnare FALSE 
            /varset immunetosnare TRUE 
/return 
I say to remove these because Spell_Routines.inc already handles this and the conflicts between the two may be causing what troubles you are seeing. The inc will also handle checking of its own events and expects the returns to it to be right so it can pass the right things back to you. If you have duplicate subs the wrong one may get called and cause issues as well.

Edit: Found another duplicate between the inc and main macro.

Code: Select all

#Event Casting             "#*#You begin casting#*#" 

sub Event_Casting 
   :checkcast 
    /delay 1 
    /if (${Me.Casting.ID}) /goto :checkcast 
/return