I was going to just give you hints to see if you were actually willing to work on this, but I ended up just doing it. This is pretty basic and could be improved but you'll have to ask questions about it if you want something more and I'll try to show you how. Tried to comment so you'd see why I did certain things. Took some liberties with what I was guessing you were trying to do. I added a hotkey to change who you are following. OnHotKey works regardless of what client you're playing on or if the client is minimized so keep that in mind when setting it to something. Currently set to the "HOME" Key
Some things you may consider adding:
-If your character you are following dies you pause script so when you switch clients it won't screw you up trying to follow the ghost or keep you from running away. You could also try to cast Invisibility or use hiding skill.
-Cast spells on your main character or cross heal. Heal and cure yourself if you're not currently pathfinding. If you use bandages on follow character you could just apply a bandage on the run.
-Accept trade if you drop something on your slave character.
-Move 1 tile off your character instead of always being right on top.
This may just be all you wanted and so enjoy but if you want to actually learn I suggest adding more and asking or looking up anything in this small script that doesn't make sense to you.
There are many ways of doing these kinds of scripts so keep that in mind if you had a different idea on what you wanted to do I just assumed a lot from what little you had.
set %Hotkey Home ;Follow someone Else on the fly change to any key
gosub chooseTarget
mainloop:
Onhotkey %Hotkey ;Follow Someone Else
gosub chooseTarget ;Need "gosub" not sub.
gosub followTarget ;Need "gosub" not sub.
goto mainloop
sub chooseTarget
event ExMsg #CHARID 3 0 Click on the player you want to follow.
set #targcurs 1
while #TARGCURS = 1 ; This will just wait for
wait 20 ; the target cursor to change
set %targetID #ltargetid
return
sub followTarget
findItem %targetID G_16 ;Got to find X and Y of what you want to follow
Wait 1
set %Timer #SCNT + 3 ;Timer so it doesn't get stuck if X and Y no good
If #CHARPOSX <> #FindX || #CHARPOSY <> #FindY
{
event PathFind #FindX #FindY ;This is how you get your dude to move to coords
while #CHARPOSX <> #FindX && #CHARPOSY <> %CharY ;waiting for you to get there
{
wait 10
if %Timer < #SCNT
break ;Break you out of the while loop if it's taking too long
}
}
Return
Some documentation:While Loop
http://wiki.easyuo.com/index.php?title=WhileBreak
http://wiki.easyuo.com/index.php?title=BreakIf Statement
http://wiki.easyuo.com/index.php?title=IfGosub
http://wiki.easyuo.com/index.php?title=GosubHotkey
http://wiki.easyuo.com/index.php?title=OnHotKeyEvent Pathfind
http://wiki.easyuo.com/index.php?title=Event_PathFindVariables
http://wiki.easyuo.com/index.php?title=Variables