Genbot Version 12 Ready

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Vexix
Genbot Janitor
Posts: 245
Joined: Sat Apr 17, 2004 10:10 am

Post by Vexix » Sun May 16, 2004 3:33 am

I've been working with Genbot a bit, and wanted increased flexibility with my shortcuts, so I've changed the code a bit so I can use any everquest, macroquest, or genbot command.

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 
Notice that DataVars, like ${Me.Name} etc. are valid in shortcuts. Also, you can append a shortcut with another argument. For instance, the above sowhim shortcut ends with "on", so if you type, "sowhim Bob", the command executed would be /echo genbot buff spirit of wolf on Bob. It's very flexible. -- This isn't working yet.

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
Also, the shortcuts.inc got changed quite a bit.

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]
 
Last edited by Vexix on Mon May 17, 2004 11:42 am, edited 1 time in total.

Rassilon
a lesser mummy
a lesser mummy
Posts: 73
Joined: Thu Sep 04, 2003 6:34 pm

Post by Rassilon » Sun May 16, 2004 10:56 am

Anyone been able to fix the anchor yet? When you tell the bot to anchor it just stands there and spins. I put in the fixes Fez posted a few pages back but that didn't do much.

Thanks

User avatar
Seagreen500
crash test
Posts: 47
Joined: Mon Nov 10, 2003 1:04 am

Post by Seagreen500 » Sun May 16, 2004 11:08 am

This is very cool,
I like the idea of one [Shortcuts] place for everything,.
Of course being able to /do commands, and have the bot /echo commands to itself is great.

Problems,

My .ini

Code: Select all

test=/echo genbot sn Force of Akilae
test2=/do sn Force of Akilae
test3=/do sn "Force of Akilae"
/tell bot test
Bot doesn't get a target
Gives me the text
[MQ2] genbot sn Force of Akilae
[MQ2] Casting Force of Akilae on NULL (note the double spaces)
[MQ2] Don't know the spell Force of Akilae so failing to cast

/tell bot test2
Bot gets a target
You told Master,'Casting Force of Akilae on a spiderling'
but it doesn't cast the spell, if you /tell bot test2 again
You told Master,'Casting Force on a spiderling'
and it does cast Force (both spells are memmed)

/tell bot test3
same as test2

for the /do command, it is getting a target, but I think not getting the target in time to cast the spell, so it gives up, but I see no error message about 'no target found' or 'failed to cast'.

also there must be something wrong with how its grabbing the command param, in this case, the spell name.

last thing I noticed was if I /tell bot Test2, with the cap T , I get

shortcuts.inc(Shortcut(string ShortCutCommand)):/docommand
${ShortCuts-${Short}-Text} ${ShortCutParams}
etc..

Great idea !

Seagreen

chickenisgoot
a ghoul
a ghoul
Posts: 84
Joined: Tue Oct 07, 2003 10:52 am

Fixing Anchor problems

Post by chickenisgoot » Sun May 16, 2004 11:31 am

Rassilon:

Change this line in the CoreMain function off botcore.inc

Code: Select all

