I've got some problems with scripting. Maybe someone had same problems as me, and would be able to help me out

- Code: Select all
function _pf_move(coord) {
if (!jIsPathFree(coord))
{
resetCursor();
jPFMove(jTilify(coord));
while (jMyCoords().dist(jTilify(coord)) > 1)
{
jSleep(100);
}
return true;
}
else
{
resetCursor();
jAbsClick(coord,1,0)
while (jMyCoords().dist(coord) > 1)
{
jSleep(100);
}
return false;
}
}
function NewArrayWithout1stElement(arr) {
newarr = [];
for (var i = 1; i < arr.length; i++) {
newarr[i-1] = arr[i];
}
return newarr;
}
function main()
{
var hartling = jMyCoords();
var logs = jGetObjects(20,jCoord(0,0),"log");
while (logs.length>0)
{
var log = logs[0]
jPrint(log.position());
_pf_move(log.position());
jSleep(500);
jSendAction("carry");
jWaitCursor("chi");
jDoClick(log.getID(), 1, 0);
//_move_wait_for_stop();
//waitPFEndMove()
//jSleep(1000);
jSleep(1000);
_pf_move(jTilify(jMyCoords()));
//resetCursor();
jSleep(500);
_pf_move(hartling);
jSleep(500);
jAbsClick(jMyCoords(), 3, 0);
jSleep(500);
logs = NewArrayWithout1stElement(logs);
}
}
When it doesn't need PF, just a straight line, than it's fine (check it out). But when the time for PF comes..
So, my character picks up log, (he even PF to it, when it's unreachable by straight line) but he don't go back to start point (var hartling = jMyCoords();). My union client shows green path line, my character makes one step and than he stops. What I'm doing wrong? I've got problems with this PF functions every time I'm trying to use it

Kind Regards!

Oh and btw, mvgulik. GJ! Works like a charm

Edit:
I've tried different options (like PF from farmer script)
- Code: Select all
function _pf_move(coord) {
if (!jIsPathFree(coord))
{
resetCursor();
jPFMove(coord);
jWaitStartMove()
waitPFEndMove();
while (jIsMoving() || jMyCoords().dist(jTilify(coord)) > 1)
{
jSleep(100);
}
return true;
}
else
{
_move(coord)
return false;
}
}
But still no success. It get's more interesting, because farmer script is working fine for me
