Code is about 90% taken from Jerles RH mac, but im trying to make it so i can use it with any macro, and yes i know it would prolly be better as a plugin by my programmings skills are still very weak.
Now the "/" commands work whenever the macro isn't preforming a task (i.e. if included in stick.mac as long as the bot isn't attacking anything, the "/" commands work)
If anyone has any way to help, any info is appreciated.
Code: Select all
//1- at the top of your macro put #include slash.inc
//2- Below Sub Main put /echo Slash
#Chat tell
#Event DoEvent "[MQ2] Slash"
#Event AddMaster "[MQ2] AddMaster#*#"
#Event RemMaster "[MQ2] RemoveMaster#*#"
#Event SetVerbosity "[MQ2] SetVerbosity#*#"
#Event SetChannel "[MQ2] SetChannel#*#"
Sub Event_DoEvent
/declare lastevent string outer None
/declare verbosity int outer 2
/declare channel string outer echo
/declare d int outer
/if (${verbosity}>=0) /${channel} Setting Aliases...
/squelch /alias /addmaster /echo AddMaster
/squelch /alias /remmaster /echo RemoveMaster
/squelch /alias /verbosity /echo SetVerbosity
/squelch /alias /channel /echo SetChannel
/if (${Ini[SlashCommands.ini,General,Verbosity].NotEqual[NULL]}) /varset verbosity ${Ini[SlashCommand.ini,General,Verbosity]}
/if (${Ini[SlashCommand.ini,General,Channel].NotEqual[NULL]}) /varset channel ${Ini[SlashCommand.ini,General,Channel]}
/if (!${Ini[SlashCommand.ini,Masters,Controller1].Length}) {
|- It's not in there yet
/for d 1 to 20
/ini "SlashCommand.ini" "Masters" "Controller${i}" "Nobody"
/next d
}
/return
Sub Event_AddMaster(string Line)
/varset lastevent Event_AddMaster
/declare index int local
/if (${Line.Arg[3].Length}) {
/for index 1 to 20
/if (${Ini[SlashCommand.ini,Masters,Controller${index}].Equal[Nobody]}) {
/ini "SlashCommand.ini" "Masters" "Controller${index}" "${Line.Arg[3]}"
/if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} added as a controller...
/goto :FallOut
}
/next index
/if (${verbosity}>=0) /${channel} ** Master controller slots all filled! Get rid of some!
} else {
/if (${verbosity}>=0) /${channel} ** Huh?
}
:FallOut
/return
Sub Event_RemMaster(string Line)
/varset lastevent Event_RemMaster
/declare index int local
/if (${Line.Arg[3].Length}) {
/for index 1 to 20
/if (${Ini[SlashCommand.ini,Masters,Controller${index}].Equal[${Line.Arg[3]}]}) {
/ini "SlashCommand.ini" "Masters" "Controller${index}" "Nobody"
/if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} removed from controller list...
/goto :FallOut
}
/next index
/if (${verbosity}>=0) /${channel} ** Can't find ${Line.Arg[3]} in access list!
} else {
/if (${verbosity}>=0) /${channel} ** Huh?
}
:FallOut
/return
Sub Event_Chat(ChatType, Sender, ChatText)
/varset lastevent Event_Chat
|- Authenticate if valid controller
/declare authorized bool local FALSE
/for d 1 to 20
/if (${Ini[SlashCommand.ini,Masters,Controller${d}].Equal[${Sender}]}) /varset authorized TRUE
/next d
/if (${authorized} && ${ChatText.Left[1].Equal[/]}) {
/if (${verbosity}>=1) /${channel} ** User ${Sender} Authenticated!
/if (${verbosity}>=0) /${channel} Doing: "${ChatText}"
/if (${Me.AFK}) /delay 2s
/tell ${Sender} As you wish, i will now: ${ChatText}
/delay 2s
/docommand ${ChatText}
}
/return


