Newest zip b, parsing arguments? help

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

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Newest zip b, parsing arguments? help

Post by loadingpleasewait » Wed Apr 21, 2004 6:49 pm

Here is my macro, I cant get anything related to auto foraging to work. = \ hell, dont know if any of it works as I cant seem to get past that.. help :cry:

Code: Select all

|arch.mac Auto-Archery
/zapvars
#turbo
#Event exp "experience!"
#Event Root "Your Earthen Roots spell has worn off."
#event haste "The quickening spirit departs"
#event eagle "The avian presence departs"
#Event Casting "You begin casting" 


Sub Main(Arg)
   /echo "Auto-Arch Macro has begun."
   /declare startexp global
   /declare startaaxp global
   /declare currentxp global
   /declare xpgain global
   /declare currentaa global
   /declare aagain global 
   /declare foragetoggle global
   /declare targetarray array 

   /varset startexp ${Me.Exp}
   /varset startaaxp ${Me.AAExp}

[color=red]/newif (${Defined[Arg]} && @arg==forage) {   
   /echo "Auto-Forage enabled"
   /varset foragetoggle 1
   }[/color]
      :mainloop
   /newif (${Me.Combat} && ${Target.ID} && ${Target.CleanName.NotEqual[${Me.Name}]}) /call Archery
[color=red]         /newif $(@foragetoggle==1 && $(Me.AbilityReady[Forage]}) {
            /doability Forage
            /autoinventory
         }[/color]
         /doevents
      /goto :mainloop
/return

