Makro~Q.

Status
Not open for further replies.

Mrktwiz

New member
Joined
Jan 23, 2006
Messages
121
Reaction score
0
Points
0
Was wondering if anyone had an idea of how to put in a code that allows you to check for a mob in zone every second without spamming your window, and having mq /target the mob once it shows up on the /npc who list
 
Will check for the mob many times a second, and target it the moment it pops.

Note that this will keep your target locked unless you /endmacro
Code:
:checkloop
/if (${SpawnCount[npc "Uber Mob"]}>1) /target npc Uber Mob
/goto :checkloop

This will check many times a second like the above, however once it gets a target it will continue on to the next part of the macro

Code:
:checkloop
/if (${SpawnCount[npc "Uber Mob"]}>1) {
  /target npc Uber Mob
  /echo Uber Mob has popped! - Targeting now...
} else {
  /goto :checkloop
}
 
how about

Code:
Sub Main
 :Loop
 /squelch /target npc (insert mob here)
 /if (!${Target.ID}) /goto :Loop
 /return
??
 
Code:
|Vishtimar.Mac - Mrktwiz
|Begin macro at 100% and should cure yourself from DT (using /throw SYB) and calls out egg direction in /rs

#Event DT "#*#You sense your doom approaching#*#"

Sub Main
:loop
 /doevents
/squelch /target npc (A Tainted Egg)
 /if (!${Target.ID}) /goto :Loop
 /face
/delay 3s
/rs EGG ${Me.Heading} !!!!
 /return

----------
Vish
---------

Sub Event_DT
            /target mournful
            /delay 1s
            /throw Shoulder My Burden
/return

Trying to do a cure and egg direction shout both in the same macro, i know i have mistakes here and i have a few questions... I tried combining
Code:
Sub Main
:loop
 /doevents
/goto :loop

and

Code:
Sub Main
 :Loop
 /squelch /target npc (insert mob here)
 /if (!${Target.ID}) /goto :Loop
 /return

and im posotive i did it wrong :p can ya check it out =]]
 
Code:
|Vishtimar.Mac - Mrktwiz
|Begin macro at 100% and should cure yourself from DT (using /throw SYB) and calls out egg direction in /rs

#Event DT "#*#You sense your doom approaching#*#"

Sub Main
:loop
 /doevents
 /squelch /target npc [COLOR="Red"]"[/COLOR]A Tainted Egg[COLOR="red"]"[/COLOR]
 /if ([COLOR="red"]${Target.CleanName.NotEqual[A Tainted Egg]}[/COLOR]) /goto :Loop
 /face
 /delay 3s
 /rs EGG ${Me.Heading} !!!!
 /return

----------
Vish
---------

Sub Event_DT
            /target mournful
            /delay 1s
            /throw Shoulder My Burden
/return

Close, gotta use quotes, not paranthesis. The second change is purely optional. Allows you to target stuff without forcing the macro to end prematurely.

I know nothing of the event. Are you wanting it to end after finding the one egg?
 
nope i need it to keep going, but i need it to ALWAYS check for the "You sense your doom approaching"
 
Would this workk??

Code:
|Vishtimar.Mac - Mrktwiz
|Begin macro at 100% and should cure yourself from DT (using /throw SYB) and calls out egg direction in /rs


Sub Main
:loop
 /doevents
/if (!${Me.Buff[Creeping Doom].ID} ) /call DT
/squelch /target npc "A Tainted Egg"
 /if (!${Target.CleanName.Equal[A Tainted Egg.ID]})
/face
/delay 3s
/rs EGG ${Me.Heading} !!!!
 /goto :loop

----------
Vish
---------

Sub Event_DT
            /target mournful
            /delay 1s
            /throw Shoulder My Burden
/return
 
When your screen shows something you have set as an event, it puts it on the stack of events. These can pile up indefinatly so far as I know.

When you issue a /doevents, it gives all the events permission to process before continuing on. So each loop it checks for the DT message.

I'm not sure what you mean by /if (!${Me.Buff[Creeping Doom].ID} ) /call DT

That will call DT every cycle, unless you have Creeping Doom on you. Remove the ! and it would work. What your attempting though is redundancy. And while redundancy is ok (I'm a fan of it) your possibly allowing it to jump to the DT too many times.

What you want is:
1) Watch for trigger text or an egg to spawn
2) When one of those happens, take necessary actions, then return

So you will:
1) Make a master loop
2) In that loop call a /doevents to check for DT text
3) Check for an egg. If one exists, call an outside sub to announce it
4) Repeat the loop

Possible problems:
1) Finding the same egg every cycle, and spamming it.

