Responding to tells from a master

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

asta
decaying skeleton
decaying skeleton
Posts: 9
Joined: Wed Dec 25, 2002 5:30 pm

Responding to tells from a master

Post by asta » Mon Nov 10, 2003 7:01 pm

Im new to this and would like a sample of code to make a toon respond to simple commands from another. I have tried to figure it out from looking at some of the more advanced macros but would appreciate it if somebody could show it stand alone somewhat.

For example just to make a toon respond to /tell toon sit down.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Tue Nov 11, 2003 8:13 am

It's been a while since I did a bit of scripting, but heres a bare bones (I think):

Code: Select all

#chat tell

Sub Main
:MainLoop
  /doevents
  /goto :MainLoop
/return

Sub Event_Chat
  /if "@Param1"!="MastersName" /return

  /if "@Param2"~~"sit" /sit
  /if "@Param2"~~"stand" /stand
/return
This should only respond to tells coming from the Master. You'd need to change "MastersName" to the name of the person that you want the bot to take commands from.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]asking smart questions[/url]

in_training
Craptastic
Posts: 115
Joined: Fri Oct 10, 2003 8:25 am

Post by in_training » Wed Nov 19, 2003 5:56 am

Scrime,

On that same note, how would I invoke the macro with a Defined MasterName?

Code: Select all

EG:
/macro healmebitch.mac Doofus
To set Doofus as @MasterName.

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

...

Post by Joshjje » Wed Nov 19, 2003 7:29 am

Code: Select all

#chat tell 

Sub Main
/declare MastersName global
/varset MastersName "@Param0"

:MainLoop 
  /doevents 
  /goto :MainLoop 
/return 

Sub Event_Chat 
  /if "@Param1"!="@MastersName" /return 

  /if "@Param2"~~"sit" /sit 
  /if "@Param2"~~"stand" /stand 
/return 

in_training
Craptastic
Posts: 115
Joined: Fri Oct 10, 2003 8:25 am

Post by in_training » Wed Nov 19, 2003 7:41 pm

Gracias!

Drunkensloth
a lesser mummy
a lesser mummy
Posts: 67
Joined: Sat Oct 18, 2003 2:54 am

to set mastername

Post by Drunkensloth » Sun Nov 23, 2003 10:15 pm

example of invoking with defined mastername

/mac healmebitch "Doofus"
And here I was clicking like a sucker!

suparainja

heals

Post by suparainja » Tue Nov 25, 2003 12:12 am

trying to add a heal command to this wondering what i am doing wrong
/if "@param2"~~"heal" /cast 1
sorry if this is a noob question very new to this.

icepick912
orc pawn
orc pawn
Posts: 14
Joined: Tue Jan 21, 2003 4:07 pm

Post by icepick912 » Wed Dec 10, 2003 12:45 am

Here look at this macro i edited for my shaman, uses spell slot 5 for buffs, change em to your spell names and accepted commands if you want, also workin on remote controll kinda thing, where one char can make the other do anything he wants within using only / commands that is.

Code: Select all

|___________________________________________________________________ 
| petshaman.mac Edited by Icepick912
|___________________________________________________________________ 
| Normal commands 
|________________ 
| Attack 
| Example: /tell a_little_warrior_01 Attack the $target(id) 
| 
| Sit 
| Example: /tell a_little_warrior_01 Sit 
| 
| Follow 
| Example: /tell a_little_warrior_01 Follow 
| 
| Loot 
| Example: /tell a_little_warrior_01 Loot the $target(id) 
| 
| Taunt 
| Example: /tell a_little_warrior_01 Taunt the $target(id)  
|___________________________________________________________________ 
| Commands for use while attacking 
|__________________________________ 
| Pet Back Off 
| Example: /tell a_little_warrior_01 Back 
| 
| Stop 
| Example: /tell a_little_warrior_01 Stop Attacking the $target(id) 
|___________________________________________________________________ 
|TO DO: 
|Set the #define Parameters Owner and BotName 
|___________________________________________________________________ 

|#include core.mac 

#chat tell 

#turbo 

#Event Loading "LOADING, PLEASE WAIT..." 
#Event Loading "LOADING, PLEASE WAIT..." 
#Event Enrage "has become ENRAGED." 
#Event UnEnrage "is no longer enraged." 

#define owner "Owners name" 
#define BotName "Botsname" 
#define Forward w 
#define Backward s 
#define /follow "/call followit" 

Sub Main 

