genbot.mac - Bot for any class scirpts.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

chat chat

Post by boredom » Wed Oct 01, 2003 7:01 pm

Code: Select all

#chat chat
and in Sub Event_chat

Code: Select all

/if "$p0"=="ChatChannel" {
   :ArrayTime 
   /if "$arg(1,"$p2")"=="$a(1,$CmdArrayNum)" { 
      /call Do-$a(1,$CmdArrayNum) $p2 
      /return 
   } 
   /varadd CmdArrayNum 1 
   /if n $CmdArrayNum>=$CmdArraySize /return 
   /goto :ArrayTime 
}
haven't tested it, but it might work

/Bored

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Wed Oct 01, 2003 9:49 pm

/tell bot aftercastsit on

Bot reports "couldn't find a comparison operator in 0=1"

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Thu Oct 02, 2003 1:03 pm

New major rewirte. You will want to backup your old one before using this just in case there are bugs.

5.0 uses a bit of a new layout. YOu now add your commands to the personal.inc file. This will keep you from having to update with all of your personal commands ever new version. All of the "modules" use their own arrays for the commands now too. Expect another new rewrite with the info posted by plaz once that goes live. It may be a bit before I get finished with a fully working copy though.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

User avatar
Slice
a hill giant
a hill giant
Posts: 189
Joined: Wed Oct 30, 2002 2:52 pm

Post by Slice » Thu Oct 02, 2003 1:54 pm

Two requests:

1) Add a command to tell the bot to move to a specific loc. It looks like the current move command only tells the bot to move to a target or the master?

2) Update page one with the command descriptions.

Reposting from your post on page 5.

Code: Select all

Core Commands 
afk               Make bot set afk.  You can give up to an 8 word message. 
accept      Make the bot accept a group invite. 
reject       Make the bot reject a group invite. 
invite       Make the bot invite a person by name or by assisting master. 
follow       Make the bot turn on in game follow on master.  Must be grouped. 
stop        Stop doing everything.  Moving, Casting, Attacking... 
moveto      Move to target by name or by assisting master. 
sit          Make the bot sit. 
stand        Make the bot stand. 
camp       Make the bot camp. 
duck        Make the bot toggle duck. 
run         Make the bot toggle run/walk. 
say         Make the bot /say up to 8 words at a time. 
tell           Make the bot /tell up to 8 words at a time. Example /msg botname tell joe how are you. 
group        Make the bot /group up to 8 words at a time. 
cmds        Make the bot /tell the master a list of commands. 
target         Make the bot /target by name. 
notarget          Make the bot lose target. 
assist          Make the bot assist the master or by name. 
saytarget     Make the bot /tell the master what it's current target is. 
afollow         Make the bot /assist master and afollow target or follow target by name. 
trade              Make bot click trade. 
yesres            Make bot click yes on res window 
petattack         Make bot send pet to attack 
petguard          Make bot tell pet guard here. 
petbackoff       Make bot tell pet to back off. 
anchor            Set/remove anchor point for bot to return to after combat. 

Fix for tankheals, and possible fix for healing shadow knights. 
Other minor fixes. 

Combat commands 
attack          Bot will target using /assist off of master or target by name and enter combat mode. 
noattack   Turn off combat mode. 
backstab   Toggle auto backstab. 
taunt      Toggle auto taunt. 
evade      Toggle auto evade. 
slam      Toggle auto slam. 
bash      Toggle auto bash. 
traps      Toggle auto traps. 
kick      Toggle auto kick. 
getbehind   Make bot get behind it's current target. 

Spell Commands 
sn      Make bot cast spell by name. Bot will mem spells if needed. 
mana      Make bot report mana to master. 
evac      Make bot move close to master and attempt to cast evac. 
aftercastsit   Toggle sit after cast. 
loadlist   Make bot /memspellset by name. 
itemcast   Make bot cast item by name. 
lootup           Make bot loot whatever the master has targeted or specifies. 

