Good examples of follow code

Artemus

Lifetime Member
Joined
May 30, 2006
Messages
1,048
Reaction score
9
Points
38
One of the biggest headaches in my homebrew is having to start them, stick them to the tank and move them. I want to add commands to stand, stick to the tank, move to the new spot and then park it. I can't find squat, and trying to reverse engineer macros like AutoBot and Bot are just a headache because they are so comprehensive.

So is there a good example of simple code to make a bot follow the tank?
 
I always just used /stick to move them around.

Sent from my SAMSUNG-SGH-I317 using Xparent Skyblue Tapatalk 2
 
If you are using a private bot chat channel aka /bc then its really easy.

Using bc and advpath I would do the following:

/bcaa //afollow

and when I get where I'm going

/bcaa //afollow off

if you are doing this with out a chat channel I would set up a custom event inside your macro.

I'd make a couple event to trigger on commands in group for "follow me" and "this is camp" that call /afollow on|off.
 
Unfortunately, I never learned BC. Just coding is challenge enough. Here's what I got now but it's not working. Not even being called.

Code:
Sub Event_Move
/echo event Move
  /varset Mobile TRUE
     /delay 1s
  /if (${Me.Class.Name.Equal[Shaman]}) {
     /if (${NearestSpawn[radius 30 zradius 30 fsp].ID}) {
        /windowstate FellowshipWnd open 
        /nomodkey /notify FellowshipWnd FP_Subwindows tabselect 2
        /delay 1s 
        /nomodkey /notify FellowshipWnd FP_DestroyCampsite leftmouseup
        /delay 10s ${Window[ConfirmationDialogBox].Open}
        /gsay Pulling up Fellowship...
        /nomodkey /notify ConfirmationDialogBox Yes_Button leftmouseup
        /delay 2s 
        /windowstate FellowshipWnd close
     }
  /stand
  /target ${tank}
  /gsay Ready to move out!
  /face
  /stick 20
 :MoveLoop
  /doevents
  /delay 1s
  /face
  /if (${Mobile}) /goto :MoveLoop
  /gsay Parking it here.
  /target clear
  /stick off
/return
 
Bot is actually broken out by each sub, which is what makes it bulky, but easier to read.

This is the entire code for all methods of following:
Code:
|follow start
Sub FollowLoad
/if (${FollowLoaded}) /return
/if (!${Defined[FollowLoaded]}) /declare FollowLoaded int outer 1
/declare FollowMethod string outer ${Ini[MyIni,Follow,FollowMethod]}
/if (!${FollowMethod.Length}||${FollowMethod.Equal[NULL]}) /ini "MyIni" "Follow" "FollowMethod" "stick|30 healer"
/declare DistanceToFollow int outer ${Ini[MyIni,Follow,DistanceToFollow,30]}
/if (!${DistanceToFollow}) /ini "MyIni" "Follow" "DistanceToFollow"
/declare FollowCommand string outer ${Ini[MyIni,Follow,FollowCommand]}
/if (!${FollowCommand.Length}||${FollowCommand.Equal[NULL]}) /ini "MyIni" "Follow" "FollowCommand" "FollowCommand"
/declare StopFollowCommand string outer ${Ini[MyIni,Follow,StopFollowCommand]}
/if (!${StopFollowCommand.Length}||${StopFollowCommand.Equal[NULL]}) /ini "MyIni" "Follow" "StopFollowCommand" "StopFollowCommand"
/declare MoveUpCommand string outer ${Ini[MyIni,Follow,MoveUpCommand]}
/if (!${MoveUpCommand.Length}||${MoveUpCommand.Equal[NULL]}) /ini "MyIni" "Follow" "MoveUpCommand" "MoveUpCommand"
/if (!${Defined[Following]}) /declare Following int outer
/if (!${Defined[MoveID]}) /declare MoveID int outer
/if (!${Defined[NameToFollow]}) /declare NameToFollow string outer
/squelch /moveto set trytojump on
/squelch /moveto set stucklogic on
/return

Sub Follow
/if (!${Defined[FollowLoaded]}) /call FollowLoad
/if (!${Spawn[id ${MoveID}].ID}||!${Following}) /return
/if (${Spawn[id ${MoveID}].Distance}>${DistanceToFollow}) {
    /if (${Me.Casting.ID} && !${Me.Class.ShortName.Equal[BRD]}) /delay 5s !${Me.Casting.ID}
    /if (${FollowMethod.Find[nav]} && !${Navigation.Active}) /navi name "${NameToFollow}"
    /if (${FollowMethod.Find[stick]} && !${Stick.Distance}) /stick id ${MoveID} ${FollowMethod.Arg[2,|]}
    /if (${FollowMethod.Find[adv]} && ${AdvPath.State}!=1) /afollow spawn ${MoveID}
    /if (${FollowMethod.Find[keypress]} && !${Me.Moving}) /call MoveToLoc ${Spawn[id ${MoveID}].Y} ${Spawn[id ${MoveID}].X}
}
/return

Sub Event_Follow(followname,int moveup)
/if (!${Defined[FollowLoaded]}) /call FollowLoad
/if (!${Spawn[pc ${followname}].ID}) /return
/varset NameToFollow ${followname}
/varset MoveID ${Spawn[pc ${followname}].ID}
/echo Following ${NameToFollow} - ID: ${MoveID}
/if (!${moveup}) /varset Following 1
/varset UseCamp FALSE
/if (${FollowMethod.Find[nav]} && !${Navigation.Active}) /navi name "${NameToFollow}"
/if (${moveup}) {
    /moveto loc ${Spawn[id ${MoveID}].Y} ${Spawn[id ${MoveID}].X} ${Spawn[id ${MoveID}].Z} loose
    /return
}
/if (${FollowMethod.Find[stick]}) /stick id ${Spawn[pc ${followname}].ID} ${FollowMethod.Arg[2,|]}
/if (${FollowMethod.Find[adv]}) /afollow spawn ${Spawn[pc ${followname}].ID}
/call Follow
/return

Sub Event_StopFollow
/varset Following 0
/varset MoveID 0
/varset NameToFollow
/keypress back
/if (${Stick.Distance}) /stick off
/if (${FollowMethod.Find[adv]}) /afollow off
/return
|stop follow
TL:DR;
Code:
/declare Follow string outer follow me
/declare Stop string outer stop follow

#event Follow "#*#|${Follow}| #1#"
Sub Event_Follow(line,followID)
/stick id ${followID}
/return

#event Stop "#*#|${Stop}|#*#"
Sub Event_Stop
/stick off
/return
Then do a hotkey on the toon your playing:
/gsay follow me ${Me.ID}
or
/bc follow me ${Me.ID}
or whatever.
 
Ok Pete, I'll try not to be too intimidated by your code and make something work. :)

First thing I noticed is that there was an error in using id ${followID}. That was easily fixed as I had declared the tank early in the code and just said /stick ${tank}

Problem is with the return, he stands, sticks and sits. I need a second doevents to check for a stop command before sitting, although really I may not bother because I would want to manually move them into place. Need to think about that.

Update: I think I've got it. There's only one flaw: the tank has to target himself before giving the follow order. if I've targeted someone else, it will follow them. That's easy to remember.

Code:
/declare Follow string outer follow 
/declare Stop string outer stop 



#event Follow "#*#|${Follow}| #1#"
Sub Event_Follow(line,followID)
/stand
/tar ${tank}
/stick
:MoveLoop
/doevents
/delay 1s
/face
/if (${Me.State.Equal[STAND]}) /goto :MoveLoop
 /target clear
/return

#event Stop "#*#|${Stop}|#*#"
Sub Event_Stop
/stick off
/sit
/return
 
Last edited:
the point of /stick id ${ID} is that it doesnt require you to target anyone but you still stick to them. if it is always your tanks name, then you could do this:

/if (${Me.Name.NotEqual[${tank}]}) /stick id ${Spawn[${tank}].ID}

Code:
/declare Follow string outer follow 
/declare Stop string outer stop 



#event Follow "#*#|${Follow}|#*#"
Sub Event_Follow
/stand
/if (${Me.Name.NotEqual[${tank}]}) /stick id ${Spawn[${tank}].ID}
:MoveLoop
/doevents
/delay 1s
/if (${Me.State.Equal[STAND]}) /goto :MoveLoop
/squelch /target clear
/return

#event Stop "#*#|${Stop}|#*#"
Sub Event_Stop
/stick off
/sit
/return
 
Last edited:
Unfortunately, I never learned BC. Just coding is challenge enough. Here's what I got now but it's not working. Not even being called.

Take a few moments to understand EQBC, it really isn't that hard, but it will have a positive impact on your boxing. It's a must have plugin for people playing multiple toons. If you get stuck, shoot me a msg and I'll walk you through it.
 
I second this. EQBC is a GREAT tool. It can be a little scary getting it setup but it is well worth it.

For those who are not familiar with the concept I'll try a brief introduction:

EQBCS is a chat server that runs on your computer. Each instance of EQ uses a plugin MQ2EQBC to send and receive messages between clients that have made a connection to the server.

1. Messages are local which means more secure and much faster than making a round trip to EQ server and back.

2. Can issue commands to your characters in game using /bc <message>

3. Can use MQ2NetBots to pass character status between clients. This means you can get your hp, mana, target, etc w/o being in the same group or on xtarget.
 
3. Can use MQ2NetBots to pass character status between clients. This means you can get your hp, mana, target, etc w/o being in the same group or on xtarget

havent used netbots in a long time cause last I remember it used to crash eqbc, has that changed or how is it that anyone still uses netbots

i used to use it but its been yrs never heard anyone say , yea there are no issues anymore