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
-
Tuffy
- a lesser mummy

- Posts: 33
- Joined: Thu Oct 02, 2003 9:20 am
Post
by Tuffy » Tue Oct 14, 2003 10:40 am
So how did I do?
Code: Select all
| Follow.mac
|
| - Playing with simple code -
|
|
|
| Usage: /macro Follow "Your Name"
|
|
#Turbo
#event FollowOff "You are no longer auto-following"
Sub Main
/Declare Follow Global
/varset Follow @Param0
Sub FollowIt
:LoopFollow
/if $char(state)==SIT /stand
/target @Param0
/if n $target(distance)>10 /sendkey down up
/if n $target(distance)<10 /sendkey up up
/face fast nopredict
/doevents
/goto :LoopFollow
/return
Sub Event_FollowOff
/press esc
/press esc
/press esc
/press esc
/press esc
/delay 5
/tell @Param0 >> Auto Follow Off. <<
/return
-
Shocks
- a ghoul

- Posts: 101
- Joined: Tue Feb 18, 2003 3:26 pm
-
Contact:
Post
by Shocks » Tue Oct 14, 2003 11:15 am
I think this should work for ya. If Im wrong someone will correct me.
Code: Select all
| Follow.mac
|
| - Playing with simple code -
|
|
|
| Usage: /macro Follow "Your Name"
|
|
#Turbo
#Event FollowOff "You are no longer auto-following"
Sub Main (paramTarget)
/if $defined(paramTarget)==FALSE {
/echo Please pass in the targets's name
/return
}
/declare FollowTarget Global
/varset FollowTarget @paramTarget
/call FollowIt
/return
Sub FollowIt
:LoopFollow
/if $char(state)==SIT /stand
/target @FollowTarget
| Here I would add a detect for no target. | /if $target==False /something
/face fast nopredict
/if n $target(distance)>10 /sendkey down up
/if n $target(distance)<10 /sendkey up up
/doevents
/goto :LoopFollow
/return
Sub Event_FollowOff
/press esc
/press esc
/press esc
/press esc
/press esc
/delay 5
/tell @FollowTarget >> Auto Follow Off. <<
/return
-
Zxeses
- a ghoul

- Posts: 103
- Joined: Tue Jan 07, 2003 4:17 pm
Post
by Zxeses » Tue Oct 14, 2003 11:19 am
Let me offer this alternative:
Code: Select all
|
| Usage: /macro Follow "Player name to follow"
|
|
#Turbo
Sub Main(Follow)
/if $defined(Follow)==FALSE {
/echo Usage: /macro Follow "Player name to follow"
/return
}
/target PC @Follow
/if $char(state)==SIT /stand
:LoopFollow
/if n $target(distance)>10 /sendkey down up
/if n $target(distance)<10 /sendkey up up
/face fast nopredict
/if $target()=FALSE /call FollowOff
/goto :LoopFollow
/return
Sub FollowOff
/cleanup
/delay 5
/tell @Follow >> Auto Follow Off. <<
/endmacro
/return
-
blueninja
- a grimling bloodguard

- Posts: 541
- Joined: Thu Aug 28, 2003 7:03 am
- Location: Göteborg, Sweden
Post
by blueninja » Tue Oct 14, 2003 4:39 pm
Looks good. Problems/suggestions I noticed (looks like the other guys caught it too but I'll try to explain it instead of giving code):
You would never trigger the event since that text only shows up if you are using the builtin EQ /follow command. I'd put a check for the target in the follow loop like Shocks and Zxeses have done.
You are also missing a /return from the main sub, and a /call FollowIt also in the main sub. To be honest I don't know what would happen if you run the code like this but you should end a sub correctly with /return and call the follow sub from within the main sub. When main sub reaches it's end, the program ends.
I'd put a /sendkey up up in the FollowOff sub in case the user has set the keep keys toggle to on. Otherwise the char would keep running unless he was <10 feet away from the target when he broke out of the follow loop.
-
Guest
Post
by Guest » Tue Oct 14, 2003 5:39 pm
Thanks for the replys and the sample code. I could real quick become a HO and just copy past. But I want to understand how /declare /varset etc... works instead of coming here an asking for minor changes to macros.
Couple of simple questions I bet:
Instead of /sendkey up up can I just do /sit ? I know about agro but this would stop the bot in its tracks.
Also, Can I do away with followoff all together and just add the lines under the if $target()=FALSE line?
Code: Select all
| Follow.mac
|
| - Playing with simple code -
|
|
|
| Usage: /macro Follow "Your Name"
|
|
#Turbo
Sub Main (paramTarget)
/if $defined(paramTarget)==FALSE
/say Invite again Please
/return
/declare FollowTarget Global
/varset FollowTarget @paramTarget
/call FollowIt
/return
Sub FollowIt
:LoopFollow
/if $char(state)==SIT /stand
/target @FollowTarget
/if $target==False {
/cleanup
/tell @Followtarget >>>I'm not Following YOU<<<
/sit
/return
}
/face fast nopredict
/if n $target(distance)>10 /sendkey down up
/if n $target(distance)<10 /sendkey up up
/goto :LoopFollow
/return
-
Tuffy
- a lesser mummy

- Posts: 33
- Joined: Thu Oct 02, 2003 9:20 am
Post
by Tuffy » Tue Oct 14, 2003 5:41 pm
Forgot to log in. I have my work pc to clear all cookies and crap when I log off.
-
blueninja
- a grimling bloodguard

- Posts: 541
- Joined: Thu Aug 28, 2003 7:03 am
- Location: Göteborg, Sweden
Post
by blueninja » Tue Oct 14, 2003 6:41 pm
Yes that should work.
You need to put brackets around the code block in the first /if statement though.
Code: Select all
/if $defined(paramTarget)==FALSE {
/say Invite again Please
/return
}