Documentation on features and use is complete in the code and the INI file, but here's a quick update for what's new in 1.2:
| - Any or all authentication types may now be used at once in a heirarchical fashion (Password/User/Guild)
| - No more "local/remote" customization; bot will determine which is the case and execute upon it.
| - MGB support added, authenticated against a user list.
| - AA ability buff capability added.
| - CAMP desk feature now authenticates against a user list.
| - Horse checks added
| - Stronger error checking on building the configuration, especially buff and authentication lists.
| - Generalized functions for parsing and indexfind are now used, split into seperate include files
| as they were released for public consumption.
| - Changed undetermined length loop parameters, bot loads much quicker now.
There are now three external dependencies in addition to the buffbitch.ini file which is found in the post beneath this one.
1) spellcast.inc http://macroquest2.com/phpBB2/viewtopic.php?t=5090
2) indexfind.inc http://macroquest2.com/phpBB2/viewtopic.php?t=5138
3) initoarray.inc http://macroquest2.com/phpBB2/viewtopic.php?t=5141
Comments / Questions / Flames always appreciated. Post on the topic here, or PM them to me.
G
EDIT: Some of the $spell(xxx,range) parses under current revisions of MQ are reporting -1 instead of 0, updated code to reflect this.
Code: Select all
| -- BuffBitch.mac
|
| Program by Gumby, except where noted.
| Date: 2/02/2004
| Version: 1.2
|
| Overview:
| BuffBitch is a tell buff bot. It supports multiple features such as:
| * Full configuration via INI file.
| * Buff Aliasing for ease of requests, configurable by the end user
| * Multiple methods of user authentication: Password, individual Username, and Guildtag
| * Support for AA buffs
| * Support for MGB usage
| * Supports Buff Queuing; multiple buffs may be requested by a single tell, or requests
| by multiple users may be handled at the same time.
| * Supports buffs being cast on both requestor or on another player character.
| * Rudimentary chat back options, expansion of this feature is slated for next release (1.3).
| * Uses any spell set; if a requested spell is not available, it will mem the spell, cast it
| and restore the original spell. No more folks yelling about having to remem spells when
| they log back onto their toon; or worse, casting the incorrect spell in a critical situation.
|
| Acknowledgements:
| Plazmic and the other writers/updaters denoted in spellcast.inc, utilized by this script.
| Brat - whom I pillaged much of the buff queuing code from.
|
| General Notes: BuffBitch is designed to be a flexible buff bot in allowing configured individuals
| and guilds to request buffs. I have attempted to make the requests as generic and as
| human-like as possible such that it's not strictly necessary (with the
| exception of Password authorized users) to inform the requesting party that the
| buffing toon is a bot. Tells are parsed for the requisite information that the bot
| needs to service buff requests, and even utterly random yoda-speak if it has the
| aliases, meets the requirements of giving a target if the requester is not the individual
| to be cast upon, and the authentication requirements are met. Any request that does
| not meet the authorization criteria is simply dropped; authorized users will receive
| updates on various errors. The code was written at the request of individuals in an
| end-game raid guild; many of the features included have been designed to support this.
|
| External dependencies: You must have the following include files: spellcast.inc, indexfind.inc, and
| initoarray.inc. All three are found in the Macro Snippets forum, and direct
| URL's to the threads will be posted in message containing this code. Not
| having these files will result in this error:
|
| Error: Couldn't open include file
|
| Usage: /macro buffbitch BotClass where BotClass is one of: cleric, druid, etc. (See INI file)
| NOTE: BotClass is case-insenstive
|
| * ex: /macro buffbitch Druid
| Will load the Druid spells and aliases into the arrays.
|
| Ending: Simply /end, or optionally use the CAMP desk feature enabled through the INI file. The CAMP
| functionality is handled through a user authorization list.
|
| In Game commands: /tell <botname> <password> <aliases> and "<to/on/give> <target>" if applicable
| NOTE: Beyond the /tell <botname> the other parameters may come anywhere in the request
| To specify a target besides the requester, the use of 'to' 'on' or 'give' must preceed
| the target name. Also, to use Guild authentication, the requester must be in the
| same zone as the bot.
|
| USER and GUILD authenticated requests:
| * ex: /tell Bitchname Please buff my group with b9
| Will cast Blessing of the Nine on the requester (group in this case, but bot doesn't identify that)
| * ex: /tell Bitchname Could you give me p9 ds and seasons when mana please?
| Will cast Protection of the Nine, legacy of bracken, prot of seasons on requester
| Me is interpreted to be the requesting toon by the bot for the target.
| * ex: /tell Bitchname cast p9 and seasons on CheekyMonkey
| Will cast 9 and prot of seasons on CheekyMonkey
| Either 'to' or 'give' could've replaced 'on' in this example with the same result.
|
| PASSWORD authenticated requests: (gibb0r is the password in each eample)
| * ex: /tell Bitchname hey, gibb0r voq and vallons
| Will cast Voice of Quellious and Vallon's Quickening on the requester
| * ex: /tell Bitchname hey, gibb0r god voq to CheekyMonkey
| Will cast Guard of Druzzil and Voice of Quellious on CheekyMonkey
| * ex: /tell Bitchname howdy, gibb0r voq and sex to me
| Will cast Voice of QUellious on the requesting user.
|
| Any unathorized request (by any of the authentication models), the bot will drop the request.
| Case of aliases won't matter as long as you leave the aliases in lowercase in the INI file. Extraneous
| words such as 'sex' in the last example, will be ignored by the bot as it only looks for instances
| of Password (if needed), buff aliases, and to/on/give Target.
|
| Guild tags and User names are authenticated by the bot (again, one must be in the same zone as the bot if
| you are requesting an authentication based upon Guild tag). The lists are configured in the INI
| file, and INI customization notes are documented in the INI file itself. This script was written
| at the request of some endgame characters and the defacto buff lists reflect that. Want the bot
| to buff your friends and guildmates twinks, simply list the spells and the aliases you
| want and party on. If you want to go through the grunt work of listing out more spells for each
| class in the INI file, and then send them to me in a PM on the forums, please feel free to :).
|
| Limited debug functionality may be enabled by changing the /varset DebugFlag to 1. This is useful
| for diagnosing issues which come up either in array parses, or INI configuration issues. There's an
| option to enable this in the indexfind and initoarray include files as well; however, when testing the
| full script, I suggest you leave those turned off as they're called repeated times and you'll
| have to wade through an excessive amount of spam. Much is duplicated in the debug spewed by BuffBitch.
|
| Code History
|
| version 1.2 2/02/2004 Feature Update
| - Any or all authentication types may now be used at once in a heirarchical fashion (Password/User/Guild)
| - No more "local/remote" customization; bot will determine which is the case and execute upon it.
| - MGB support added, authenticated against a user list.
| - AA ability buff capability added.
| - CAMP desk feature now authenticates against a user list.
| - Horse checks added
| - Stronger error checking on building the configuration, especially buff and authentication lists.
| - Generalized functions for parsing and indexfind are now used, split into seperate include files
| as they were released for public consumption.
| - Changed undetermined length loop parameters, bot loads much quicker now.
|
| version 1.1 1/28/2004 Feature Update
| - Added support for multiple authentication types. -- Changed in 1.2
| - Configurable Local or Remote operation. -- Deprecated 1.2
| - Added ChatText parsing. Password, buff aliases, on/to Target can now be placed anywhere
| in the /tell request sent to the bot. Extra overhead but this cuts down on number of requests,
| and also at first glance, makes the toon seem less botlike. As with standard MQ etiquette,
| the fewer people who know it's botted the better.
|
| version 1.0 1/26/2004 Initial Features
| - Password authentication rather than single master or defined user lists -- Changed in 1.1
| - Requests given through /tell
| - Queues Buff requests.
| - Supports Buff Aliases through an INI file, customized to anything the enduser wants.
| - Uses a single spell gem, and returns the gem to the original spell after casting.
| - Basic chat-back to the requesting user on errors (assuming valid authentication).
| - Bot simply ignores those who issue invalid requests.
| - Camp out feature. -- updated 1.2
|
| Caveats:
| - Uses spellcast.inc, there's a /sendkey up up, /sendkey down up on the call. Useful for combat,
| not applicable in this routine. If you wish to execute this script in the background with
| the default spellcast.inc, since /sendkey requires window focus, you will need to run EQW.
| If you do not want to run EQW, simply comment out the two /sendkey's in spellcast.inc,
| save as a different filename, and change the below #include line to whatever the new filename is
| rather than spellcast.inc. Do this so you don't break other scripts you may be using which
| rely on this functionality.
|
| As always, if you run into issues with this macro, or would like to request added functionality,
| please feel free to comment to me either on the forum in the Macro Depot in the code's posting,
| or via a PM on the forums.
#include spellcast.inc
#include indexfind.inc
#include initoarray.inc
#chat tell
#turbo
Sub Main
| *************** Global Declares *********** |
/declare BotClass global
/declare IniFile global
/declare DebugFlag global
/declare BuffList array
/declare BuffAlias array
/declare BuffQueue array
/declare BuffTargetID array
/declare BuffRequester array
/declare BuffReqNum global
/declare BuffMGB array
/declare Password global
/declare BuffAuthList array
/declare MaxAuthIndex global
/declare MaxAliasIndex global
/declare TempOptions array
/declare SpellDB array
/declare MGBSupport global
/declare MGBAuthList array
/declare CAMPSupport global
/declare CAMPAuthList array
/declare CAMPString global
| *************** Debug Bock **************** |
| This parameter enables debugging in the global script, 0 disabled, 1 enabled.
| IndexFind and INI Parsing debug flags have been moved to the included files
/varset DebugFlag 0
| *************** Chat Back Block *********** |
| I recommend you configure these by changing the varsets
| Consolidates room here, v 1.3 slated to INI base these with multiple responses
| in a pseudo humanization routine
/declare OORMessage global
/declare OOMMessage global
/declare CANTSEEMessage global
/declare NOTINZONEMessage global
/varset OORMessage "The target is OOR, please request again later"
/varset OOMMessage "I am OOM, I will cast when I have mana available"
/varset CANTSEEMessage "I can't see the target, please request again later"
/varset NOTINZONEMessage "Target isn't in the zone for me to buff"
| *************** Main Code start *********** |
/varset IniFile buffbitch.ini
/varset BuffReqNum 0
/varset Password ""
/if $defined(Param0)==TRUE {
/varset BotClass $lcase(@Param0)
} else {
/echo BotClass undefined, exiting
/end
}
/echo Loading BuffBitch v 1.2 by Gumby
/echo I will be serving the @BotClass spells
/call BuildBuffList
/varset MaxAliasIndex $return
/call BuildOptions
/echo BuffBitch loaded
/if ("$char(mounted)"=="FALSE" && "$char(state)"!="SIT") /sit
:Wait
/doevents
/delay 10
/if n @BuffReqNum>0 /call DoBuffs
/delay 100
/goto :Wait
/return
| *************** Subroutines *************** |
| ******* ParseString *******
| Parses through a space delimited text message(SearchText) for a specific
| word (SearchWord), and returns the position ($arg value) of the word. If the word is
| not found, it returns -1.
Sub ParseString(SearchWord,SearchText)
/declare ParseCounter local
/if n @DebugFlag==1 {
/echo Searching for @SearchWord
/echo In @SearchText
}
/varset ParseCounter 1
:StartParseString
/if "$arg(@ParseCounter,"@SearchText")"=="@SearchWord" /goto :EndParseString
/if "$arg(@ParseCounter,"@SearchText")"=="" {
/return -1
}
/varadd ParseCounter 1
/goto :StartParseString
:EndParseString
/return @ParseCounter
| ******* DoBuffs *******
| Handles the spell setup and makes call to spellcast.inc
Sub DoBuffs
/declare StatusUpdateCounter local
/declare OriginalSpell local
/declare Ability local
/varset OriginalSpell "$char(gem,8)"
/if n @DebugFlag==1 {
/echo BuffReqNum is @BuffReqNum
/echo OriginalSpell is @OriginalSpell
}
:DoBuffLoop
/if n @BuffReqNum==0 {
/if ("$char(mounted)"=="FALSE" && "$char(state)"!="SIT") /sit
/delay 2
/if "$char(gem,8)"!="@OriginalSpell" {
/mem 8 "@OriginalSpell"
/delay 40
}
/return
}
/varsub BuffReqNum 1
/echo @BuffQueue(@BuffReqNum)
| Ran across a spell during testing which didn't have range info, next check is a result of it
/if n $spell("@BuffQueue(@BuffReqNum)",range)<=0 {
/goto :BrokenRangeInfo
}
/if n $spell("@BuffQueue(@BuffReqNum)",range)<$spawn(@BuffTargetID(@BuffReqNum),distance) {
/if n @BuffMGB(@BuffReqNum)==0 {
/tell @BuffRequester(@BuffReqNum) @OORMessage
/goto :BuffEnd
}
}
:BrokenRangeInfo
/target id @BuffTargetID(@BuffReqNum)
/if n $char(gem,"@BuffQueue(@BuffReqNum)")==0 {
/mem 8 "@BuffQueue(@BuffReqNum)"
/delay 40
}
/if ("$char(mounted)"=="FALSE" && "$char(state)"!="STAND") /stand
/if n @DebugFlag==1 {
/echo calling Cast "@BuffQueue(@BuffReqNum)"
}
/if n @BuffMGB(@BuffReqNum)==1 {
/echo This spell, @BuffQueue(@BuffReqNum) will be MGBed
/alt activate 35
}
/if "$left(2,"@BuffQueue(@BuffReqNum)")"=="AA" {
/varset Ability $right($calc($strlen("@BuffQueue(@BuffReqNum)")-2),"@BuffQueue(@BuffReqNum)")
/alt activate @Ability
/goto :BuffEnd
}
/call Cast "@BuffQueue(@BuffReqNum)"
/if "$return"=="CAST_OUTOFMANA" {
/if ("$char(mounted)"=="FALSE" && "$char(state)"!="SIT") /sit
/for StatusUpdateCounter 0 to @BuffReqNum
/tell @BuffRequester(@StatusUpdateCounter) @OOMMessage
/next StatusUpdateCounter
/delay 600
/goto :DoBuffLoop
}
/if "$return"=="CAST_OUTOFRANGE" {
/tell @BuffRequester(@BuffReqNum) @OORMessage
}
/if "$return"=="CAST_CANNOTSEE" {
/tell @BuffRequester(@BuffReqNum) @CANTSEEMessage
}
:BuffEnd
/varset BuffTargetID(@BuffReqNum) 0
/goto :DoBuffLoop
/return
| ******* BuildBuffList *******
| Builds the arrays for the Buffs and Aliases from the [BotClass] heading information in INI file
Sub BuildBuffList
/declare SpellDBIndex local
/declare BuffBuildIndex local
/declare BuildCounter local
/declare DebugCounter local
/varset SpellDBIndex 0
/varset BuffBuildIndex 0
| Read Spells in from [BotClass]
/call INIToArray SpellDB "@IniFile" "@BotClass"
/if n $return<0 {
/echo SpellDB build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: SpellDB
/echo INIFileName: @IniFile
/echo INIHeaderName: @BotClass
/echo INIKeyName: <not used>
/if n $return==-1 /echo No spells were listed for the configured class
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
| Get Spell Aliases for spells, and assign them to Spell Names in the arrays
:StartBuildBuff
/if "@SpellDB(@SpellDBIndex)"=="UNDEFINED-ARRAY-ELEMENT" /goto :EndBuildBuff
/call INIToArray BuffAlias "@IniFile" "@BotClass" "@SpellDB(@SpellDBIndex)"
/if n $return<0 {
/echo BuffAlias build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: BuffAlias
/echo INIFileName: @IniFile
/echo INIHeaderName: @BotClass
/echo INIKeyName: @SpellDB(@SpellDBIndex)
/if n $return==-1 /echo No Aliases were found for the listed spell
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
:StartBuffList
/if "@BuffAlias(@BuffBuildIndex)"=="UNDEFINED-ARRAY-ELEMENT" /goto :EndBuffList
/varset BuffList(@BuffBuildIndex) "@SpellDB(@SpellDBIndex)"
/varadd BuffBuildIndex 1
/goto :StartBuffList
:EndBuffList
/varadd SpellDBIndex 1
/goto :StartBuildBuff
:EndBuildBuff
/varsub BuffBuildIndex 1
| Debug dump and information
/if n @DebugFlag==1 {
/echo BuffList and BuffAlias built
/echo Number of total aliases is $calc(@BuffBuildIndex+1)
/echo ******* Full Dump of Buff Arrays *******
/for DebugCounter 0 to @BuffBuildIndex
/echo spell @BuffList(@DebugCounter) alias @BuffAlias(@DebugCounter)
/next DebugCounter
}
/return @BuffBuildIndex
| ******* BuildOptions *******
| Builds [Options] from the INI file, bot configuration done in this subroutine.
Sub BuildOptions
/declare OptionsIndex local
/declare DebugCounter local
/varset OptionsIndex 0
| Request Authorization Types
/call INIToArray TempOptions "@IniFile" "Options" "AuthType"
/if n $return<0 {
/echo BuffAlias build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: TempOptions
/echo INIFileName: @IniFile
/echo INIHeaderName: Options
/echo INIKeyName: AuthType
/if n $return==-1 /echo No Authentication Types are configured
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
| Get Password and Build Authentication Array
:StartBuildAuth
/if "@TempOptions(@OptionsIndex)"=="UNDEFINED-ARRAY-ELEMENT" /goto :EndBuildAuth
/if "@TempOptions(@OptionsIndex)"=="Password" {
/varset Password $ini("@IniFile","Options","@TempOptions(@OptionsIndex)")
/if "@Password"=="" {
/echo You must supply a password to use Password Authentication, exiting
/end
}
} else {
/call INIToArray BuffAuthList "@IniFile" "Options" "@TempOptions(@OptionsIndex)"
/if n $return<0 {
/echo BuffAuthList build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: BuffAuthList
/echo INIFileName: @IniFile
/echo INIHeaderName: Options
/echo INIKeyName: @TempOptions(@OptionsIndex)
/if n $return==-1 /echo User/Guild support enabled, but not configured
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
}
/varadd OptionsIndex 1
/goto :StartBuildAuth
:EndBuildAuth
/varset MaxAuthIndex $return
| Determine and build MGB functionality support
/varset MGBSupport $ini("@IniFile","Options","MGBSupport")
/if n @MGBSupport==1 {
/call INIToArray MGBAuthList "@IniFile" "Options" "MGBAuthList"
/if n $return<0 {
/echo MGBAuthList build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: MGBAuthList
/echo INIFileName: @IniFile
/echo INIHeaderName: Options
/echo INIKeyName: MGBAuthList
/if n $return==-1 /echo MGB Support enabled but no users defined
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
}
| Determine and build Camp Desk functionality support
/varset CAMPSupport $ini("@IniFile","Options","CAMPSupport")
/if n @CAMPSupport==1 {
/varset CAMPString $ini("@IniFile","Options","CAMPString")
/if "@CAMPString"=="" {
/echo CAMP Support configured, but no CAMPString supplied. Ending...
/end
}
/call INIToArray CAMPAuthList "@IniFile" "Options" "CAMPAuthList"
/if n $return<0 {
/echo CAMPAuthList build: INI File configuration or call incorrect
/if n @DebugFlag==1 {
/echo INIToArray was called with the following parameters:
/echo ArrayName: CAMPAuthList
/echo INIFileName: @IniFile
/echo INIHeaderName: Options
/echo INIKeyName: CampAuthList
/if n $return==-1 /echo CAMP Support configured but no users defined
/if n $return==-2 /echo ArrayName not passed
/if n $return==-3 /echo INIFileName not passed
/if n $return==-4 /echo Invalid Array passed
/if n $return==-5 /echo The INI File/Header/Key combination is invalid
}
/echo Ending...
/end
}
}
| Debug data dumps and information
/if n @DebugFlag==1 {
/echo BuffAuthList built
/echo Number of total authorized names (guild or users) is @MaxAuthIndex
/echo ******* Full Dump of Buff Auth Array *******
/for DebugCounter 0 to @MaxAuthIndex
/echo AuthName @BuffAuthList(@DebugCounter)
/next DebugCounter
/if n @MGBSupport==0 {
/echo MGB Support not enabled
} else {
/echo MGB Support enabled
/echo ******* Full Dump of MGB Auth Array *******
/varset DebugCounter 0
:StartMGBDump
/if "@MGBAuthList(@DebugCounter)"=="UNDEFINED-ARRAY-ELEMENT" {
/goto :EndMGBDump
}
/echo MGB Authorized User: @MGBAuthList(@DebugCounter)
/varadd DebugCounter 1
/goto :StartMGBDump
:EndMGBDump
}
/if n @CAMPSupport==0 {
/echo CAMP Support not enabled
} else {
/echo CAMP Support enabled, with @CAMPString to call
/echo ******* Full Dump of CAMP Auth Array *******
/varset DebugCounter 0
:StartCAMPDump
/if "@CAMPAuthList(@DebugCounter)"=="UNDEFINED-ARRAY-ELEMENT" {
/goto :EndCAMPDump
}
/echo CAMP Authorized User: @CAMPAuthList(@DebugCounter)
/varadd DebugCounter 1
/goto :StartCAMPDump
:EndCAMPDump
}
}
/return
| ******* Chat Event *******
| Standard chat driven event format called by /doevents.
| The code validates the request, determines the target and tosses the BuffRequest onto the queue if
| valid. This interface also handles the CAMP functionality which allows designated users to
| force the bot to log off if someone else needs to get on the toon.
Sub Event_Chat(ChatType,Sender,ChatText)
/declare Target local
/declare RequestIndex local
/declare DebugIndex local
/declare DebugCounter local
/declare GuildTag local
/declare ParseAliasCounter local
/declare MGBUse local
| CAMP Support code
/if (n @CAMPSupport==1 && "@ChatText"=="@CAMPString") {
/echo CAMP Request valid, camping...
/if "$char(mounted)"=="TRUE" {
/dism
/delay 10
}
/if "$char(state)"!="SIT" /sit
/delay 10
/camp desktop
/delay 200
/end
}
| Authentication Check:
| New integrated check, heirarchical order: Password, User, Guild if any are enabled
/if "@Password"!="" {
/if "@ChatText"~~"@Password" {
/if n @DebugFlag==1 /echo Sender validated by Password
/goto :EndAuthentication
}
}
/call IndexFind BuffAuthList @Sender
/if $return>=0 {
/if n @DebugFlag==1 /echo Sender validated by User
/goto :EndAuthentication
}
/varset GuildTag "$spawn($searchspawn(pc,@Sender),guild)"
/call IndexFind BuffAuthList "@GuildTag"
/if $return>=0 {
/if n @DebugFlag==1 /echo Sender validated by Guild
/goto :EndAuthentication
}
| Failed authentication return, request dropped
/echo Request for buff was not authenticated, not adding to queue
/return
| Authentication valid, now determine target
:EndAuthentication
/if "@ChatText"~~"to" {
/call ParseString "to" "@ChatText"
/if n $return>0 {
/varset Target $arg($calc($return+1),"@ChatText")
/if "@Target"=="me" {
/varset Target @Sender
}
/if n $searchspawn(pc,@Target)!=0 {
/goto :EndTarget
} else {
/tell @Sender @NOTINZONEMessage
}
}
}
/if "@ChatText"~~"on" {
/call ParseString "on" "@ChatText"
/if n $return>0 {
/varset Target $arg($calc($return+1),"@ChatText")
/if "@Target"=="me" {
/varset Target @Sender
}
/if n $searchspawn(pc,@Target)!=0 {
/goto :EndTarget
} else {
/tell @Sender @NOTINZONEMessage
/return
}
}
}
/if "@ChatText"~~"give" {
/call ParseString "give" "@ChatText"
/if n $return>0 {
/varset Target $arg($calc($return+1),"@ChatText")
/if "@Target"=="me" {
/varset Target @Sender
}
/if n $searchspawn(pc,@Target)!=0 {
/goto :EndTarget
} else {
/tell @Sender @NOTINZONEMessage
/return
}
}
}
/varset Target @Sender
/if n $searchspawn(pc,@Target)!=0 {
/goto :EndTarget
} else {
/tell @Sender @NOTINZONEMessage
/return
}
:EndTarget
/if n @DebugFlag==1 /echo Target is @Target
| Target verified, quick check for MGB
/varset MGBUse 0
/if ("@ChatText"~~"mgb" || "@ChatText"~~"MGB") {
/call IndexFind MGBAuthList @Sender
/if $return=>0 {
/varset MGBUse 1
} else {
/return
}
}
| Parse request for Aliases
/for ParseAliasCounter 0 to @MaxAliasIndex
/if "@ChatText"~~"@BuffAlias(@ParseAliasCounter)" {
/varset BuffTargetID(@BuffReqNum) $searchspawn(pc,@Target)
/varset BuffQueue(@BuffReqNum) "@BuffList(@ParseAliasCounter)"
/varset BuffRequester(@BuffReqNum) @Sender
/varset BuffMGB(@BuffReqNum) @MGBUse
/echo @BuffRequester(@BuffReqNum) successfully requested
/echo @BuffQueue(@BuffReqNum) to be cast on $spawn(@BuffTargetID(@BuffReqNum),name)
/varadd BuffReqNum 1
/if n @DebugFlag==1 {
/varset DebugIndex $calc(@BuffReqNum-1)
/echo who's spawn ID is @BuffTargetID(@DebugIndex) with a buff
/echo alias of @BuffAlias(@ParseAliasCounter) found at Index @ParseAliasCounter.
/if n @MGBUse==1 /echo This is a MGB Buff request
}
}
/next ParseAliasCounter
/return


