Page 1 of 3
auto tl macro
Posted: Sat Jan 08, 2005 1:51 am
by weezurd
hello. i am trying to write a macro that will tl anyone around you that hails you, but i am running into a slight problem. i am not experienced in macro writing and am not sure how to go about this.
my problem is this, if more then one person hails at the same time or before the macro is done tling someone, the macro will skip people for tl's. here is the code and any help or ideas would be greatly appreciated.
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>'"
Sub Main
/echo TL Macro has now started..
/declare transspell string outer "Translocate Spell"
/declare spellgem int outer 9
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl "Translocate: Natimbi"
/end
} else {
/echo You have chosen to use: ${Param0}
/varset transspell ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/target pc ${RequestorName}
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Received a hail from ${RequestorName}, now translocating them.
/call cast "${transspell}" gem9 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
} else {
/call wait
}
/return
Sub wait
:waitloop
/if (${Me.SpellReady["${transspell}"]}) {
/call Event_Hailed
}
/delay 2s
goto :waitloop
/return
thanks again for any help
Posted: Sat Jan 08, 2005 2:28 am
by missingfiles
you could store the names from the hails in a ini or an aray. I rember there is a way in c++ to store names values etc as they are used with out writing them to a file (but I dont know if this works for MQ2 or not)
Have you though of having the macro purge the names requested into a ini then casting it on the players as it goes down the list?
Posted: Sat Jan 08, 2005 4:46 am
by A_Druid_00
http://www.macroquest2.com/phpBB2/viewtopic.php?t=9679
This will TL anyone who sends a tell with the zone name. Are you dead set on TLing to only one location and only when you get hailed?
It's good practice I guess, but I don't want to see you reinventing the wheel when there's already a solid TL mac out there.
Posted: Sat Jan 08, 2005 1:14 pm
by weezurd
i saw that macro, but it doesnt do what i would like it to do. the sole purpose of my macro is to only tl people to a single location that hail me. i have been trying to figure out how to go about doing this by adding each name to an ini file but have not had any luck yet.
Check your chat window
Posted: Sat Jan 08, 2005 2:13 pm
by JJ
Check the window to make sure it doesn't try to get everyone but maybe it says like "haven't recovered yet" or something like that. On my script for my cleric, no matter how many times I tell it to heal/move/cast it will do all the commands in order. I had to add delays in to make sure each command is given and not missed.
Also I would try doing something else other than calling a wait sub then recalling the event_hailed sub after which looks like you are getting into a little unresolved recursion.
Posted: Sat Jan 08, 2005 5:05 pm
by A_Druid_00
Set a timer and a /goto loop, if the action fails to finish before the timer runs out, /return to the main sub and wait for the next hail.
Posted: Sat Jan 08, 2005 5:07 pm
by A_Druid_00
Yeah, and make sure all bases are covered before casting like Me.SpellReady, !Me.Casting, etc
Posted: Sat Jan 08, 2005 5:21 pm
by weezurd
i got rid of the call to the wait sub because that wasnt working and added a 10 second delay. it seems to work but i havent been able to test on a full raid scale.
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>'"
Sub Main
/echo TL Macro has now started..
/declare transspell string outer "Translocate: Natimbi"
/declare spellgem int outer 9
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl "Translocate: Natimbi"
/end
} else {
/echo You have chosen to use: ${Param0}
/varset transspell ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/squelch /target pc ${RequestorName}
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Received a hail from ${RequestorName}, now translocating them.
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
} else {
/delay 10s
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Received a hail from ${RequestorName}, now translocating them.
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
}
/return
Posted: Sat Jan 08, 2005 5:32 pm
by A_Druid_00
After the target requestor, put:
Code: Select all
/delay 1s ${Target.ID}==${RequestorID}
And at the top:
And at the top of Event_Hailed:
Code: Select all
/varset RequestorID ${Spawn[pc ${RequestorName}].ID}
That should do it. It will wait until you have the requestor targetted, and then cast.
Posted: Sat Jan 08, 2005 5:45 pm
by weezurd
will give it a try.
thanks for the help
Posted: Sat Jan 08, 2005 5:45 pm
by A_Druid_00
You should also use /target id ${RequestorID}; or you will end up targetting random shit like corpses, pets, mounts, etc instead of your actual intended target.
Use ID for everthing when possible. The only place using ID won't work is using /assist
Posted: Sat Jan 08, 2005 5:47 pm
by weezurd
would doing this eliminate the need for the else with the 10s delay?
Posted: Sat Jan 08, 2005 5:49 pm
by A_Druid_00
Yes, it would
Posted: Sat Jan 08, 2005 5:52 pm
by weezurd
ok, so here is what i have so far:
Code: Select all
#include spell_routines.inc
#event Hailed "#1# says, 'Hail, <Your-Name-Here>"
Sub Main
/echo TL Macro has now started..
/declare transspell string outer
/declare RequestorID int outer
/declare spellgem int outer 9
/if (!${Defined[Param0]}) {
/echo Error, You must specify the translocate spell you wish to use.
/echo Syntax: /mac tl Natimbi
/end
} else {
/echo You have chosen to use: Translocate: ${Param0}
/varset transspell Translocate: ${Param0}
/if (!${Me.SpellReady["${transspell}"]}) {
/echo Now meming ${transspell}
/memspell ${spellgem} "${transspell}"
}
}
:loop
/doevents
/delay 2s
/goto :loop
Sub Event_Hailed(string line,string RequestorName)
/varset RequestorID ${Spawn[pc ${RequestorName}].ID}
/squelch /target id ${RequestorID}
/delay 1s ${Target.ID}==${RequestorID}
/if (${Me.SpellReady["${transspell}"]}) {
/if (${FindItemCount[Small Portal Fragments]}>0) {
/echo Received a hail from ${RequestorName}, now translocating them.
/call cast "${transspell}" ${spellgem} 1s
} else {
/echo Out of portal fragments, ending macro.
/end
}
}
/return
wish i could test this now but i am not near a computer with eq on it so i hope this will do it
Posted: Sat Jan 08, 2005 6:13 pm
by A_Druid_00
Looks right at a glance. Give it a run and let me know if you get stuck somewhere. I enjoy helping people who take the time to help themselves.