Need quick help with my *almost* working Shaman bot script

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

uglyshaman

Need quick help with my *almost* working Shaman bot script

Post by uglyshaman » Wed Dec 03, 2003 6:57 pm

My shaman bot script is almost working :) This is my first attempt at a serious script and I'm excited. Thanks to Grimjack and many others for the help and code ideas for this simple script.

Here's the deal. I run the script on my shaman's PC. No problems. I send a command to /sit, /stand, no problem. I send a command to JBB - works just fine - the shaman will cast the JBB like a champ until the mob is dead. However, if WHILE he is casting the JBB I send the nocast command to him, he sends me the "No longer casting JBB on %t" message, but he continues to cast anyway. I cannot seem to figure out how to break out of the :JBBloop loop and just continue normally in the macro.

Would appreciate any suggestions :)

Thanks!

Here's the code...

Code: Select all

|Usage: /macro shamanbot "mastername"
#chat tell
#event MobDead "You must first select a target for this spell!"
#define JBBBUTTON F6 
Sub Main
   /declare Master global 
   /varset Master @Param0 

   :loop
    /doevents
    /goto :loop 
/return

Sub Event_MobDead
   /call nocast
/return

Sub Event_Chat 
  /if "@Param1"!="@Master" /return
  /if "@Param2"~~"sit" /sit 
  /if "@Param2"~~"stand" /stand 
  /if "@Param2"~~"assist" /call Do-Assist
  /if "@Param2"~~"JBB" /call JBB
  /if "@Param2"~~"nocast" /call nocast 
/return

Sub Do-Assist 
/assist @Master 
/delay 1s 
/tell @Master Assisting you on %t 
/return 

Sub JBB
   /assist @Master
   /delay 1s
   /tell @Master Casting JBB on %t
   
   :JBBloop
   /doevents
   /if ($char(casting)==FALSE && $target(type)==NPC) { 
    /press JBBBUTTON 
  } 
   /delay 1s
   /goto :JBBloop
/return

Sub nocast
  /tell @Master No longer casting JBB on target
/return

macrolover
a ghoul
a ghoul
Posts: 107
Joined: Sun Jul 14, 2002 9:19 am

not sure

Post by macrolover » Thu Dec 04, 2003 12:14 am

you need to send the macro to another sub after the no cast event fires. what is happing right now is it is running the no cast sub and returning to the jbb sub.
as an example

Code: Select all

Sub nocast 
  /tell @Master No longer casting JBB on target
  /call do assist 
/return 

uglyshaman

Post by uglyshaman » Thu Dec 04, 2003 1:34 pm

Great! Thanks - I'll test that out when I get home.

If I wanted to send it back to the MAIN Subroutine (which just loops over and over waiting for a command from the "master" to be given), then would i do a /call Main ?

Thanks.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Dec 04, 2003 6:28 pm

Code: Select all

|Usage: /macro shamanbot "mastername"
#chat tell
#event MobDead "You must first select a target for this spell!"
#define JBBBUTTON F6
Sub Main
[color=red]   /declare casttoggle global[/color]
   /declare Master global
   /varset Master @Param0

   :loop
    /doevents
    /goto :loop
/return

Sub Event_MobDead
   /call nocast
/return

Sub Event_Chat
  /if "@Param1"!="@Master" /return
  /if "@Param2"~~"sit" /sit
  /if "@Param2"~~"stand" /stand
  /if "@Param2"~~"assist" /call Do-Assist
  /if "@Param2"~~"JBB" /call JBB
  /if "@Param2"~~"nocast" /call nocast
/return

Sub Do-Assist
/assist @Master
/delay 1s
/tell @Master Assisting you on %t
/return

Sub JBB
[color=red]
    /varset casttoggle 1
[/color]
   /assist @Master
   /delay 1s
   /tell @Master Casting JBB on %t
   
   :JBBloop
   /doevents
   /if ($char(casting)==FALSE && $target(type)==NPC) {
    /press JBBBUTTON
  }
   /delay 1s
[color=red]
    /if n @casttoggle==0 /return
[/color]
   /goto :JBBloop
/return

Sub nocast
[color=red]
    /varset casttoggle 0
[/color]
  /tell @Master No longer casting JBB on target
/return 

uglyshaman

Post by uglyshaman » Thu Dec 04, 2003 7:55 pm

Thanks :) Man you guys inspire me to want to learn programming.