I've been working on a woodcutting script that chop two of the three oaks west of varrock. The Script is based on reflection, so I used the reflection function "ClickTree". This works fine, but it is not fast enough for me. I now want to write my own function to do this "ChopTree", but I keep getting a anoying error:
[Error]: Access violation at address 00529714 in module 'scar.exe'. Read of address 00000228
This is the function:
Where the number 1281 is the ID of a oak tree.Code:function ChopTree :Boolean ; var x,y:Integer; MSPoint:Tpoint; begin if(GetObjectAt(3168,3421).objType = 1281) then begin MSPoint := TileToMS(Point(3168,3421),10); MMouse(MSPoint.x,MSPoint.y,5,5); wait(100+random(30)); getMousePos(x,y); Mouse(x,y,0,0,true); Result:= true; end else begin if(GetObjectAt(3162,3417).objType = 1281) then begin MSPoint := TileToMS(Point(3162,3417),10); MMouse(MSPoint.x,MSPoint.y,5,5); wait(100+random(30)); getMousePos(x,y); Mouse(x,y,0,0,true); Result:= true; end; end; end;
Where Point(3162,3417) and (3168,3421) are there Tiles.
I want to check if the tree has already been cut, so I look at the tiles to check the ID number... but that line causes that error...
Does anyone knows what I am doing wrong?![]()






Reply With Quote




Rep++
