You don't need to have multiple functions, you could pass an argument to a single function and have it to different things depending on that argument:
function afkBot(%dir)
{
cancel($afkBot);
switch(%dir)
{
case 0:
moveForward(1);
schedule(500,0,moveForward,0);
case 1:
moveRight(1);
schedule(500,0,moveRight,0);
case 2:
moveBackward(1);
schedule(500,0,moveBackward,0);
case 3:
moveLeft(1);
schedule(500,0,moveLeft,0);
}
%dir++;
if(%dir >= 3)
%dir = 0;
$afkBot = schedule(1000,0,afkBot,%dir);
}
Just an example.