Public Macros Delayed Talk macro
Reply
Delayed Talk macro
Edit 09/02/2010: Added lots of comments, corrected hail channel logic to ignore text, and fixed initial delay timer.

Here is something that I use almost every day.

Sometimes you run into an NPC that can not do everything at once when your group tries to say commands like:
More +

/bcaa //hail
/bcaa //say blessed

I wrote this to get around that problem without making multiline hotkeys or switching screens.


Macro
More +

|delaytalk.mac
|
|       Written by: Sorvani (Koro on PEQ TGC)
|       Last Modified: 09/02/2010
|
| This macro will delay speak something with all members of your group.
| Obviously if you are trying to set the delay to 0 seconds you do not need this macro,
| just use /bcaa //say BLAH BLAH BLAH
|
| Parameter 1: Delay in seconds between target command and character's speech
| Parameter 2: channel to use (say g gu ttell)
| Parameter 3-7: text to say. If the text is more than five words surround it in quotes. example: "Please bind my soul you sexy NPC"
|                If you say more than 5 words without quoting it, it WILL truncate your phrase to 5 words.
| USAGE
| If you have Rytan targeted in Gloomingdeep, the above command would get him to buff your entire party.
| /macro delaytalk.mac 1 say blessed
|
| Have soul binder bind you.
| /macro delaytalk.mac 1 say bind my soul
|
| useful for player created buff bots have your team /ttell your target
| /macro delaytalk.mac 10 ttell ds
|
| i recommend creating an alias for your most common usages such as 1 second in /say.
| /alias /dt1 /mac delaytalk 1 say
| now /dt1 blessed would replace the above example for Rytan
|
| This next one I use to stagger my hails so I can what the bot screens more closely for
| the character flag text or whatever event the hail is supposed to cause.
| /alias /dh /mac delaytalk 1 hail


|Set these two constants to whatever channels you prefer to use.
|Some people like /bc instead of bct, but it works the same either way.
#define ERR_CHAN "/echo"
#define CMD_CHAN "/bct"

Sub Main
        /declare GroupLoop int local 0
        /declare TargetID int local ${Target.ID}
        /declare TargetDelay string local
        /declare TalkChan string local
        /declare TalkThis string local
        /declare TalkPerson string local

        /if (!${TargetID}) {
                ERR_CHAN you must have a target before using this macro, exiting ${Macro.Name}.
                /return
        }
       
        /if (${Defined[Param0]}) {    
                /vardata TargetDelay Param0
                /if (${TargetDelay}==0) {
                        ERR_CHAN RTFM please. You know, all that text at the top of the macro...
                }
        } else {
                |delay between each character was not speicifed, inform user and exit
                ERR_CHAN No delay specified, exiting ${Macro.Name}.
                /return
        }      

        /if (${Defined[Param1]}) {
                /vardata TalkChan Param1
        } else {
                |channel to use was not specified, inform user and exit
                ERR_CHAN No talk channel specified, exiting ${Macro.Name}.
                /return
        }

        |if the talk channel was hail then no other text will be used
        /if (!${TalkChan.Equal[hail]}) {
                |if the talk channel was anything else, then accept up to 5 unquoted words as the text to say
                /if (${Defined[Param6]}) {
                        /varset TalkThis ${Param2} ${Param3} ${Param4} ${Param5} ${Param6}
                } else /if (${Defined[Param5]}) {
                        /varset TalkThis ${Param2} ${Param3} ${Param4} ${Param5}
                } else /if (${Defined[Param4]}) {
                        /varset TalkThis ${Param2} ${Param3} ${Param4}
                } else /if (${Defined[Param3]}) {
                        /varset TalkThis ${Param2} ${Param3}
                } else /if (${Defined[Param2]}) {
                        /varset TalkThis ${Param2}
                } else {
                        |nothing to say was specified, inform user and exit
                        ERR_CHAN No talk text specified, exiting ${Macro.Name}.
                        /return
                }
        }

        |the loop counts backwards to ensure the person running the macro doesn't zone first
        |as a result of the command or some other such event.
        |/mac delaytalk say Nedaria would break if the person running the macro zoned first.
        /for GroupLoop ${Group.Members} downto 0
                |Get the name of the group memeber who will be speaking
                /vardata TalkPerson Group.Member[${GroupLoop}].Name
                |clear that group member's current target
                CMD_CHAN ${TalkPerson} //squelch /target clear
                |quick delay for gui
                /delay 1
                |have the group member target the macro user's target
                CMD_CHAN ${TalkPerson} //target ID ${TargetID}
                |If this is the first person in the macro, no need to delay the full delay.
                |just wait 1s for target aquisition. The point of the full delay  is to wait
                |for the target to finish doing whatever they do in response to your text,
                |the delay is not just for targeting purposes.
                /if (${GroupLoop}==${Group.Members}) {
                        /delay 1s
                } else {
                        /delay ${TargetDelay}s
                }
                |have the group member speak the text to the targeted NPC/PC
                CMD_CHAN ${TalkPerson} //${TalkChan} ${TalkThis}
        /next GroupLoop
/return

_________________
Sorvani
Mon Aug 30, 2010 10:51 am
Senior Project Member
Public Macros Delayed Talk macro
Reply