Healer Commands 
autoheal   Toggle auto heal. 
settankheal   Set heal used to heal tanks. 
setcasterheal   Set heal used to heal casters. 
setdefaultheal   Set heal used with the heal command. 
heal      Heal target by name or using assist off of master. 
autohealpets  Turn on/off auto heal for pets. 
setpetheal   Set heal used to heal pets

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

Before the code revamp I want to post in a couple adds I did

Post by LordGiddion » Thu Oct 02, 2003 11:42 pm

Buff command, Orders Bot to cast a buff on declared target, bit then monitors buff timing and recasts when buff drops

Code: Select all

sub Do-buff
   /if n $strlen("$p1")<=0 /return
   /if n $strlen("$p2")<=0 /return
   /if n $strlen("$p3")<=0 {
       /varset l1 $p2
   } else /if n $strlen("$p4")<=0 {
      /varset l1 "$p2 $p3"
   } else /if n $strlen("$p5")<=0 {
      /varset l1 "$p2 $p3 $p4"
   } else {
      /varset l1 "$p2 $p3 $p4 $p5"
   }
   /if n $char(book,"$l1")<1 {
      |/tell $MasterName I don't know that spell
      /return
   }
   /varadd LastBuff 1
   /if $p1==$char(name,clean) {
      /target myself
   }else {
      /target pc $p1
   }
   /varset a(8,$LastBuff) $p1
   /delay 5
   /tell $MasterName Casting $l1 on %t
   /varset a(9,$LastBuff) "$l1"
   /call SpellSub "$l1"
   /varset t$LastBuff $spell("$l1",duration)s
/return

sub event_timer
   /if $p0==39 /return
   /if "$target(name,clean)"!="$a(8,$p0)" {
      /if "$a(8,$p0)"=="$char(name,clean)" {
         /target myself
      }else {
         /target pc /target($a(8,$p0))
      }
   }
   /call SpellSub "$a(9,$p0)"
   /varset t$p0 $p1s
/return
Aggessive turns it on and off, Events has bot defend itself when attacked

Code: Select all

#Event GettingHit "YOU for" 
#Event AttackedMiss " YOU, but " 

||| Toggle Aggressive on and off.
Sub Do-setaggressive
   /if n $strlen("$p1")<=0 {
      /tell $MasterName Aggressive=$Aggressive
      /return
   }
   /if $p1=="off" {
      /varset Aggressive 0
      /tell $MasterName I'll ignore attacks
   }
   /if $p1=="on" {
      /varset Aggressive 1
      /tell $MasterName I'll fight back if attacked
   }
/return

Sub Event_GettingHit
   /if ($combat==TRUE || $Aggressive!="1") /return
   /if ("$p0"!~"say" && "$p0"!~"group") /if ("$p0"!~"out of character" && "$p0"!~"shout") /if "$p0"!~"guild" {
      /if $target()==TRUE /if "$target(type)"!="NPC" /target clear
      /if $target()==TRUE /if $combat==FALSE /if $target(type)=="NPC" /if $Aggressive==1 {
         /tell $MName1 I am being attacked by $target(name,clean)
         /delay 2
         /press Backward
         /attack on
      }
   }
/return

Sub Event_AttackedMiss
   /if ($combat==TRUE || $Aggressive!="1") /return
   /if ("$p0"!~"say" && "$p0"!~"group") /if ("$p0"!~"out of character" && "$p0"!~"shout") /if "$p0"!~"guild" {
      /if $target()==TRUE /if "$target(type)"!="NPC" /target clear
      /if $target()==TRUE /if $combat==FALSE /if $target(type)=="NPC" {
         /tell $MName1 I am being attacked by $target(name,clean)
         /delay 2
         /press Backward
         /attack on
      }
   }
/return
Farm command, bot will find the closest mob on a list of mobs and hunt it down
in sub main

Code: Select all

/if $AFarm!="0" /call FarmNext

Code: Select all

