For instance, the following would be a valid Genbot .ini section:
Code: Select all
[Shortcuts]
eyepatch=itemcast Eyepatch of Plunder
nukeit=genbot sn Destruction
sowme=buff spirit of wolf on me
uberaa=/alt activate 33
chcheck=/tell ${MasterName} I have ${Math.Calc[${Me.CurrentMana}/400].Int} CHs left.
takemehome=/echo play:PoKtoNexxus 1 f nopp z;NexxustoBazaar 10 cr nopp z;BazaartoShadHav 1 cf nopp noz Shortcuts give an easy way to abbreviate long commands, like interzone advpaths, and also have some really cool possibility for controlling parties. For instance, you could have you leader say nukeit in groupsay, and each of the PCs in the party could respond with an appropriate nuke as defined in their .ini file. The wizzy Lures it, the enchanter smacks it with his DD+stun, the druid casts wildfire, and the warrior, um, slams it!
Similarly, if you called evacuate, if you set up the .ini's right, the druid could cast his evac, the cleric might automatically heal the druid to make sure he survives, and the warrior could hit AE taunt to pull aggro from the druid. Fun, fun!
To show what commands are available and what they do, I added the shortcuts command. Type "shortcuts" for a list of available shortcuts, and type "shortcuts name_of_shortcut" to see what a particular shortcut does.
--Vexix
Here are the code changes:
I had to change the ExecCommand subroutine in botcore.inc to pick up the new shortcuts. The brown part has been changed:
botcore.inc -- ExecCommand subroutine
Code: Select all
Sub ExecCommand(string CommandText)
/declare CommandLen int local
/declare counter int local
/varset CurrCommand ${CommandText.Arg[1]}
/varcalc CommandLen ${CurrCommand.Length}+1
/if (${CommandText.Length} > ${CommandLen}) {
/varset CommandParam ${CommandText.Right[-${CommandLen}]}
} else {
/varset CommandParam
}
[color=brown] /if (${Defined[cmds-SHORTCUTS]}) {
/if (${String[ ${cmds-SHORTCUTS.Lower} ].Find[ ${CurrCommand.Lower} ]}) {
/call ShortCut "${CommandText}"
}
} [/color]
/for counter 1 to ${TopCommand}
/if (${CurrCommand.Equal[${Commands[1,${counter}]}]}) {
/call ${Commands[2,${counter}]} ${CommandParam}
}
/next counter
/if (${Defined[Toggles]}) {
/for counter 1 to ${TopToggle}
/if (${CurrCommand.Equal[${Toggles[1,${counter}]}]}) {
/call SetToggle ${counter} ${CommandParam}
}
/next counter
}
/return
Code: Select all
|shortcuts.inc
|Module for linking Custom Commands to Character spells and items
|Includes Variable Toggling function as well
|Version 12.31
|Date:05/07/2004 11:00 pm
|
||**
[shortcuts]
version=12.31
**||
Sub Init-Toggles
/declare cmds-TOGGLES string outer Toggles:
|For each Variable that has a TRUE/FALSE State
|Each Command can be toggled by 1/0, TRUE/FALSE, On/Off, Yes/No
|/call AddToggle Command PhraseOff PhraseOn Variable Type
|Command to force Toggle - End User change change to suit prefferences
|PhraseOff returned by the bot when value is FALSE
|PhraseOn returned by the bot when value is TRUE
|Variable to be changed by the command
| Type TRUE Command will return Variable State when no Param Present
| Type FALSE Command Will Toggle Variable State when no Param Present
/call AddToggle aona "I will Not Attack when Assisting." "I will Attack when Assisting." AttackOnAssist TRUE
/call AddToggle bona "I won't move behind on assist." "I will move behind on assist." BehindOnAssist TRUE
/call AddToggle petona "I won't send pet in on assist." "I will send pet in on assist." PetOnAssist TRUE
/call AddToggle ListenChat "I will ignore Chat" "I will listen in Chat." ListenChat TRUE
/call AddToggle listengroup "I will ignore Group Chat." "I will listen in Group Chat." ListenGroup TRUE
/call AddToggle kick "Auto Kick is now off." "Auto Kick is now on." DoKick FALSE
/call AddToggle flyingkick "Auto FlyingKick is now off." "Auto FlyingKick is now on." DoFlyingKick FALSE
/call AddToggle disarm "Auto Disarm is now off." "Auto Disarm is now on." DoDisarm FALSE
/call AddToggle traps "I will not detect for traps." "I will detect for traps." DoTraps FALSE
/call AddToggle taunt "Auto Taunt is now off." "Auto Taunt is now on." DoTaunt FALSE
/call AddToggle backstab "Auto Backstab is now off." "Auto Backstab is now on." DoBackstab FALSE
/call AddToggle frenzy "Auto Frenzy is now off." "Auto Frenzy is now on." DoFrenzy FALSE
/call AddToggle evade "Auto Evade is now off." "Auto Evade is now on." DoEvade FALSE
/call AddToggle slam "Auto Slam is now off." "Auto Slam is now on." DoSlam FALSE
/call AddToggle bash "Auto Bash is now off." "Auto Bash is now on." DoBash FALSE
/call AddToggle beagg "Aggressive is set to off. " "Aggressive is set to on." Aggressive TRUE
/call AddToggle puller "I'm not the puller." "I'm the puller." IsPuller TRUE
/call AddToggle autoengage "I will not engage when attack is on." "I will engage when attack is on." AutoEngage TRUE
/call AddToggle archery "Archery is set to off." "Archery is set to on." DoArchery TRUE
/call AddToggle aftercastsit "I will no longer sit after casting." "I will now sit after casting." SitAfterCast FALSE
/call AddToggle autoheal "Let me know when people need heals." "I'll watch for heals." IsHealer TRUE
/call AddToggle autohealpets "I will not heal the pets." "I will heal the pets." HealPets TRUE
/call AddToggle patchheal "I'm not a patch Healer." "I'm a patch Healer." PatchHealer TRUE
/call AddToggle reportlom "I won't tell you when I'm low on Mana." "I'll let you know when I'm low on Mana." reportlom FALSE
/call AddToggle autobehind "I won't position myself behind the mob." "I will position myself behind the mob." AutoBehind FALSE
/call AddToggle incite "I won't use the incite discipline when in combat." "I will use the incite discipline when in combat." DoIncite FALSE
/call AddToggle yaulp "I won't Yaulp for mana." "I will Yaulp for mana." DoYaulp TRUE
/call AddToggle canni "I won't eat myself for mana." "I will eat myself for mana." DoCanni TRUE
/call AddToggle Checkname "I will respond to all commands." "I will only respond to commands that are addressed to me." CheckName TRUE
/call AddToggle Remem "I won't remem my spellset after casting." "I will remem my spellset after casting." Remem TRUE
/call AddCommand CORE shortcuts Do-shortcutsinfo
/return
Sub AddToggle(string commandText,string OffText,string OnText,string VarName,bool ToggleType)
/varcalc TopToggle ${TopToggle}+1
/varset Toggles[1,${TopToggle}] ${commandText}
/varset Toggles[2,${TopToggle}] ${OffText}
/varset Toggles[3,${TopToggle}] ${OnText}
/varset Toggles[4,${TopToggle}] ${VarName}
/varset Toggles[5,${TopToggle}] ${ToggleType}
/varset cmds-TOGGLES ${cmds-TOGGLES} ${commandText}
/return
[color=brown]Sub Init-Shortcuts
/declare cmds-SHORTCUTS string outer Shortcuts:
/declare Shortcutlist string local
/declare ArgNum int local 0
/declare Short string local 0
/declare ParamS string outer
/varset ArgNum 1
/varset Shortcutlist ${Ini[${IniFile},Shortcuts,-1,Undefined]}
/if (!${Shortcutlist.Find[Undefined]}) {
:shortcuts
/if (${Shortcutlist.Arg[${ArgNum},|].Length}) {
/varset Short ${Shortcutlist.Arg[${ArgNum},|].Lower}
|add Command
/varset cmds-SHORTCUTS ${cmds-SHORTCUTS} ${Short}
/if (!${Defined[ShortCuts-${Short}-Text]}) /declare ShortCuts-${Short}-Text string outer
/varset ShortCuts-${Short}-Text ${Ini[${IniFile},Shortcuts,${Short},NA]}
/varcalc ArgNum ${ArgNum}+1
/goto :shortcuts
}
} else {
/ini ${IniFile} Shortcuts default "/echo Put yer shortcuts in your .ini file!"
}
/return [/color]
Sub SetToggle(int ToggleNum,string newValue)
/if (!${Defined[newValue]} && ${Toggles[5,${ToggleNum}]}) {
/if (${${Toggles[4,${ToggleNum}]}}) {
/call ChatOut 9 ${MasterName} "${Toggles[3,${ToggleNum}]}"
} else {
/Call ChatOut 9 ${MasterName} "${Toggles[2,${ToggleNum}]}"
}
/return
}
/if ( !${Defined[newValue]} && !${Toggles[5,${ToggleNum}]}) {
/declare newValue Local
/if (${${Toggles[4,${ToggleNum}]}}) {
/varset newValue 0
} else {
/varset newValue 1
}
}
/if (${newValue.Equal[True]} || ${newValue.Equal[On]} || ${newValue.Equal[1]} || ${newValue.Equal[yes]}) {
/varset ${Toggles[4,${ToggleNum}]} 1
} else {
/varset ${Toggles[4,${ToggleNum}]} 0
}
/if (${${Toggles[4,${ToggleNum}]}}) {
/call ChatOut 9 ${MasterName} "${Toggles[3,${ToggleNum}]}"
} else {
/Call ChatOut 9 ${MasterName} "${Toggles[2,${ToggleNum}]}"
}
/return
[color=brown]Sub ShortCut(string ShortCutCommand)
/declare Name string local
/declare NameLen int local
/declare ParseText string local
/varset Name ${ShortCutCommand.Arg[1].Lower}
/varcalc NameLen ${Name.Length}+1
/if (${ShortCutCommand.Length} > ${NameLen}) {
/varset ParamS ${ShortCutCommand.Right[-${NameLen}]}
} else {
/varset ParamS
}
/echo ParamSSC *${ParamS}*
/varset ParseText ${ShortCuts-${Name}-Text}
/if (${ParseText.Left[1].Equal[/]}) {
/docommand ${ParseText}
} else {
/call ExecCommand "${ParseText}"
}
/return
Sub Do-shortcutsinfo
/if (${Defined[Param0]}) {
/if (${String[ ${cmds-SHORTCUTS.Lower} ].Find[ ${Param0.Lower} ]}) {
/call ChatOut 3 ${MasterName} "Shortcut ${Param0} does: ${ShortCuts-${Param0}-Text}"
} else {
/call ChatOut 3 ${MasterName} "I don't know the shortcut ${Param0}."
}
} else {
/call ChatOut 3 ${MasterName} "${cmds-SHORTCUTS}"
/call ChatOut 3 ${MasterName} "Type: shortcuts name_of_shortcut for more information on any particular shortcut.
}
/return [/color]





