Public Macros Subs, Targets and Events in Macros
Reply
Subs, Targets and Events in Macros
I have been doing this for a very short time but I have learned so much about coding with MQ2. Now what good it will do me besides playing EQ?... who knows. There are still things I have picked up and are still learning about (read my next thread hehe) BUT I have noticed, even though people have found work around (so drawn out some are), I have picked up a few trick in my short time learning this stuff. I thought this might help some people out.

Subs, Events and Targets...

We all know that if you try to have a return on a target for a Sub we get back what the server is calling the target.
Example:
More +

#event healme "#1# tells the group, 'plz heal'"


Sub Main

(some crazy loop)

/return

Sub Event_healme(Line,Targ)
/target ${Targ}
/delay 1s
/call cast "${healspell}"
/return


We know this doesn't work because you get back some crazy error "no such target 0-100 (some name sometimes)".

Because when the server returns your "${Targ}" to you it adds some characters of its own to the "target".

I found sometimes the above does work.. sometimes it doesn't. The part I hate is when your in the heat of battle and it desides to stop working all together because "normaly" it just will not work because of what the server does.

I have seen so many "work arounds" to this problem and most written out and long. Through research and tring and testing and using I did find one thing that seems to be working every time.

Instead of doing this:
More +

Sub Event_healme(Line,Targ)
/target ${Targ}


Try this....
More +

Sub Event_healme(Line,Targ)
/target ${Targ.Right[-2].Left[-1]}


Since I have started using this bit of code to do a simple call on the Targ... it has worked for everytime.. for toon I started (I mean literaly started) coding macros for in low teens, all the way into there mid 40s.
My macros, from simple beginings and being simple little scratchy things, to more complex master pieces. I still don't understand alot have never written code in my life but I'm proud of some of them.. I will post a few to help some people get started and so they can use snippets or get creative with it them selves.
Thank,
Chrismed

PS.. in my posts do forgive me if I I have gramer or spelling errors.. I hate editing what I type LOL (to many EQ raids without Team Speak and Ventrilo,11 year vet and former guide)
Mon May 28, 2012 7:28 pm
I avoid parsing the chat line completely, so I have some questions.

Are you saying that:
Macro
More +
Sub Event_healme(Line,Targ)
/echo ${Targ}
/return
might have extra characters included which are not part of the character name and aren't parsing errors (beginning single or double quote, trailing comma, beginning and trailing spaces, an 's, etc)?

Will the string manipulation version return the complete name suitable for use in "/target =<name>" exact match format?
Tue May 29, 2012 3:50 pm
Senior Project Member
Yes
Yes,
When I first started righting macros for MQ2 I was using /target ${Targ}
It worked sometimes.. (I think) in certain cases... but then All my scripts stopped responding. I was echoing stuff and going through my newly made macros tring to figure out what had happened. After tracing the problem to this problem, I started doing research.. and asking ALOT of questions on alot of boards about it. I got the same answer from most of them. And one person proved it to me. He had me type some echo command in my MQ2 window in game and to look at the responce. Sure enough there it was. Numbers I think is what I remember, added to the beginning and end of the name. Again it has almost been a year since I played with this. I finaly found the work around shown. It was simple enough and works.. so far everytime. Again it doesn't happen on all things.. looks like mostly events where you want to /target ${Targ} OR /assist ${Targ}. All I know is I watch my toons when testing my macros and if the targting isn't working this is what I use instead.

${Targ.Right[-2].Left[-1]}
Tue May 29, 2012 4:24 pm
True, hidden characters/numbers are rather annoying. Same thing with item link parses.
Tue May 29, 2012 6:29 pm
Listen to This Guy
if you use [syntax] tags instead of [code] or use the # button when posting your code will be highlighted
Tue May 29, 2012 7:25 pm
Project Lead
grumble, either the SoD or UF client introduced some special characters on the end of names, I do not remember which. Broke lots of macros at the time.
_________________
Sorvani
Tue May 29, 2012 7:55 pm
Senior Project Member
Does the #Chat method have the same special characters?

I still say don't use names in the first place though. =) I use ID's for nearly everything. I'd do "/gsay healme id=${Me.ID}" and parse the ID before trying to parse in game chat. Yeah, I'm THAT guy.
Tue May 29, 2012 10:38 pm
Senior Project Member
i read netbots and eqbc for all my stuff.. rarely use game channels.
_________________
Sorvani
Wed May 30, 2012 3:39 pm
Senior Project Member
Grumble, I do the same thing now. Everything is checked against the ID and depending on what I'm doing the macro is either restarted to reset all ID's or in some subs it checks if the ID has changed.
Rare that it does but it can happen.
Recently I was able to get a full set of plugins for the compiled exe I was using so I use netbots plugins for as much as I can these days.
Makes me feel all warm and fuzzy
Fri Jun 01, 2012 6:14 pm
Listen to This Guy
Public Macros Subs, Targets and Events in Macros
Reply