/declare v0 global 
/declare v1 global
/declare v2 global
/declare v3 global
/declare SpellSlot global
/declare PCommand0 global
/declare PCommand1 global
/declare PCommand2 global
/declare PCommand3 global
/declare PCommand4 global

/varset v0 $target(name) 
/varset v1 $target(id) 
/varset v2 0      |Variable used to determine wether or not to return to main loop 

:MainLoop 
/if $gm=="TRUE" /tell owner There is a GM in the Zone 
/varset v2 0 
/doevents 
/delay 1s 
/goto :MainLoop 
/return 

Sub FollowIt      
      :LoopFollow 
      /if n $target(distance)>10 /sendkey down up 
      /if n $target(distance)<10 /sendkey up up 
      /face fast 
      /doevents 
      /goto :LoopFollow 
/return 
Sub Event_Loading 

/sendkey up Forward 
/sendkey up Backward 
/attack off 
/varset v0 0 
/varset v1 0  
/return 

Sub Event_Chat(ChatType,Sender,ChatText)  

/if @Sender=="owner" {

   /if "@ChatText"~~Command {
      /varset PCommand0 $arg(2,"@ChatText")
	  /varset PCommand1 $arg(3,"@ChatText")
	  /varset PCommand2 $arg(4,"@ChatText")
	  /varset PCommand3 $arg(5,"@ChatText")
	  /varset PCommand4 $arg(6,"@ChatText")
	  /@PCommand0 @PCommand1 @PCommand2 @PCommand3 @PCommand4
   }
   

   /if "@ChatText"==Heal { 
      /varset SpellSlot $char(gem,Chloroblast)
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 4 Chloroblast
      }  
      :SpellWait0
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,Chloroblast)
         /goto :SpellWait0
      }
      /sit off 
      /target owner 
      /cast @SpellSlot
      /tell owner Healing $target(name) 
      /delay 4s 
      /varset v2 1 
      /varset SpellSlot 0

   } 
   /if "@ChatText"==mana { 
      /tell owner Mana: $char(mana,pct)% $char(mana,cur)/$char(mana,max) Health: $char(hp,pct)% $char(hp,cur)/$char(hp,max).
      /varset v2 1 
   } 
   /if "@ChatText"==Sit    { 
      /sit on 
      /tell owner I am now sitting 
      /varset v2 1 
   }    
   /if "@ChatText"==Stand    { 
      /sit off 
      /tell owner I am now standing 
      /varset v2 1 
   } 
   /if "@ChatText"==Follow { 
      /sit off 
      /target "owner" 
      /tell owner Now following you $target(name) 
      /follow 
      /varset v2 1 
     } 
   /if "@ChatText"==Loot { 
      /sit off 
      /target id $arg(3,"$p2") 
      /tell owner Im going to loot $target(name) 
      /call Loot 
      /varset v2 1 
   } 
   /if "@ChatText"==stamina {
      /varset SpellSlot $char(gem,"Riotous Health")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Riotous Health"
      }  
      :SpellWait1
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Riotous Health")
         /goto :SpellWait1
      }
      /sit off 
      /target owner 
      /tell owner I am casting stamina on $target(name) 
      /cast @SpellSlot
      /delay 6s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==regen { 
      /varset SpellSlot $char(gem,"Regrowth")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Regrowth"
      }  
      :SpellWait2
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Regrowth")
         /goto :SpellWait2
      }      
      /sit off 
      /target owner 
      /tell owner I am casting Chloro on $target(name) 
      /cast @SpellSlot
      /delay 6.5s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"=="sick pet" { 
      /target owner
      /assist 
      /delay 5 
      /tell owner I am sicking my pet on $target(name) 
      /pet attack 
      /attack off
      /target owner 
      /varset v2 1 
   } 
   /if "@ChatText"==cancle { 
      /target owner 
      /press c 
      /delay 5 
      /tell owner canceling 
      /delay 5 
      /press c 
      /varset v2 1 
   } 
   /if "@ChatText"==agility { 
      /varset SpellSlot $char(gem,"Deliriously Nimble")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Deliriously Nimble"
      }  
      :SpellWait3
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Deliriously Nimble")
         /goto :SpellWait3
      }  
      /sit off 
      /target owner 
      /tell owner I am casting agility on $target(name) 
      /cast @SpellSlot
      /delay 6.5s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==Hos { 
      /varset SpellSlot $char(gem,"Harnessing of Spirit")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Harnessing of Spirit"
      }  
      :SpellWait4
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Harnessing of Spirit")
         /goto :SpellWait4
      }  
      /sit off 
      /target owner 
      /tell owner I am casting Harnessing of Spirit on $target(name) 
      /cast @SpellSlot
      /delay 10s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==Haste { 
      /varset SpellSlot $char(gem,"Celerity")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Celerity"
      }  
      :SpellWait5
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Celerity")
         /goto :SpellWait5
      }  
      /sit off 
      /target owner 
      /tell owner I am hasting $target(name) 
      /target owner 
      /cast @SpellSlot 
      /delay 4s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==Back { 
         /tell owner Im comming back to the group "owner" 
         /call Back 
         /varset v2 1 
      } 
   /if "@ChatText"==Stop { 
      /tell owner Im not attacking $target(name) anymore. 
      /attack off 
      /varset v2 1 
        } 
   /if "@ChatText"==sow { 
      /varset SpellSlot $char(gem,"Spirit of Wolf")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 8 "Spirit of Wolf"
      }  
      :SpellWait6
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Spirit of Wolf")
         /goto :SpellWait6
      } 
      /sit off 
      /target owner 
      /tell owner I am Sowing $target(name) 
      /target owner 
      /cast @SpellSlot
      /delay 5s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==str { 
      /varset SpellSlot $char(gem,"Strength")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Strength"
      }  
      :SpellWait7
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Strength")
         /goto :SpellWait7
      } 
      /sit off 
      /target owner 
      /tell owner I am making $target(name) Stronger!
      /target owner 
      /cast @SpellSlot
      /delay 5s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==dex { 
      /varset SpellSlot $char(gem,"Dexterity")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Dexterity"
      }  
      :SpellWait8
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Dexterity")
         /goto :SpellWait8
      } 
      /sit off 
      /target owner 
      /tell owner I am Giving $target(name) Accuracy!
      /target owner 
      /cast @SpellSlot
      /delay 5s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
   /if "@ChatText"==Ios { 
      /varset SpellSlot $char(gem,"Infusion of Spirit")
      /if n "@SpellSlot"=="0" {
         /if "$char(state)"!="SIT" {
            /sit
         }
         /memspell 5 "Infusion of Spirit"
      }  
      :SpellWait9
      /if n "@SpellSlot"<"1" {
         /varset SpellSlot $char(gem,"Infusion of Spirit")
         /goto :SpellWait9
      }  
      /sit off 
      /target owner 
      /tell owner I am casting Infusion of Spirit on $target(name) 
      /cast @SpellSlot
      /delay 10s 
      /varset v2 1 
      /varset SpellSlot 0
   } 
} 
   /if @Sender!=owner {
   /tell owner BotName has a private tell. 
}
/return 

