by Robben_DuMarsch » Thu Oct 10, 2013 8:51 pm
Huh, odd. It broke for me too, using KT's client. Here is the script, for any who care:
I am skeptical there is a "map error" that the OP is referring to. The closest thing to a "map error" I can see would be the client no longer being able to retrieve position, which seems silly. I am curious as to if Loftar made any changes to the Haven code, however. Things tend to not break spontaneously.
- Code: Select all
void main() {
def a = selectArea("Select area to harvest.")
if (a == null)
return;
def walker = new AreaWalker(a)
for (tile in walker.eachTile()) {
tile_work(tile)
}
}
void tile_work(tile)
{
if( Stamina < 65 )
{
print "refill sta"
refill_stam();
print "refill sta end"
}
//TODO
// check_Inventory();
processHarvestTile(tile);
if (rePlant == 1)
{
plantSeed ();
}
if(pumpkin) pumpkinate();
}
/********************************************************
***** HARVESTING/PLANTING *****
********************************************************/
void processHarvestTile(tile)
{
int id;
int stage;
def p = getMyCoord()
id = findMapObject("", 2, tile.tileX - p.tileX, tile.tileY - p.tileY);
if (id > 0) {
stage = getObjectBlob(id, 0);
if (stage >= flower_stage)
{
if (getCursor() != "harvest")
{
sendAction("harvest");
waitCursor("harvest");
}
doClick(id, 1, 0);
waitHourglass();
}
}
}
void plantSeed() {
def BestItem=null;
int MaxQ=0;
for (item in getInventory("Inventory").getItems()) {
if (isSeed(item)) {
if (item.getQuality()>MaxQ) {
MaxQ=item.getQuality();
BestItem=item;
}
}
}
if (BestItem==null) return;
int ix=BestItem.row;
int iy=BestItem.column;
BestItem.take();
waitDrag();
mapInteractClick(0, 0, 0);
Thread.sleep 100;
// If seed planting failed, return it to inventory
if (hasDragItem())
{
getInventory("Inventory").drop(ix, iy);
}
}
static boolean isSeed(item)
{
if (item.isName("carrot") ||
item.isName("peapod") ||
item.isName ("seed-grape") ||
item.isName ("flaxseed") ||
item.isName ("seed-wheat") ||
item.isName ("seed-pumpkin") ||
item.isName ("seed-carrot") ||
item.isName ("seed-pepper") ||
item.isName ("seed-hemp") ||
item.isName ("seed-hops") ||
item.isName ("seed-poppy") ||
item.isName ("seed-tea") ||
(item.isName ("beetroot") && !item.isName ("leaves") && !item.isName ("Weird")))
return true
else
return false
}
/********************************************************
***** OTHER *****
********************************************************/
void resetCursor()
{
if (getCursor() != "arw")
{
mapClick(0,0,3,0);
waitCursor("arw");
}
}
void refill_stam()
{
if( rouse == 1 )
{
say(":rouse");
while(Stamina < 95) Thread.sleep(100);
}
if( water == 1 )
{
resetCursor();
mapAbsClick(getMyCoordX(), getMyCoordY(),1, 0);
drinkWater(true);
while(Stamina < 90) Thread.sleep(100);
}
}
void pumpkinate()
{
Thread.sleep(300)
for (item in getInventory("Inventory").getItems())
{
if (item.isName("pumpkin"))
{
item.act()
waitContextMenu().select("Slice")
}
}
Thread.sleep(300)
for (item in getInventory("Inventory").getItems())
{
if (item.isName("flesh")||item.isName("seed"))
{
item.take()
waitDrag()
drop()
}
}
}
Last edited by Robben_DuMarsch on Thu Oct 10, 2013 8:59 pm, edited 1 time in total.