Spawn & NearestSpwan issu
HI dudes :)
I'm trying to use the spawn and nearestspawn tlo through the peq mq2 release.
I'm having a weird issu on a script
I'm trying to use the Spawn or NearestSpawn
like
Macro
It works great
Now if i try to use this in a sub like
Macro
it will always return "KO". The use of a variable ${name} is not accepted
Am i doing something wrong ?
even simpliest, if i'm doing this
somewhere before => (${name}=blumblum
Macro
it returns "they are no spawn 0 100 matching blumblum
i'm getting crazy with this
Wed May 11, 2011 11:52 pm
never actually tried to use "name" because it is generally a reserved keyword in pretty much every programming language.
_________________
Sorvani
Macro
_________________
Sorvani
Thu May 12, 2011 12:10 am
Senior Project Member
yeah i had the same feeling and change my variable name
it doesn't work either
any time i use a SPAWN or NearestSpawn with a ${toonname} it returns null
i'm trying to debut it with simple thing like
to debug it step by step...And no luck. i've checked my toon is in the same zone, is not ano or role...not sure it can block, but just in case.
if i do a
it doesn't work either
any time i use a SPAWN or NearestSpawn with a ${toonname} it returns null
i'm trying to debut it with simple thing like
Macro
to debug it step by step...And no luck. i've checked my toon is in the same zone, is not ano or role...not sure it can block, but just in case.
if i do a
Macro
it works perfectly
Thu May 12, 2011 12:29 am
Looked closer at what you were doing sorry i didn't read it carefully last night.
${Spawn} and ${NearestSpawn} return the spawn's server side name. That is a string and can not be converted to a boolean.
_________________
Sorvani
${Spawn} and ${NearestSpawn} return the spawn's server side name. That is a string and can not be converted to a boolean.
Macro
_________________
Sorvani
Thu May 12, 2011 7:50 am
Senior Project Member
Hehe, my fault, i'm not really clear explaining my bug
Actually the code i made is not exactly the one i wrote (i made the post this morning and didn't check the syntax), and my issue is not with the boolean casting :)
I'll try to explain again
If i have somewhere a variable initialized ${tooname} wich contains the string "blumblum"
Then
When i do this simple instruction in my code
/echo ${NearestSpawn[pc ${tooname}]}
=> it returns null
if i don't use a variable but i put directly my toon name in the NearestSpawn tlo, it works perfectly
/echo ${NearestSpawn[pc ${blumblum}]}
Why i want to use this :
I make a script where i catch a tell to my cleric, get the teller name, catch his ID, then i target him through his ID. (and then i can buff him, heal him whatever).
So i use the NearestSpawn fonction, because it has a .ID attribute
And well, because of the bug i explained below, it doesn't work.
The only workaround i have is something like this
(code may be messy, i'm writing it from work, and i'm still a mq2 newbie)
Actually the code i made is not exactly the one i wrote (i made the post this morning and didn't check the syntax), and my issue is not with the boolean casting :)
I'll try to explain again
If i have somewhere a variable initialized ${tooname} wich contains the string "blumblum"
Then
When i do this simple instruction in my code
/echo ${NearestSpawn[pc ${tooname}]}
=> it returns null
if i don't use a variable but i put directly my toon name in the NearestSpawn tlo, it works perfectly
/echo ${NearestSpawn[pc ${blumblum}]}
Why i want to use this :
I make a script where i catch a tell to my cleric, get the teller name, catch his ID, then i target him through his ID. (and then i can buff him, heal him whatever).
So i use the NearestSpawn fonction, because it has a .ID attribute
And well, because of the bug i explained below, it doesn't work.
The only workaround i have is something like this
(code may be messy, i'm writing it from work, and i'm still a mq2 newbie)
Macro
Thu May 12, 2011 9:36 am
Troubleshooting something when the actual code is not posted is not something I spend time on. post the exact code you are having a problem with and I'll troubleshoot it.
Based on what you posted the first time, the code I posted above works just fine. copy it and paste it into a file called test.mac and then run it, you will see it returns OK/KO correctly.
_________________
Sorvani
Based on what you posted the first time, the code I posted above works just fine. copy it and paste it into a file called test.mac and then run it, you will see it returns OK/KO correctly.
_________________
Sorvani
Thu May 12, 2011 9:44 am
Senior Project Member
There is no reason to target by ID if you don't start the routine with the ID. Either way you have to search for the ID, either in the /target command, or in the Spawn/NearestSpawn object.
You could use Nearest Spawn to gather the ID of the teller, and then use that ID in the target command, like this:
/varset TellerID ${Spawn[PC Blumblum].ID}
/target ID ${TellerID}
but how is that different from:
/target ID ${Spawn[PC Blumblum].ID}
and then, how is that different than:
/target PC Blumblum
If you are getting the teller's name, then using the search string "PC Blumblum" in the spawn object the resultant spawn you get is the same resulting spawn you get from using the same exact search string with the /target command. They both call the same routine within the MQ code. So you are effectively taking a name, casting it to a spawn (with the Spawn object), then casting that to an ID (with the .ID property), then casting that back to a spawn (with the target command).
You could use Nearest Spawn to gather the ID of the teller, and then use that ID in the target command, like this:
/varset TellerID ${Spawn[PC Blumblum].ID}
/target ID ${TellerID}
but how is that different from:
/target ID ${Spawn[PC Blumblum].ID}
and then, how is that different than:
/target PC Blumblum
If you are getting the teller's name, then using the search string "PC Blumblum" in the spawn object the resultant spawn you get is the same resulting spawn you get from using the same exact search string with the /target command. They both call the same routine within the MQ code. So you are effectively taking a name, casting it to a spawn (with the Spawn object), then casting that to an ID (with the .ID property), then casting that back to a spawn (with the target command).
Macro
Thu May 12, 2011 9:55 am
Project Lead
OK my bad i'll put the whole code
I'm using this macro afcleric, i founded there http://www.macroquest2.com/phpBB3/viewtopic.php?f=43&t=7567
It's the first time i try to use a macro, and of course, it doesnt' work (wouldn't be fun, would be ? :p)
What does not work is the buffing part : you send a tell to the cleric, it targets you, then buff you.
The target part doesn't work, on my PC.
I try to isolate the issue, and , after debugging through some /echo, i founded that the macro bugged in this sub function
This line : /if (!${NearestSpawn[${counter}, pc ${name}].ID}) /return NOT_FOUND
always return the NOT_FOUND, whatever i do.
My cleric is like at a distance of 10 from my monk blumblum, in POT.
So it should work....
I spend like 3 hours trying many things, and came to the conclusion that the issue came from the NearestSpawn fonction, who doesn't like the ${name}. As Sorvani suggested, i change the variable Name, because it could be a reserved keyword. Doesn't solve the issue.
I'm not sure of my explanation, really i'm a newbie
Since it doesn't work, at leat on my PC, i'm trying to redo this sub with something similar :)
I'm using this macro afcleric, i founded there http://www.macroquest2.com/phpBB3/viewtopic.php?f=43&t=7567
It's the first time i try to use a macro, and of course, it doesnt' work (wouldn't be fun, would be ? :p)
What does not work is the buffing part : you send a tell to the cleric, it targets you, then buff you.
The target part doesn't work, on my PC.
I try to isolate the issue, and , after debugging through some /echo, i founded that the macro bugged in this sub function
Macro
This line : /if (!${NearestSpawn[${counter}, pc ${name}].ID}) /return NOT_FOUND
always return the NOT_FOUND, whatever i do.
My cleric is like at a distance of 10 from my monk blumblum, in POT.
So it should work....
I spend like 3 hours trying many things, and came to the conclusion that the issue came from the NearestSpawn fonction, who doesn't like the ${name}. As Sorvani suggested, i change the variable Name, because it could be a reserved keyword. Doesn't solve the issue.
I'm not sure of my explanation, really i'm a newbie
Since it doesn't work, at leat on my PC, i'm trying to redo this sub with something similar :)
Thu May 12, 2011 10:19 am
That code matches the version I posted and happens to be the cleric macro I use most of the time. I keep saying I'm going to write my own but i never have done it yet.
I use the UF client now, and I previously used the SoD client with this macro.
I honestly can not remember if I used this macro on the Titanium client.
Here is what mine looks like.
_________________
Sorvani
I use the UF client now, and I previously used the SoD client with this macro.
I honestly can not remember if I used this macro on the Titanium client.
Here is what mine looks like.
Macro
_________________
Sorvani
Thu May 12, 2011 10:32 am
Senior Project Member
I use the Steam underfoot version too..
Our macro matches, but still it doesn't work for me
So i guess there's something wrong with my environnement (my pc, my MQ2 ini whatever)
Our macro matches, but still it doesn't work for me
So i guess there's something wrong with my environnement (my pc, my MQ2 ini whatever)
Thu May 12, 2011 10:35 am
There are some good macros in the VIP section if you have access.
Thu May 12, 2011 10:51 am
Listen to This Guy
ok 3 more hours trying to understand why the af cleric macro doesn't work )
my conclusion so far is that as soon as my in the EVENT_CHAT part, spawn [${mytoon}]/ NearestSpawn[${mytoon}] don't work, but i don't get why
IF someone is kind enough to test the macro on his pc, with Underfoot client, and underfoot peq release.
To test "the bug", just send /tell mycleric hot me
It will goes into the heal over time buffing, which use the Event_CHAT and FindExactPC, which use NearestSpawn.
I'm pretty sure i missed something obvious
Here is the code Afcleric.mac
And here is the ChatParse.inc
my conclusion so far is that as soon as my in the EVENT_CHAT part, spawn [${mytoon}]/ NearestSpawn[${mytoon}] don't work, but i don't get why
IF someone is kind enough to test the macro on his pc, with Underfoot client, and underfoot peq release.
To test "the bug", just send /tell mycleric hot me
It will goes into the heal over time buffing, which use the Event_CHAT and FindExactPC, which use NearestSpawn.
I'm pretty sure i missed something obvious
Here is the code Afcleric.mac
Macro
And here is the ChatParse.inc
Macro
Fri May 13, 2011 12:20 am
I have already posted a working version of this specific macro
_________________
Sorvani
_________________
Sorvani
Fri May 13, 2011 7:26 am
Senior Project Member
i'll try tonight with your version.
I'm just angry with this one because i can't figure what's not working, and i don't like to capitulate :p
I'm just angry with this one because i can't figure what's not working, and i don't like to capitulate :p
Fri May 13, 2011 7:58 am
I have experienced variables NULL ing out in Event_Chat on UF as well. I don't have the exact code in front of me (sorry sorvani) but I think this would cause the failure on my setup.
The echo line would appear perfect but the tell would fail with "You told ,' is not online at this time.'"
Macro
The echo line would appear perfect but the tell would fail with "You told ,' is not online at this time.'"
Fri May 13, 2011 12:43 pm