auto tl macro

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

auto tl macro

Post by weezurd » Sat Jan 08, 2005 1:51 am

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

missingfiles
a hill giant
a hill giant
Posts: 224
Joined: Wed Jun 09, 2004 1:15 pm

Post by missingfiles » Sat Jan 08, 2005 2:28 am

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?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 4:46 am

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.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

Post by weezurd » Sat Jan 08, 2005 1:14 pm

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.

JJ
a hill giant
a hill giant
Posts: 227
Joined: Thu Nov 11, 2004 5:50 am

Check your chat window

Post by JJ » Sat Jan 08, 2005 2:13 pm

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.

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 5:05 pm

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.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 5:07 pm

Yeah, and make sure all bases are covered before casting like Me.SpellReady, !Me.Casting, etc
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

Post by weezurd » Sat Jan 08, 2005 5:21 pm

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 


A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 5:32 pm

After the target requestor, put:

Code: Select all

/delay 1s ${Target.ID}==${RequestorID}
And at the top:

Code: Select all

/declare RequestorID int outer
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.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

Post by weezurd » Sat Jan 08, 2005 5:45 pm

will give it a try.

thanks for the help

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 5:45 pm

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
Last edited by A_Druid_00 on Sat Jan 08, 2005 5:49 pm, edited 1 time in total.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

Post by weezurd » Sat Jan 08, 2005 5:47 pm

would doing this eliminate the need for the else with the 10s delay?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 5:49 pm

Yes, it would
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

weezurd
orc pawn
orc pawn
Posts: 19
Joined: Sat Jan 08, 2005 1:38 am

Post by weezurd » Sat Jan 08, 2005 5:52 pm

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

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sat Jan 08, 2005 6:13 pm

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.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]