Solution:
1) Check the egg ID against previous. This is assuming there is only 1 egg up at a time.

Code:
|Vishtimar.Mac - Mrktwiz
|Begin macro at 100% and should cure yourself from DT (using /throw SYB)
|and calls out egg direction in /rs

#Event DT "#*#You sense your doom approaching#*#"

Sub Main
/declare EggID int outer 0

:loop
    /doevents
    /if (${Spawn[npc "A Tainted Egg"].ID} && ${Spawn[npc "A Tainted Egg"].ID}!=${EggID}) /call EggSub
  /goto :loop
/return

|---
|- Vish
|---------

Sub Event_DT
  /target mournful
  /delay 1s
  /throw Shoulder My Burden
/return

|-----------
|- Set Egg ID and Announce
|--------------------------
Sub EggSub
  /varset EggID ${Spawn[npc "A Tainted Egg"].ID}
  /tar npc "A Tainted Egg"
  /delay 2s (${Target.CleanName.Equal[A Tainted Egg]})
  /face fast
  /delay 2s
  /rs EGG ${Me.Heading} !!!!
/return

That's my personal take on it. You were very close again though, so long as you don't mind it spamming the egg in chat every 3 seconds. Just need the following change

Code:
 /if (!${Target.CleanName.Equal[A Tainted Egg.ID]}) [COLOR="red"]{[/COLOR]
/face
/delay 3s
/rs EGG ${Me.Heading} !!!!
[COLOR="Red"]}[/COLOR]

/if (!${Target.CleanName.Equal[A Tainted Egg.ID]})

Has a couple of problems. Don't take this the wrong way, but I'm going to assume you don't understand exactly how this works.

Target is a TLO. CleanName does just what it says, returns the name you see by looking at the npc, as a string. You can't use a math operation on a string. ie you can't do ${Target.Name}=="John Doe".

That's where the .Equal comes in. It compares what you have to whatever is inside of the brackets. If you want it to trigger only if it doesn't match, then use .NotEqual ie. /if (${Target.CleanName.NotEqual[Rare Pop]}) /echo Still not up...

!= means "does not equal"
== means "equals"
Both of which are math functions.
Your original line was trying to say "If my target is NOT an egg, then announce the egg to the raid"

By using .ID you cast the entire thing into an INT (integer) which can then be parsed with math. You aren't really casting it so much as extracting a number from it to work with, instead of text.

So by (!${Target.ID}) you are saying "If my target doesn't have a spawn #, do suchandsuch". And of course, if you don't have a target, it cant possibly have a spawn #. So it returns null for the ID, null is NOT a number, and so it proceses. The .ID should never be used with .Equal

And when you do use .ID it will be by itself outside of any [] brackets and right before the } bracket

All /if statements work on two conditions. Either /if (TRUE) or /if (FALSE). That's all it can return. Whatever happens inside of ( ) comes out as one of those two answers. TRUE processes. FALSE checks for an 'else' statement, or keeps going if there is none.
So
/declare Test int local 2
/if (${Test}==2) /echo I can count!
is seen as /if (TRUE) /echo I can count!

whereas
/declare Test int local 3
/if (${Test}==2) /echo I can count!
is seen as /if (FALSE) /echo I can count!
Since it's false, it doesn't echo anything.
and /if (${Test}!=2)
is the same as /if (TRUE). Because it's true that 3 does not equal 2.

If your wondering how we come up with all the types, and .Equal .CleanName .Distance .ID stuff you can look here

(must follow along here with each step request)

TLO (Top Level Object) is the first item inside of a ${}. In this case we are working with ${Target}. So click the link Top-Level Objects. Scroll down and click Target.

You can see that Target has access to 'spawn' types. Spawn is not the same as spawn. Spawn is a TLO as well. spawn is a set of types. So click the word spawn.

All those bold words are things you can put after Target.
/echo ${Target.ConColor} would echo 'GREEN' into your MQ window on a green mob.
We are working with CleanName. Notice it says string CleanName. This lets you know that if you end it right there ${Target.CleanName} that your return will be in string form.

/if (${Target.CleanName}) /echo Stuffage..
will never ever echo. If statements have to compare something to something else. In this case you aren't comparing anything. It's not even saying "If the target has a name". It's simply "here's a name". So for it to be an if statement, we have to keep building.

If you scroll down to ID you will see it's an int type.

So click on string, beside the CleanName. These are things that you can put after CleanName. You can see Equal down there. That's how we built ${Target.CleanName.Equal[Mob]}. Equal is a bool

Bool only has 2 values. TRUE and FALSE. So when it doesn't match you have /if (FALSE). For all regards, in this example a NULL is treated as a FALSE as well. There is no half TRUE.