|**----------------------------------------------------------------------------**| 
|**      Tell pet to attack                       **| 
|**----------------------------------------------------------------------------**| 

Sub Attack 

   /attack on 
   /sendkey down s 
   /sendkey up s 
   /varset v1 $target(id) 

   :TrackLoop 
   /doevents 
   /delay 0 
   /face afast 
   /if n $target(distance)>14 /sendkey down Forward 
   /if n $target(distance)<16 { 
   /sendkey up Forward 
   /goto :AttackLoop 
   } 
   /goto :TrackLoop 

   :AttackLoop 
   /if "$target(id)"!="$v1" /goto :EndAttack 
   /doevents 
   /if n $v2==1 /return 
   /if n $v3==1 /return 
   /delay 0 
   /face nopredict fast 
   /if n $target(distance)>10 /sendkey down Forward 
   /if n $target(distance)<11 /sendkey up Forward 
   /if n $target(hp,pct)>0 /press 3 
   |/if n $char(ability,bash)>0 /doability bash 
   |/if n $char(ability,disarm)>0 /doability disarm 
   |/if n $char(ability,kick)>0 /doability kick 

   /if $target(hp,pct)>0 { 
   /press 7 

   } 
   /goto :AttackLoop 

   :EndAttack 

   /target owner 
   /follow 

   /return 

Sub Back 

   /attack off 
   /target "owner" 
   /follow 
   /return 

Sub Loot 

   | yet to be implemented 

   /return 

Sub Haste 

   /target owner 
   /cast 2 
   /delay 4s 
   /return 

Sub Event_Enrage 

   /if "$p0"~~"BotName" /return 
   /attack off 
   /varset v3 1 

/return 

Sub Event_UnEnrage 

   /attack on 
   /varset v3 0 

/return