• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Puzzled about code. Pls help my troubled mind. (1 Viewer)

Crystane

Well-known member
Joined
Oct 9, 2005
RedCents
736¢
Heya all,

as most know I write and keep a couple macros up to date, with the new MQ2
it seems I reach some boundaries of my mind or whatever.

Here is my Problem:

Can anyone explain to me why MQ reads out
Rich (BB code):
${Bool[NULL]}
as FALSE, but reads out multiple variables like in:
Rich (BB code):
${Bool[${Target.ID} && ${Target.Name}]}
if I have no target as first step to :
Rich (BB code):
${Bool[NULL && NULL]}
and then gives out the Bool request of NULL && NULL as TRUE
????????????????????????????????????????????????

It seams stupid to me if I make an /if request of multiple variables and have a couple of am True readouts and some NULL but the if case reads the Whole as fullfilled IF case, which does then the opposite of what I want since I dont want the command after the IF to be executed if one of the requested variables is NULL.

If someone could clear that up pls, would help me a great deal.
 
Looks like a bug in the TLO

The same results won't happen using the "/if" parsing. This requires a numeric though so I altered the little test just a hair.

Sub Main
/echo TLO ${Bool[${Target.ID} && ${Target.Name.Length}]}
/if (${Target.ID} && ${Target.Name.Length}) {
/echo IF TRUE
} else {
/echo IF FALSE
}
/return

Test is identical, but the TLO and "/if" generate different results.
 
Thx Maniac,

Yeah I figured something about the TLO seams buggy, Useing numerics in the
"/if" readings helps yeah. Guess I will have to take care of that while writeing my macros and watch what and how I use my variables to circumvent the problems.

regards Crystane.
 
Crystane said:
Can anyone explain to me why MQ reads out
Rich (BB code):
${Bool[NULL]}
as FALSE, but reads out multiple variables like in:
Rich (BB code):
${Bool[${Target.ID} && ${Target.Name}]}
if I have no target as first step to :
Rich (BB code):
${Bool[NULL && NULL]}
and then gives out the Bool request of NULL && NULL as TRUE
It seems very logical to me.

MQ2 macro parser reads/parses inside out. This means that "${Me.CleanName.Equal[${Target.CleanName}]}" will first parse "${Target.CleanName}" then continue to parse "${Me.CleanName.Equal[NotEvenLessSpam]}".

The same goes for your enclosing 2 statements inside 1 Bool converter/object. NULL is as you know nothing, the absense of anything, hence it will be interpreted as FALSE. "${Bool[${Target.ID} && ${Target.Name}]}" is first interpreted as "${Bool[NULL && NULL]}" which then is something other than 0, FALSE, or NULL since it sees it now as as a string due 2 not a single NULL but 2 NULL mixed in with the characters (string) &&.

I find the best way to handle such booleans by numerics as EQManiac suggested, since 0 = FALSE and anything but 0 = TRUE. If you want to use the Bool conversion object you should enclose each variable individually like this: "${Bool[${Target.ID}]} && ${Bool[${Target.Name}]}" since that would return either "TRUE && TRUE" or "FALSE && FALSE", that is unless it's a chest or some other object with no name tag ;) then it would return TRUE for target ID and FALSE for target name ;)
 
Puzzled about code. Pls help my troubled mind.

Users who are viewing this thread

Back
Top