• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Is this Possible...

TheMobeater

New member
Joined
Nov 20, 2013
RedCents
Please excuse the writing of the code, I am no programmer by any means, am just trying to get my feet wet with this "simple" macro.

I Just want to be able to echo that my level is more, less, or equal to the mob, and then echo what that difference in levels is, but all I get is errors :(

Rich (BB code):
Sub Main
/declare diff

/if (${Me.Level}<${Target.Level}){
 /varset diff ${Math.Calc[${Target.Level}-${Me.Level}]}
 /echo My level is less
 
 } else { /if (${Me.Level}>${Target.Level})
 /varset diff ${Math.Calc[${Me.Level}-${Target.Level}]}
 /echo My level is more 
 
} else { /echo My level is equal
}
/echo $diff	
/end
/return

Any advice would be appreciated, or if there is already a macro out there for this, a point in the right direction would be nice.

Thank You,
TheMobeater
 
im not sure what macro i have running that does it but when i click on the mob or get close enough the names turns the con color. it may be the headshot macro because i have a ranger.
 
I'm not running any macro for that. That's a base feature of MQ2 if I'm not mistaken.
@themobeater: Do a search for my HUD. I posted it on here. There are a few lines of code in it that will tell you the level of any mob or PC you click on. Also in that HUD are lines of code that will tell you if the mob can be Headshot or not.
 
Very Good Start. Most is just MQ2 syntax issues which you get used to as you write more macros. Always look at the error messages to debug your macros. Just do 1 at time.

My notes

/declare diff - if not defined variables default to text outer. You are doing math so you want an interger e.g. number
Rich (BB code):
/declare diff int outer
/varset diff ${Math.Calc[${Target.Level}-${Me.Level}]} - this works but to stream line it you can use the /varcalc function and drop the Math.Calc
Rich (BB code):
/varcalc diff ${Target.Level}-${Me.Level}
} else { /if (${Me.Level}>${Target.Level}) - your if statement is outside the { bracket causing a syntax error in your else-if statement
Rich (BB code):
 } else /if (${Me.Level}>${Target.Level}) {
/echo $diff - Missing brackets for the variable {} causing a syntax error
Rich (BB code):
/echo ${diff}
 
I'm not too good with MQ specific programming, but a couple things you could look at:
1. Calculating diff: I'm not sure if absolute value is available, but something like /varset diff ${Math.Abs[${Target.Level}-${Me.Level}]} should work in all cases.
2. You may be getting errors due to your elses. Typically, you can say:
Rich (BB code):
/if (true) {
    //do this
} else if (true) {
    //do this
} else {
    //do this
}
. Two elses would not work. Again, I'm not sure on MQ2 syntax, but this is the case in all programming languages I know.

Edit: Listen to Maskoi, didn't see his post when I hit respond.
 
Question - Is this Possible...

Users who are viewing this thread

Back
Top
Cart