/if (${Math.Distance[${Anchor[color=red]Y[/color]},${Anchor[color=red]X[/color]}]}>${AnchorRadius}) {
To stop the spinning.

Also, I had to change the Detectobst function or it wouldnt walk back correctly.

Code: Select all

/if (${Math.Distance[${GenLastXLoc},${GenLastYLoc},${Me.Z}:${Me.X},${Me.Y},${Me.Z}]}<[color=red]1[/color]) /call Hitobst 5  
Changing those two things and changing the things listed earlier in this thread fixed all anchor problems for me. Basically change <10 to <1 in detectobst and change flipflop the Y/X in the Core Main call.

mpmq
a lesser mummy
a lesser mummy
Posts: 30
Joined: Thu Mar 18, 2004 8:07 pm

Post by mpmq » Sun May 16, 2004 7:32 pm

I was having problems with my healer bot healing the pet owner, and not the pet when the pets HP dropped low enough. The following seems to have fixed it, for anyone else who might have been having problems.

in bothealer.inc

Code: Select all

      /if (${BreakOut}) /return 
      /if (${HealPets} && ${Spawn[${QuickID}].Class.PetClass} && ${Spawn[${QuickID}].Pet.ID}) { 
         /if (${Spawn[${QuickID}].Pet.PctHPs}<${PetPctHeal}) { 
            /if (${Me.Combat}) /attack off 
            /call CastHeal [color=red]${Spawn[${QuickID}].Pet.ID}[/color] "${PetSpell}" "${HealPetMsg}"
         } 
      } 
      /doevents 
The text in red is what I changed. It used to just reference ${QuickID}.

Vexix
Genbot Janitor
Posts: 245
Joined: Sat Apr 17, 2004 10:10 am

Thanks, Seagreen

Post by Vexix » Mon May 17, 2004 11:44 am

Fixed the targetting issue, removed the /do command - you can enter Genbot commands just as they are, and fixed the upper case issue.

Code is updated above.

The shortcut arguments is still waiting a bit. Something weird in MQ parsing there.

--Vexix

LordGiddion
a snow griffon
a snow griffon
Posts: 352
Joined: Sat Sep 13, 2003 6:12 pm
Contact:

Post by LordGiddion » Mon May 17, 2004 9:14 pm

Hi folks, semi moved in - have my laptop up so I can edit, but my desktop is still not moved so I can't test anything.

midget
decaying skeleton
decaying skeleton
Posts: 2
Joined: Wed Apr 28, 2004 1:57 am

Post by midget » Tue May 18, 2004 12:47 am

Ahh, all the joys of moving. (moved prob at least 20-25times in my life).

User avatar
Fuergrissa
a grimling bloodguard
a grimling bloodguard
Posts: 607
Joined: Mon Dec 08, 2003 3:46 pm
Location: UK

Post by Fuergrissa » Tue May 18, 2004 1:40 am

Hope everything went Well LG, get the fridge working and full of beers, get the lounger on the porch then get ya PC sorted, everything else can surely wait untill the weekend ?

venidar
orc pawn
orc pawn
Posts: 12
Joined: Fri May 14, 2004 3:24 pm

Post by venidar » Tue May 18, 2004 2:16 pm

For those of you who use IRC to give genbot commands i managed to get it working again by reusing some of the other genbot code. changes below are to botcore.inc

event:

Code: Select all

#Event IRC "<#1#> #2#"
I put this below Sub Event_Chat:

Code: Select all

Sub Event_IRC(string IRCText,string IRCSender)
  
      /if (${MasterList.Find[|${IRCSender}|]}) { 
      /declare NameLength int local ${IRCSender.Length} 
         /varcalc NameLength ${NameLength}+2 
         /varset IRCText ${IRCText.Right[-${NameLength}]}
	 /call ExecCommand "${IRCText}"
      /return 
   }

/return
seems to be working for me, if anyone has problems with it i'll see what I can do for it. I think soon I want to add a way to associate IRC nicks with in game toons, but since it's working again i'm off to XP for now!

venidar

fez_ajer
a ghoul
a ghoul
Posts: 106
Joined: Fri Apr 23, 2004 6:44 pm
Location: If I was up your ass you'd know where I was...

Post by fez_ajer » Tue May 18, 2004 9:57 pm

WB Gid!
- Fez

elkcit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Aug 31, 2002 3:20 pm

Post by elkcit » Wed May 19, 2004 6:19 pm

hmm i seem to recall a LordGiddion from a while back over at xylobot forums... anyways nice coding man

mqnewbie
a hill giant
a hill giant
Posts: 193
Joined: Sat May 22, 2004 1:29 am

Post by mqnewbie » Sat May 22, 2004 1:39 am

I didn't see anyone with this issue in my looking over the thread, if I missed it I apologize.

Most things are working fine for me, but I'm having one problem that's really just an annoyance, but I'm wondering if this is by design.

Scenario:
/t bot follow me
she stands up and follows me, flawlessly.
/t bot sn pacification
She assists me, paci's my target
I do this for a few mobs, I get ready to pull, so /t bot follow me.
She targets me, but does NOT turn to face me, nor does she follow me when I move away.
Now if I spam her with /t bot stop for the same number of times I ordered her to cast paci or any other spell, she suddenly snaps to me and follows like normal.

The bot works 100% correctly IF I issue as top command after every spell I order her to cast. Otherwise my commands just get queued up till I "clear her casting state" with stops, for lack of a better description.

If this is by design then I will plan accordingly, but it seems like an odd bug to me.

Vexix
Genbot Janitor
Posts: 245
Joined: Sat Apr 17, 2004 10:10 am

Post by Vexix » Wed May 26, 2004 11:42 am

mqnewbie,

What followmode are you using?

Please post reponse to the new 12.34 genbot.mac post.

--Vexix

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

Top Product Tips

Post by FrankJScott » Sun Dec 24, 2023 4:44 pm

Please try Google before asking about Cool Product Guide 86b3ce3