Problems with my custom spell caster.

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

KhaosWolf
a lesser mummy
a lesser mummy
Posts: 41
Joined: Wed Sep 10, 2003 11:34 pm

Problems with my custom spell caster.

Post by KhaosWolf » Sat Nov 29, 2003 11:40 am

Code: Select all

#event InnSuffManaa "Insufficient Mana to cast this spell!"
sub main
/declare InnSuffMana local
/varset InnSuffMana "0" 
  :archloop
    /doevents
    /if @InnSuffMana!="0" {
    /varset InnSuffMana "0"
    /goto :Medder
    }
    /sit
    /delay 20
    /sit off 
    /cast 8   
   /goto :archloop 
/return
  :Medder
    /if $char(state)!="Sit" {
    /sit
    }
    /echo im here
    /if $char(mana,pct)!="100" {
    /goto :Medder
    }
    /goto :archloop
    /return

Sub Event_InnSuffManaa
/varset InnSuffMana "1"
Runs fine until i run OOM which initiates the event i have there. And when that happens, shit hits the fan. This is the error msg i get.

Ending Macro: Bad variable in /var function
@29 (Event_InnSuffManaa): /varset InnSuffMana "1"
@5 (main): :archloop

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

Post by Falco72 » Sat Nov 29, 2003 1:54 pm

You have create your "InnSuffMana" as local variable, so it not exists in your Event_InnSuffManaa. Make it a global variable and it should work:

Code: Select all

/declare InnSuffMana global
Enjoy.

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 » Sat Nov 29, 2003 5:27 pm

Cleaned it up and should work:

Code: Select all

#event InnSuffManaa "Insufficient Mana to cast this spell!" 
sub main 
   /declare InnSuffMana global
   /varset InnSuffMana 0
   :archloop 
     /doevents 
     /if n @InnSuffMana==1 { 
       /varset InnSuffMana 0
       /goto :Medder 
      } 
      /sit 
      /delay 2s 
      /sit off 
      /cast 8    
   /goto :archloop 
   :Medder
     /doevents flush
     /if $char(state)!=SIT { 
       /sit 
     } 
     /echo im here 
     /if n $char(mana,pct)!=100 { 
     /goto :Medder 
     } 
     /goto :archloop 
/endmacro

Sub Event_InnSuffManaa
  /varset InnSuffMana 1
/return

KhaosWolf
a lesser mummy
a lesser mummy
Posts: 41
Joined: Wed Sep 10, 2003 11:34 pm

Grr

Post by KhaosWolf » Sun Nov 30, 2003 1:18 am

I never noticed i put it as a local, god damnit, thumbs up for the help though guys. And why do you use:

Code: Select all

/if n @InnSuffMana==1 { 

/if n $char(mana,pct)!=100 { 
whats the point of the n, is it needed...?

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

Re: Grr

Post by wassup » Sun Nov 30, 2003 3:06 am

KhaosWolf wrote:I never noticed i put it as a local, god damnit, thumbs up for the help though guys. And why do you use:

Code: Select all

/if n @InnSuffMana==1 { 

/if n $char(mana,pct)!=100 { 
whats the point of the n, is it needed...?
It signifies a numeric comparison. Not saying your's won't work, but I myself would do a numeric comparison on values that are numeric, instead of strings.