Sub Archery
  /attack off
  /varset targetarray(0) ${Target.CleanName} 
  /varset targetarray(1) ${Target.Level} 
  /varset targetarray(2) ${Target.Name} 
  /varset targetarray(3) ${Target.ID} 
    /echo Fighting  @targetarray(1) @targetarray(0) 
  /face nolook
  :CloserAF   
  /ranged
 [color=red]        /newif (@foragetoggle==1 && $(Me.AbilityReady[Forage]}) {
            /doability Forage
            /autoinventory
         }[/color]
    /newif (${Target.Distance}<11 && $(Me.AbilityReady[Kick]} /doability Kick
    /doevents
    /newif (${Target.Distance}<11 && $(Me.AbilityReady[Disarm]} /doability Disarm
    /newif ${Target.ID}!=@targetarray(3) /goto :EndAF 
     /doevents
    /goto :CloserAF 
/return

:EndAF 
    /echo @targetarray(1) @targetarray(0) is dead 
    /varset targetarray(3) 0 
    /keypress Num_5 
/return 

Sub Event_Root
   /sit
   /stand
   /target id @targetarray(3)
   /cast "Earthen Roots"
   /delay 2s
   /return

   

Sub Event_exp
   /varset currentxp ${Me.AAExp}
   /varcalc xpgain @currentxp-@startexp/3.30
   /varset currentaa ${Me.AAExp}
   /varcalc aagain @currentaa-@startaaxp/3.30
      /popup "Gain: @xpgain% xp - @aagain% aa ## Cur: @currentxp% xp - $char(aa,exp)% aa"
      /echo "Gain: @xpgain% xp - @aagain% aa ## Cur: @currentxp% xp - $char(aa,exp)% aa"
   /varset startexp ${Me.AAExp}
   /varset startaaxp ${Me.AAExp}
/return

Sub event_eagle
      /cast  "Eagle Eye"
      /delay 5s
/return

Sub event_haste
      /cast item "Eyepatch of Plunder"
      /delay 4s
/return   

sub Event_Casting 
   :checkcast 
    /delay 1 
    /newif ${Me.Casting} /goto :checkcast 
/return 
Thanks in advance
LOADING PLEASE WAIT...

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Apr 21, 2004 7:02 pm

You're trying to parse a string, /newif only does numeric. Hence you get the error "non-numeric encountered". Secondly, you don't assign a value to foragetoggle unless you're setting it to 1. This means that if it's not 1 the value is something like "UNDEFINED-LOCAL" .. which is also a string, and /newif cant parse.

/varset foragetoggle 0
/newif (${Defined[arg]} && ${String[@arg].Equal[forage]}) {
.
.
.

/newif (@foragetoggle==1 && ${Me.AbilityReady[Forage]}) {
.
.
.

/newif (@foragetoggle==1 && $(Me.AbilityReady[Forage]}) {
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 10:03 pm

Thank you so much lax.. heh, this has been driving me crazy..
LOADING PLEASE WAIT...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 10:47 pm

Spoke too soon. Ok, what I'm trying to do is make it so when I start the macro I can do a

Code: Select all

/macro arch.mac forage
and that will make the macro auto forage.

I made my sub main like this

Code: Select all

Sub Main(Arg)
Taking your advice about it being a sting, I changed my code to read

Code: Select all

 /newif (${Defined[arg]} && ${String[@Arg].Equal[forage]}) { 
   /echo "Auto-Forage enabled"
   }
and

Code: Select all

 /newif (${String[@Arg].Equal[forage]} && $(Me.AbilityReady[Forage]}) {
            /doability Forage
            /autoinventory
         }
which I thought would work.. id does not.. :( it ends the macro with a "Failed to parse /if command.

This is a smaller macro, I have a more complex one for melee fighting which I dont want to convert untill I fully understand arguments , or strings as you were. I dont see an example of how to do this anywhere.. :(
LOADING PLEASE WAIT...

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Apr 21, 2004 10:49 pm

Well I saw one typo and possible case problem. Try this:

Code: Select all

/newif (${Defined[[color=red]A[/color]rg]} && ${String[@Arg].Equal[forage]}) { 
   /echo "Auto-Forage enabled" 
} 


   /newif (${Me.Combat} && ${Target.ID} && ${Target.CleanName.NotEqual[${Me.Name}]}) /call Archery 
         /newif (${String[@Arg].Equal[forage]} && $[color=red]{[/color]Me.AbilityReady[Forage]}) { 
            /doability Forage 
            /autoinventory 
} 
You can also stop using /newif and just use /if now with the latest zip.

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 10:57 pm

OMFG!! Typos!! ok, ok.. made changes and it works... I cant believe that.. stinkin case sensitivity.. Thanks... I'm such a noob!
LOADING PLEASE WAIT...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 10:57 pm

OMFG!! Typos!! ok, ok.. made changes and it works... I cant believe that.. stinkin case sensitivity.. Thanks... I'm such a noob!

oh, and while I was posting here on the boards, I was being keeled by a drolvarg.. :( didnt even know.. went back to my other window just in time to watch me die... :cry:
LOADING PLEASE WAIT...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 11:00 pm

oh, and latest zip, this

Code: Select all

${If[${Macro.Name},${Macro.Name},None]}
now shows nothing if a macro is running.. it should be showing the macro name.. = \
LOADING PLEASE WAIT...

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Apr 21, 2004 11:04 pm

Try this:

Code: Select all

${If[${Macro.Name.Length},${Macro.Name},None]}

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 11:13 pm

You are very helpfull.. Ok, one more?

Code: Select all

${Me.Casting}



Returns the name of the spell I'm casting, how can I turn this into a sort of cast state, just to show weather or not I'm casting in a 1 or 0 fashion?

thanks in advance.. = )
LOADING PLEASE WAIT...

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Apr 21, 2004 11:18 pm

This isn't really 1 or 0 but it will equate to true or false.

Code: Select all

/if (${Me.Casting.ID}) {
    /echo TRUE
} else {
    /echo FALSE
}

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Apr 21, 2004 11:39 pm

Woot, that was fun, and it also finally led me to somewhat understand the new system.. Thanks Lax and ml2517 Everythings working!!

/if ${Me.Casting.ID} /goto :checkcast is what worked for what I was needing.. thanks..
LOADING PLEASE WAIT...