Coming back to /if (!${Target.CleanName.Equal[A Tainted Egg.ID]})

which should be written as /if (${Target.CleanName.Equal[A Tainted Egg]})
if you are wanting to do something when you target the egg
or /if (${Target.CleanName.NotEqual[A Tainted Egg]})
if you are wanting to do something with anything else as a target

If you knew all this, disregard. Perhaps somebody will learn something from it though.
 
Last edited:
i had absolutley no clue what they meant i just started trying to create macros :) thanks
 
Nice job Taron. I enjoy creating macros myself, and its nice to see constructive dialog regarding macro topics.
 
FYI:

A tainted egg now should be checked by :
Code:
${Spawn[npc race "Dragon Egg"].ID}

Now spawns with no name at all but the RACE is a Dragon Egg.
 
/delay 2s (${Target.CleanName.Equal[A Tainted Egg]})

I forgot to explain that. You know how a /delay works.

However /delay 3m (${Target.ID})
will delay for either 3 minutes OR until you have a target.
It can be used to hold a macro for a reasonable amount of time until what your wanting to do happens. It's a cleaner version of

:loop
/if (!{$Target.ID}) /goto :loop

Simply because it can continue on even if the macro gets bugged. Whereas the loop statement would keep it locked in that position indefinatly until you manually picked a target. Unless, of course, that's your intention.

So how do we change ${Target.CleanName.Equal[A Tainted Egg]} to check for the egg if it has no name?

Like Wiked said, check by race. Using the MQ2 Wiki (bookmark this, it should be your macro bible)

Top-Level Objects -> Target -> spawn -> Race -> Your choice of ID or Name
You can use 3 ways to check the target at this point
1) ${Target.ID} - Works, but may possibly have something else on target. So avoid it this time
2) ${Target.Race.ID}==xx - Where xx is the ID of the race. However I don't know the race ID so I'll go with option 3 myself
3) ${Target.Race.Name.Equal[Dragon Egg]}

I'll let you figure out how to change the rest of it :)
 
you did a hella good job explaining that, thx wicked aswell for that... so let me see.


Code:
:loop
/if (!{$Target.ID}) /goto :loop

this is saying , if i DONT have a target go back to :loop? where would i insert the name ? inside target?
Code:
 (!{$A Tainted Egg.ID})
??

i am truly a beginner and the wiki seems to complicated to explain /declares and /varsets to me o_O it just gave me a headache lol
 
Mrktwiz said:
where would i insert the name ? inside target

You have to build on ${Target}. Wicked said it has no name though. So you can't check that. Instead you have to check for that race.

If the egg exists and is untargetable before 'popping', that could pose a problem. But for the sake of this thread, I'm going to assume that's not true.

(!${Target.ID}) was just an example. What you are wanting to say is:
If my targets race is not "Dragon Egg", restart this loop

/if (${Target.Race ... and then what

Look around in the wiki. When you click a link, it simply tells you what you can add onto whatever you came from
 
Mrktwiz said:
i am truly a beginner and the wiki seems to complicated to explain /declares and /varsets to me o_O it just gave me a headache lol

/declare is used to make a variable pop into existance. Like playing god.

Variable is something that stands for something else. Much like you learned in 8th grade algebra. 2x +3 = 11. Here x stands for 4. But x can be anything, x can change at will. 4 cannot change. 4 is always a 4.

MacroQuest has no idea what I want EggID to stand for if I don't declare it. A timer? A string? An int? A bool? Much less what it's starting value is.

You aren't required to give it starting value, but it's nice to.

Make this macro
Code:
Sub Main
/echo ${JimmyHoffa}
/end
and it won't work. It doesn't even know that JimmyHoffa exists.

Code:
Sub Main
/declare JimmyHoffa string local Hello World!
/echo ${JimmyHoffa}
/end

In this case we told MQ that JimmyHoffa is going to be a string (text) , local (only exists inside of this particular Sub), and its starting value is "Hello World!". Note that you don't use quotes when declaring a string.

But lets say later on in the macro, the world turns on us. It calls us evil names, talks behind our back, and puts tuna casserole in our juice cup. We hateses the world... nasty world. We want to change JimmyHoffa to stop telling the world helo. We need to set the variable to a new value using... what else.. /varset

Code:
Sub Main
/declare JimmyHoffa string local Hello World!
/echo ${JimmyHoffa}
/delay 5s
/varset JimmyHoffa Mean old world!
/echo ${JimmyHoffa}
/end

Thus we have to declare a variable so MQ knows what the hell we are talking about. Then we changed it later on to reflect a new value.
 
Status
Not open for further replies.