New Group Autoheal script or modded genbot one? (request)

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Fri Aug 22, 2003 3:12 am

Wassup wrote:Couple other things I see:

When you use variables in comparisons you need to make sure the variable name is preceded by a $.

Some examples:

Code: Select all

/if n $char(mana,cur)<$int($spell("$p1",mana)+MANABUFFER) /goto :Exit
should be

Code: Select all

/if n $char(mana,cur)<$int($spell("$p1",mana)+$MANABUFFER) /goto :Exit



Code: Select all

/if t$p0==MANATIMER { 
   /gsay $char(mana,pct)m 
   /varset MANATIMER 3m 
}
should be

Code: Select all

/if t$p0==$MANATIMER { 
   /gsay $char(mana,pct)m 
   /varset MANATIMER 3m 
}



Code: Select all

Sub Event_HitsYou 
   /if n $char(hp,pct)<10 /call GetOutOfDodge 
   /if n $NEXTOUCHTIMER>0 /return 
   /varset NEXTOUCHTIMER 12s 
   /tell MASTERNAME Ouch, I'm getting whacked by $target(name,clean)! 
   /target clear 
/return
should be

Code: Select all

Sub Event_HitsYou 
   /if n $char(hp,pct)<10 /call GetOutOfDodge 
   /if n $NEXTOUCHTIMER>0 /return 
   /varset NEXTOUCHTIMER 12s 
   /tell $MASTERNAME Ouch, I'm getting whacked by $target(name,clean)! 
   /target clear 
/return
None of those are variables. They are defines and they should work as is.
A define replaces every occurance of something with something else.

Example:
#define MANABUFFER 30
Replaces every occurance of MANABUFFER with 30

Code: Select all

/if n $char(mana,cur)<$int($spell("$p1",mana)+$MANABUFFER) /goto :Exit
becomes

Code: Select all

/if n $char(mana,cur)<$int($spell("$p1",mana)+30) /goto :Exit
If MANABUFFER was a define for a variable you would be correct.

Example:
#define MANABUFFER v80
/varset MANABUFFER 30

/echo $MANABUFFER

You would need the $ this case since the text "MANABUFFER" is a define for a variable.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

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

Somewhat puzzled

Post by wassup » Fri Aug 22, 2003 5:42 am

OK, I can follow most of what you are saying, and understand what you mean, but aren't timers variables?

If they are then there are some problems with some of the code.

In Event_Timer I see

Code: Select all

/if t$p0==CASTNEXTTIMER /varset OKTOCAST 1
From what you are saying, if $p0 happens to be 2 would it be

Code: Select all

/if t2==t1 /varset OKTOCAST 1
This doesn't make sense to me because t1 and t2 appear to be variables and not a set values.

Code: Select all

#define CASTTEXTTIMER t1
It seems the code would be

Code: Select all

/if n $t$p0==$CASTNEXTTIMER /varset OKTOCAST 1
Maybe I am just not understanding something.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Re: Somewhat puzzled

Post by grimjack » Fri Aug 22, 2003 6:15 am

Wassup wrote:OK, I can follow most of what you are saying, and understand what you mean, but aren't timers variables?

If they are then there are some problems with some of the code.

In Event_Timer I see

Code: Select all

/if t$p0==CASTNEXTTIMER /varset OKTOCAST 1
From what you are saying, if $p0 happens to be 2 would it be

Code: Select all

/if t2==t1 /varset OKTOCAST 1
This doesn't make sense to me because t1 and t2 appear to be variables and not a set values.

Code: Select all

#define CASTTEXTTIMER t1
It seems the code would be

Code: Select all

/if n $t$p0==$CASTNEXTTIMER /varset OKTOCAST 1
Maybe I am just not understanding something.
Out of the context of the macro, it appears you are correct. Looking at the macro as a whole, I see that it is correct the way it is. I will try to explain.

Code: Select all

Sub Event_Timer
   /if t$p0==CASTNEXTTIMER /varset OKTOCAST 1
  /if t$p0==MANATIMER {
     /gsay $char(mana,pct)m
     /varset MANATIMER 3m
  }
/return 
Since this event triggers when any timer runs out and for more than one timer, the if statements are trying to figure out which timer ran out. $p0 will be the number of the timer(1 for t1, 2 for t2... ect). I will replace all #define with what they represent. This is what the first /if becomes when t1(AKA CASTNEXTTIMER) runs out.:

Code: Select all

/if t1==t1 /varset OKTOCAST 1
And this is what the second if becomes:

Code: Select all

/if t1==t2 {
   /gsay $char(mana,pct)m
   /varset t2 3m
}
This makes the first if statement true when the timer t1(AKA CASTNEXTTIMER) runs out and the second false. Which is what would be the desired result if t1 ran out.

If t2(AKA MANATIMER) ran out the if's would become this:

Code: Select all

/if t2==t1 /varset OKTOCAST 1

/if t2==t2 {
   /gsay $char(mana,pct)m
   /varset t2 3m
}
Making the first if false and the second one true. Since he is comparing the name of the variable and not it's contents the $ is not needed.

Am I making sence? I'm not very good at explaining things.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

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 » Fri Aug 22, 2003 11:38 am

I see what you are saying, he is just doing a match of timers, not the values held by the timers.

I've never seen a macro use that technique before either so it threw me off a bit.