Something like this looks a lot cleaner:
Combined all functions into one, with a switch.
Instead of having a random number of seconds, then using if...else to schedule according to the time, just use the random generated number as the time
Combined forgetton of yaw calls into one
function afkBot(%dir)
{
cancel($afkBot);
%time = getRandom(1000,3000);
%dir = getRandom(0,4);
switch(%dir)
{
case 0:
moveForward(1);
schedule(%time,0,moveForward,0);
case 1:
moveRight(1);
schedule(%time,0,moveRight,0);
case 2:
moveBackward(1);
schedule(%time,0,moveBackward,0);
case 3:
moveLeft(1);
schedule(%time,0,moveLeft,0);
case 4:
jet(1);
schedule(%time,0,jet,0);
}
yaw(getRandom(80,800));
%time += getRandom(1000,3000)
$afkBot = schedule(%time,0,afkBot,%dir);
}
I'm not sure of a way that's not hacky
Because:pseudo-code means it's not actual code, it's just meant to give you the idea of the logic
Thanks, but it gives me syntax errors, at the 2nd to last line where you define $afkBot