Maybe use
.
Alternatively you could get all objects and work on them :
Code: Select all
objs = jGetObjects(5000, jCoord(0,0),'gfx/');
for (var i=0; i<objs.length; i++){
jPrint(objs[i].name());
if(objs[i].name().strpos('calf') != -1){
jPrint('is that a calf?')
}
}
Also a script to place signposts every 3 tiles from west to east (place first one, stick to it, and launch the script).
Simple one, but still interesting to understand how to place a "building", I did struggle a bit.
Code: Select all
//#! tooltip = Test
//#! name = Signs placer
//#! uniq = 0000000-000000-000000-MINE-SIGNS
include('jBotAPI');
//place sign every 3 tiles
for(var i=0; i<50; i++){
jOffsetClick(jCoord(4,0), 1); //move back
jSleep(200);jWaitEndMove();
jSendDoubleAction('bp','pow'); //make sign
jSleep(300);
jPlace(jCoord(-2,0), 1);
jSleep(200);jWaitEndMove();
while(!jHaveWindow("Pile of Wood")){
jSleep(10);
}
checkInventory().getItems('branch')[0].transfer();
jSleep(300);
if(checkInventory().getItems('branch').length == 0){
if(checkInventory().getItems('wood').length == 0){
break;
}else{
checkInventory().getItems('wood')[0].iact();
jSleep(200);
jWaitPopup();
jSelectContextMenu("Split");
jSleep(200);
}
}
}