-It will run now.
-copy and past code into a text file, name it botbasic.iss, and put it in your innerspace/scripts folder.
Usage:
With isxeq loaded, pull down the console and "RunScript botbasic.iss" then immediately type "EndScript botbasic.iss". Minimize EQ and goto your innerspace DIR and find bot_YourToonName.xml. Edit this file with the master name, and the ChatInChan you wish the bot to listen to, then go back to EQ and RunScript botbasic again, or just copy and paste the skeleton XML below and rename it to bot_YourToonName and place it in your InnerSpace DIR.
Commands:
follow - bot follows you
stay - bot stops following you
sit - bot sits
face - bot faces you
stand - bot stands
TODO:
Add interface to spell_routines.iss by onetimehero
Add interface to wait4rez by RedOneDI (this script is still incomplete too)
Add lots more options and commands
Fix my syntax, because I'm sure most of it is wrong.
Add functionality for multiple masters, multiple channels, multiple levels of bot access.
Finish reload command to be able to adjust and reset settings on the fly without having to restart the bot.
Comments:
If anyone can glance this over and see if I'm even starting down the right path would be appreciative. I was flipping back and forth between comments in the forums and the wiki as I went, so I might not even be consistent with how I'm doing things. I might be mixing up LS stuff versus ISXEQ specific stuff.
Please comment, thanks.
BotBasic.iss
Code: Select all
#include spell_routines.inc
#define INI_FILENAME bot_${Me.CleanName}.ini
function main()
{
; Name of the configuration file to use
declare SettingFile string script "bot_${Me.CleanName}.xml"
echo Starting: Bot Basic with file bot_${Me.CleanName}.xml
Call bf_VarSetup
Call bf_LoadIni
if "${MasterName.Equal["NOT_FOUND"]}"
{
echo No Masters found, terminating...
call bf_EndScript
}
else
{
echo Master is ${MasterName}
}
call bf_AddTriggers
do
{
ExecuteQueued
waitframe
}
while "1"
return
}
function bf_LoadIni()
{
SettingXML[${SettingFile}]:Unload
;check if file exists
;echo ${SettingXML[${SettingFile}].Sets}
if !${SettingXML[${SettingFile}].Sets}
{
SettingXML[${SettingFile}].Set[General Options]:Set[MasterName,CHANGEME]
SettingXML[${SettingFile}].Set[General Options]:Set[ChatInChan,group]
SettingXML[${SettingFile}].Set[General Options]:Set[ChatOutChan,group]
SettingXML[${SettingFile}]:Save
}
MasterName:Set[${SettingXML[${SettingFile}].Set[General Options].GetString[MasterName,NOT_FOUND]}]
ChatInChan:Set[${SettingXML[${SettingFile}].Set[General Options].GetString[ChatInChan,NOT_FOUND]}]
ChatOutChan:Set[${SettingXML[${SettingFile}].Set[General Options].GetString[ChatOutChan,NOT_FOUND]}]
echo Listening in channel ${ChatInChan} for ${MasterName} commands.
return
}
function bf_VarSetup()
{
declare MasterName string script
declare ChatInChan string global
declare ChatOutChan string script
declare bv_DoFollow int script 0
declare ss_Return string script
declare si_Return int script 0
declare sb_Return bool script
return
}
function bf_AddTriggers()
{
AddTrigger bf_Chat_tell "@Player@ tells you, '@LinePart@'"
AddTrigger bf_Chat_tell "@Player@ told you, '@LinePart@'"
AddTrigger bf_Chat_channel "@Player@ tells %\${ChatInChan.Lower}%:1, '@LinePart@'"
AddTrigger bf_Chat_irc "<@Player@> @LinePart@"
return
}
function bf_Check_Master()
{
;TODO: Multimaster check
if "${Player.Equal[${MasterName}]}"
{
si_Return:Set[1]
return
}
sb_Return:Set[0]
return
}
function bf_Command_follow(string Player)
{
call bf_Command_stand
bv_DoFollow:Set[1]
call bf_Follow ${Player}
}
function bf_Command_stay()
{
bv_DoFollow:Set[0]
}
function bf_Command_stand()
{
if ${Me.Sitting}
{
EQExecute /stand
}
}
function bf_Command_sit()
{
bv_DoFollow:Set[0]
if ${Me.Standing}
{
EQExecute /sit
}
}
function bf_Command_face(string Player)
{
Spawn[pc,${Player.Lower}]:Assist:Face[fast]
return
}
function bf_DoCommand(string FullLine, string Player, string Command)
{
;echo Start of DoCommand with ${Command}
;Find the command to execute
;TODO Custom commands from an XML
if ${Command.Left[${Me.CleanName.Length}].Equal[${Me.CleanName}]}
{
echo Command is for me!
Command:Set[${Command.Right[-${Me.CleanName.Length}]}]
}
if ${Command.Left[1].Equal["/"]}
{
EQExecute ${Command}
return
}
Switch ${Command}
{
case Follow
echo [COMMAND] follow
call bf_Command_follow ${Player}
break
case sit
echo [COMMAND] sit
call bf_Command_sit
break
case stay
echo [COMMAND] stay
call bf_Command_stay
break
case face
echo [COMMAND] face
call bf_Command_face ${Player}
break
case stand
echo [COMMAND] stand
call bf_Command_stand
break
Default
echo Could not parse: ${Command}
break
}
EndSwitch
return
}
function bf_Chat_tell(string FullLine, string Player, string Command)
{
;Check it if is a master
call bf_Check_Master ${Player}
if ${si_Return}
{
return
}
;echo Received a tell with ${Command}
call bf_DoCommand "${FullLine}" "${Player}" "${Command}"
}
function bf_Chat_channel(string FullLine, string Player, string Command)
{
;Check it if is a master
call bf_Check_Master ${Player}
if ${si_Return}
{
return
}
;echo Received a Channel with ${Command}
call bf_DoCommand "${FullLine}" "${Player}" "${Command}"
}
function bf_Chat_irc(string FullLine, string Player, string Command)
{
;Check it if is a master
call bf_Check_Master ${Player}
if ${si_Return}
{
return
}
;echo Received an irc with ${Command}
call bf_DoCommand "${FullLine}" "${Player}" "${Command}"
}
function bf_Chat(string FullLine, string Player, string Command, string Arg2, string Arg3)
{
}
function bf_Follow(string Player)
{
declare InRange int local 0
;echo ${Spawn[pc,${Player.Lower}].ID}
if ${Spawn[pc,${Player.Lower}].ID}
{
;echo Folling ${Player}
Spawn[pc,${Player.Lower}]:Target
Spawn[pc,${Player.Lower}]:Target:Face[fast]
}
else
{
echo Could not find spawn ${Player} to follow
return
}
if ${Target.ID}
{
do
{
if !${Target.ID}
{
bv_DoFollow:Set[0]
}
Spawn[pc,${Player.Lower}]:Target:Face[fast]
;echo In follow function, looking for ${Player}
ExecuteQueued
;EQExecute ${Spawn[${PlayerID}]}
if "${Target.Distance} > 10"
{
Keypress forward
Keypress forward hold
InRange:Set[1]
}
else
{
if ${InRange}
{
Keypress back
InRange:Set[0]
}
}
}
while ${bv_DoFollow}
Keypress back
}
return
}
function bf_RemoveTriggers()
{
RemoveTrigger bf_Chat
RemoveTrigger bf_Chat_tell
RemoveTrigger bf_Chat_irc
return
}
function bf_EndScript()
{
call bf_RemoveTriggers
EndScript BotBasic
}-Red