Sub Do-farm
   /if $p1=="off" {
      /varset AFarm 0
      /return
   }
   /if n $strlen("$p1")<=0 { 
      /return 
   }
   /varadd AFarm 1
   /if n $strlen("$p2")<=0 {
      /varset a(11,$AFarm) "$p1"
   } else /if n $strlen("$p3")<=0 { 
      /varset a(11,$AFarm) "$p1 $p2"
   } else /if n $strlen("$p4)<=0 {
      /varset a(11,$AFarm) "$p1 $p2 $p3"
   } else {
      /varset a(11,$AFarm) "$p1 $p2 $p3 $p4"
   } 
/return

Sub FarmNext
   /if $Combatstatus==1 /return
   /if $Combat==TRUE /return

   /if n $FarmWait<5 {
      |wait before starting next farm to check for aggro
      /varadd FarmWait 1
      /delay 1s
      /return
   }
   /varset FarmWait 0
   /target clear
   /sit off
   /if "$a(11,1)"=="level" {
      /varset l1 $char(level)
      /varsub l1 LevelRange
      /if n $l1<1 /varset $l1 1
      /varset l2 $char(level)
      /varadd l2 LevelRange
      /target npc range $l1 $l2 radius 800 nopcnear 60 
   } else {
      /varset l1 1
      /varset l2 300000
      :FarmLoop
         /target npc $a(11,$l1) nopcnear 60 radius 800
         /if n $target(distance)<$l2 {
            /varset l2 $target(distance)
            /varset l3 $l1
         }
      /varadd l1 1
      /if n $l1<=$AFarm /goto :FarmLoop
      /target nopcnear 60 npc $a(11,$l3) radius 800
   }
   /delay 5
   /attack on
/return
PL command, bot targets and watches 1 pc and heals as needed, Uses same target as Afollow, usually want them both on
in Main loop

Code: Select all

/if $APower=="1" /call CheckTargetHealth blah $FollowTarget

Code: Select all

Sub Do-pl
   /if $p1=="off" {
      /varset APower 0
      /return
   }
   /if n $strlen("$p1")<=0 { 
      /return 
   } else /if n $strlen("$p2")<=0 { 
      /varset FollowTarget "$p1"
      /varset APower 1
   } else /if n $strlen("$p3")<=0 { 
      /varset FollowTarget "$p1 $p2"
      /varset APower 1
   } else /if n $strlen("$p4)<=0 { 
      /varset FollowTarget "$p1 $p2 $p3"
      /varset APower 1
   } else {
      /varset FollowTarget "$p1 $p2 $p3 $p4"
      /varset APower 1
   } 
/return 
||| Monitor PL Target health and call heal subs.
Sub CheckTargetHealth
   /if $IsHealer==0 /return
   /doevents
   /if $p1=="me" {
	   /if "$target(name,clean)"!="$MasterName" /target $MasterName
   } else /if n $strlen("$p2")<=0 {
      /if "$target(name,clean)"!="$p1" /target "$p1"
   } else /if n $strlen("$p3")<=0 {
      /if "$target(name,clean)"!="$p1 $p2" /target "$p1 $p2"
   }
   /if n $spawn($group($GroupMember),hp,pct)<41 /if n $spawn($group($GroupMember),hp,pct)>=1 {
         /if "$spawn($target(id),class)"=="Warrior" /call Tankheal
         /if "$spawn($target(id),class)"=="Paladin" /call Tankheal
         /if "$spawn($target(id),class)"=="Shadow Knight" /call Tankheal
         /if "$spawn($target(id),class)"=="Monk" /call Tankheal
         /if "$spawn($target(id),class)"=="Ranger" /call Tankheal
   }
   /if n $spawn($target(id),hp,pct)>=1 { 
      /if n $spawn($target(id),hp,pct)<41 { 
         /call CasterHeal 
      } 
   }
   /if n $spawn($target(id),hp,pct)>=1 { 
      /if n $spawn($target(id),hp,pct)<26 {
         /call FastTankheal
      } 
   }
   /doevents 
/return