Can I end a sub by itself?

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

C247
orc pawn
orc pawn
Posts: 21
Joined: Tue Jan 27, 2004 9:09 pm

Can I end a sub by itself?

Post by C247 » Wed Feb 04, 2004 1:15 pm

Code: Select all

Sub Event_ComeOn(ChatType,Sender,ChatText)
    /if "@ChatText"=="come on over here" {
  /sit off
/echo Standing up to move.
  /target @Sender
  /delay 5
  /call Follow
    /if "@ChatText"=="wait over here" {
  /sit on
/echo Sitting down to med.
When I sit, it keeps Follow going.

Is there a way to turn off the Follow?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Feb 04, 2004 1:27 pm

The problem is you are entering the Follow subroutine, but not making allowances to exit that routine.

You want it to stop following if you receive the chat event "wait here". But for sub Follow to know that you need to add /doevents to it, or it will never get that message.

Without seeing the code for Follow I can't tell you where you need to insert it however.

C247
orc pawn
orc pawn
Posts: 21
Joined: Tue Jan 27, 2004 9:09 pm

Post by C247 » Wed Feb 04, 2004 1:46 pm

Here is my entire code.

Code: Select all

|  bot.mac  |

#turbo

#include autofight.inc

#chat tell


Sub Main
/declare MasterName global
/varset MasterName "Param0"

/echo >> [ bot.mac ] <<

   :MainLoop
     /doevents
   /goto :MainLoop
/return

|--------------
Sub Follow
   :Loop
      /if n $target(distance)>60 /sendkey down up
      /if n $target(distance)<40 /sendkey up up
      /face fast
      /delay 0
   /if "$target()"=="TRUE" /goto :Loop
/return

|-------------
Sub Event_Chat(ChatType,Sender,ChatText)
  
/if "@ChatText"~~"hey, get this" {
  /target PC @Sender
  /sit off
/echo Standing up to attack.
/delay 1s
  /assist
/delay 1s
  /attack off
  /call Attack
/return
}

|--------------
    /if "@ChatText"~~"come on over here" {
  /sit off
/echo Standing up to move.
  /target @Sender
  /delay 1s
  /call Follow
}
/return
    /if "@ChatText"=="wait over here" {
  /sit on
/echo Sitting down to med.
}
/return

|--------------
  /if "@ChatText"~~"group with me" {
 /target @Sender
/delay 1s
/invite
}
/return
|---------------