SRL Archive - OSR Outdated / Broken Scripts

Cathy Yews


vizzyy

2014-03-15 02:14:26

Fuckyewsbot

Start in cathy. Axe in first inv spot. I don't use this anymore but it is pretty damn solid.

Requires OSR , reflection, smart. if you get any errors referencing those things then you have failed to correctly download and install something. God speed, minions.

Note:
Uses reflections find obj to find trees without actually looking for them. this is the tits, but sometimes the client fails to register the object has changed for a little while longer than the actual animation.




program YewTreeBanker;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR/SRL/misc/al_functions.simba}

var
CurTime, ProgTime,worldtime,timesswitched,ents,birdsnest, ProgBank ,died, TreeFail, randoms, Lagg,brokentimes, TreeColor,j: integer;
pin,axetype,version: string;
toTrees,toBank,cathybankspots:TPointArray;
myloc,currentTree:TPoint;
nearbynpc:tnpcarray;
USE_AUTO_CHECKER,skiller:boolean;

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
SetScreenName(Players[CurrentPlayer].Nick);

skiller:=true; //skiller = axe in inventory
pin:=''; //bankpin if you have one
USE_AUTO_CHECKER:=true; //whether to auto check for script update
AxeType:='Dragon axe'; //axe type ex: "Dragon axe" "Rune axe"
End;

procedure initVars;
begin

R_RunAwayDirection := 'random';
R_Reincarnate := false;
R_CombatRandoms := True;
version:='2';
TreeColor:= 2702653;
MarkTime(ProgTime);
MarkTime(worldtime);
treefail:=0;
timesswitched:=0;
ProgBank := 0;
died:=0;
brokentimes:=0;
randoms:=0;
birdsnest:=0;
toTrees := [Point(2809 + RandomRange(-2, 2), 3441 + RandomRange(-2, 2)), Point(2805 + RandomRange(-2, 2), 3434 + RandomRange(-2, 2)), Point(2793 + RandomRange(-2, 2), 3432 + RandomRange(-2, 2)), Point(2780 + RandomRange(-2, 2), 3431 + RandomRange(-2, 2)), Point(2764 + RandomRange(-2, 2), 3430 + RandomRange(-2, 2)), Point(2758 + RandomRange(-2, 2), 3430 + RandomRange(-2, 2))];
toBank:=[Point(2759 + RandomRange(-2, 2), 3431 + RandomRange(-2, 2)), Point(2768 + RandomRange(-2, 2), 3430 + RandomRange(-2, 2)), Point(2780 + RandomRange(-2, 2), 3429 + RandomRange(-2, 2)), Point(2795 + RandomRange(-2, 2), 3433 + RandomRange(-2, 2)), Point(2807 + RandomRange(-2, 2), 3435 + RandomRange(-2, 2)), Point(2810 + RandomRange(-2, 2), 3441 + RandomRange(-2, 2))];
cathybankspots:=[point(2807,3442),point(2809,3442),point(2810,3442),point(2811,3442)];
end;

procedure ElfMouse(x, y: integer);//AntiBan Mouse Function
var
Cx, Cy: Integer;
begin
GetMousePos(Cx, Cy);
AL_SetMouseSpeed(20);
case Random(5) of
0: AL_BrakeWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 5, True);
1: AL_HumanWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 5);
2: AL_AccurateMMouse(IntToPoint(x, y), 2, 2);
3: AL_HumanMMouse(IntToPoint(x, y), 2, 2);
4: AL_ShiftWindMouse(Cx, Cy, x, y, 15 + Random(10), 5 + Random(15), 5, 10, 20, 5);
5: AL_MissMouse(IntToPoint(x, y), 2, 2);
end;
end;


procedure AutoUpdateMe;//Credit Shuttleu , elfy
var
ThisFile: integer;
OnlineVersion, NewScript, FileNew: string;
begin
if USE_AUTO_CHECKER then
begin
writeln('Checking for script updates...');
OnlineVersion := GetPage('http://pastebin.com/raw.php?i=ZtYjbggJ');
writeln('Online version: '+OnlineVersion);
writeln('Current version: '+Version);
if (trim(OnlineVersion) > Version) then
begin
writeLn('Using Outdated Script!!');
writeLn('Updating to New Version.');
NewScript := GetPage('http://pastebin.com/raw.php?i=c2Mff4jF');
FileNew := ScriptPath + 'FuckYewsBot-V' + OnlineVersion + '.simba';
ThisFile := Rewritefile(FileNew, true);
try
WriteFileString(ThisFile, NewScript);
except
begin
writeLn('Failed writting to ' + FileNew + '!!');
terminatescript;
end;
end;
CloseFile(ThisFile);
writeLn('New script downloaded to ' + FileNew + '!! Please use this one!!');
TerminateScript;
end;
if (trim(OnlineVersion) = Version) then
writeLn('You Are Updated To the Lastest Version!');
end
else
WriteLn('!!!!! Not checking for latest version, you may be outdated!');
end;

procedure ProgressReport;
begin
cleardebug;
MarkTime(CurTime);
writeln('Banked ' + inttostr(ProgBank) + ' invs in ' + inttostr(((TimeFromMark(ProgTime) / 1000) / 60)) + ' mins.');
writeln('Birds Nests: '+inttostr(birdsnest)+'. Died: '+inttostr(died));
writeln('Times Axe Broken: '+inttostr(brokentimes)+'. Random Events: '+inttostr(randoms)+', WorldSwitches: '+inttostr(timesswitched));
writeln(nearbynpc);
end;

function FindBirdsNest1: Boolean;
var // seed nest [(5073, 1, (2726, 3492)), ring nest (5074, 1, (2726, 3493))]
i: Integer;
itemsInArea:TGroundItemArray;
begin
itemsInArea:=R_GetGroundItemsDistance(10);
for i:=0 to high(itemsInArea) do
begin
if((itemsInArea[i].ID = 5073) or (itemsInArea[i].ID = 5074)) then
begin
birdsnest:=birdsnest+1;
Writeln('Birds Nest Found.');
Result:=R_ChooseOptionTile('Take',itemsInArea[i].Tile);
end;
end;
end;

function withinZone(topLeft,botRight: tpoint): boolean;
begin
MyLoc:=R_GetTileGlobal;
if((myloc.x>=topLeft.x) and (myloc.x<=botRight.x) and (myloc.y<=topLeft.y) and (myloc.y>=botRight.y)) then
begin
result:=true;
end
else
begin
result:=false;
end;
end;

function withinBank: boolean;
begin
result:=withinZone(point(2806,3441),point(2812,3438));
end;

function isatTrees: boolean;
begin
result:=withinZone(point(2752,3435),point(2770,3425));
end;

function Banker(spot: tpoint): boolean;
var
tile:tpoint;
begin
makecompass('n');
Tile:= R_TileToMs(spot);
elfmouse(tile.x,tile.y);
wait(randomrange(500,600));
if(random(2) = 1) then
begin
ClickMouse2(Mouse_Left);
Wait(1000+random(300));
end
else
begin
ClickMouse2(Mouse_Right);
R_ChooseOption('Bank booth');
Wait(1000+random(300));
end;
if(pinpending) then
confirmpin;
if(pinscreen) then
inpin(pin);
if(bankscreen) then
begin
result:=true;
end
else
result:=false;
end;

function AmIDead1: boolean;
begin
if(R_GetHealth = 0) then
begin
result:=true;
end
else
result:=false;
end;

procedure BankLogs;
begin
writeln('Bank logs');
wait(lagg);
if(BankScreen) then
begin
if(not Skiller) then
QuickDeposit('inv');
if(skiller) then
Deposit(2,28,true);
end;
ProgBank := ProgBank + 1;
end;

function setRun1(Enable: Boolean): Boolean;
var
x,y : Integer;
begin
Result := False;
if not loggedin() then
Exit;

if Enable then
begin
if findColorTolerance(x, y, 28552, 571, 127, 595, 152, 20) then
begin
result := true;
exit;
end else
begin
mouseBox(545, 130, 590, 150, MOUSE_LEFT);
result := true;
exit;
end;
end else if not Enable then
if findColorTolerance(x, y, 28552, 571, 127, 595, 152, 20) then
begin
mouseBox(545, 130, 590, 150, MOUSE_LEFT);
Result := True;
end;
end;

procedure GoToBank;
begin
setRun1(True);
R_WalkPath(tobank);
Wait(1300+random(300));
end;

procedure CheckAxeBroken;
begin
if(skiller)then
begin
invmouse(1,3);
end
else
begin
ftab(tab_Equip);
wait(1000+random(100));
elfMouse(592,303);
wait(1000+random(100));
end;
if(isuptext(AxeType)) then
writeln('Axe good.');
if(isUpText('Broken')) then
begin
Writeln('Axe has been broken, powering down.');
Gotobank;
Logout;
terminatescript;
end;
end;

Function FindEnt: boolean;
var
ent:tnpc;
begin
if (R_FindNpc('Yew tree', ent)) then
begin
nearbynpc:=R_GetAllNpcs;
if(ent.tile = currentTree) then
begin
ents:=ents+1;
Writeln ('An ent has been detected, getting off...');
R_BlindWalk(Point(R_gettileglobal.x+randomrange(-2,2),R_gettileglobal.y+randomrange(-2,2)));
WriteLn ('Waiting a moment for the ent to go away...');
result:=true;
end;
end
else
result:=false;
end;

procedure GoToTrees;
begin
setRun1(True);
R_WalkPath(totrees);
if(not isattrees) then
R_BlindWalk(point(2761,3430));
end;

function pointNotOnScreen(point:tpoint): boolean;
var
pointtile:tpoint;
begin
result:=false;
pointtile:=R_TileToMsHeight(point,R_GetTileHeight(point));
if((pointtile.x<MSX1)
or (pointtile.x>MSX2)
or (pointtile.y<MSY1)
or (pointtile.y>MSY2)) then
result:=true;
end;

function R_ChooseOptionTileUptext2(Option, TileUptext: String; Tile: TPoint): Boolean; //changed a little to minimize forloop
var
i, Tilex, Tiley: Integer;
Tile2: TPoint;
begin
Result:= false;
Tile2:= R_TileToMs(Tile);
if (Tile2.x = 0) then
Exit;
Tilex:= Tile2.x;
Tiley:= Tile2.y;
for i:=1 to 3 do
begin
MouseBox(Tilex-i, Tiley-i, Tilex+i, Tiley+i, mouse_move);
wait(103 + random(88));
if IsUpTextMultiCustom([TileUptext]) then
begin
ClickMouse2(false);
wait(103 + random(288));
Result:= R_ChooseOptionMultiEx([Option], 'action', ClickLeft);
Result:=true;
end;
wait(100 + random(50));
end;
end;

procedure ChopTree;
var
i,treeID:integer;
treeLocations: tpointArray;
begin
treeLocations:=[point(2755,3434),point(2756,3431),point(2758,3434),point(2761,3432),point(2760,3428),point(2766,3428)];
if(not isatTrees) then
gototrees;
for i:=0 to high(treeLocations) do
begin
currentTree:=R_GetObjectAt(0,treeLocations[i]).Tile;
treeID:=R_GetObjectAt(0,treeLocations[i]).ID;
if((treeID = 2111) and (not findent)) then
begin
if(pointNotOnScreen(currentTree)) then
begin
R_BlindWalkMS(point(currentTree.x+randomrange(-2,2),currentTree.y+randomrange(-2,-1)));
repeat
wait(random(300));
until(not r_iswalking);
end;
if(not r_iswalking) then
begin
if(random(2) = 1) then
begin
currentTree:=R_GetObjectAt(0,treeLocations[i]).Tile;
R_ChooseOptionTileUptext2('Chop','Yew',R_TileToMsHeight(treeLocations[i],R_GetTileHeight(treeLocations[i])));
AL_HumanRandomMouse;
wait(2000+random(500));
exit;
end
else
begin
currentTree:=R_GetObjectAt(0,treeLocations[i]).Tile;
elfmouse(R_TileToMsHeight(treeLocations[i],R_GetTileHeight(treeLocations[i])).x, R_TileToMsHeight(treeLocations[i],R_GetTileHeight(treeLocations[i])).y);
ClickMouse2(Mouse_Left);
AL_HumanRandomMouse;
wait(2000+random(500));
exit;
end;
end;
end
else
continue;
end;
end;

Procedure Antiban;
begin
findent;
if(r_isanimating) then
begin
case random(45) of
1: HoverSkill(randomrange(1,23), False);
2: HoverOnlineFriend;
3: compassmovement(100,150,false);
4..7: BoredHuman;
8: setRun1(True);
9: RandomFKeys(false);
10: MMouseOffClient('random');
11: PressKey(randomrange(1,4));
12..15: AL_HumanRandomMouse;
end;
wait(1000+random(300));
end;
end;

begin
SetupSRL();
DeclarePlayers;
ActivateClient;
SetupReflection;
ClearDebug;
initVars;
AutoUpdateMe;
AddOnTerminate('srl_freebitmaps');
writeln('Welcome to Fuck Yews Bot.');
If (Not LoggedIn) Then
begin
LogInPlayer;
end;
makecompass('n');
checkaxebroken;
setAngle(Srl_angle_high);
repeat

if(FindBirdsNest1) then
Birdsnest := Birdsnest + 1;

if(findchatboxtext('You do not have',8,0))then
begin
checkaxebroken;
end;

if(not R_NearTile(point(2761,3430),300))then
begin
writeln('Somethings fucked, we are way too far.');
logout;
TerminateScript;
end;

ProgressReport;

FindEnt;
if(R_FindNormalRandoms) then
randoms:=randoms+1;
if(solvebox) then
randoms:=randoms+1;

if(invfull) then
begin
gotobank;
if(withinBank) then
begin
for j:=0 to 4 do
begin
banker(cathybankspots[randomrange(0,3)]);
if(bankscreen) then
break;
end;
end
else
R_BlindWalk(point(2809,3440));
banklogs;
closebank;
end
else
begin
if((not R_isAnimating) and (not R_isWalking) and (not invfull)) then
choptree;
end;

AntiBan;
until (not LoggedIn)
end.

Pakyakkistan

2014-03-15 11:11:04

Very nice script. I can learn a thing or two from this. Well done Viz!

vizzyy

2014-03-15 11:33:26

From: Pakyakkistan
Very nice script. I can learn a thing or two from this. Well done Viz!


Thank you. I've been combing through all the reflection methods and there are some incredible things you can do with them. Please let me know if you have any questions, or if you see any blatant errors in performance .

Frement

2014-03-15 12:10:46

I ran it for a hour, you might want to tweak the tree gone detection, stood at the gone tree for 10-20 seconds before moving to a new tree, yew logs per hour was around 115. (72 wc with dragon axe)

vizzyy

2014-03-15 12:56:51

From: Frement
I ran it for a hour, you might want to tweak the tree gone detection, stood at the gone tree for 10-20 seconds before moving to a new tree, yew logs per hour was around 115. (72 wc with dragon axe)


Thanks for your input. My understanding is that the r_getobjectat returns a full tree ID and thus it sits there thinking it's still good. It's odd because with magic trees it's much snappier.

Frement

2014-03-15 13:02:05

From: vizzyy
Thanks for your input. My understanding is that the r_getobjectat returns a full tree ID and thus it sits there thinking it's still good. It's odd because with magic trees it's much snappier.


pointtile:=R_TileToMsHeight(point,R_GetTileHeight(point));
In the case of a yew tree, the height should be around 200, the function already gets R_GetTileHeight and adds the Height you input, to that value.

These are the ID's I use in my script:
YEW_NORMAL = 2104;
YEW_CUT = 9714;

EDIT; The reason your R_TileToMSHeight works, is because the tiles height is 200-240.

vizzyy

2014-03-15 15:32:07

From: Frement
pointtile:=R_TileToMsHeight(point,R_GetTileHeight(point));
In the case of a yew tree, the height should be around 200, the function already gets R_GetTileHeight and adds the Height you input, to that value.

These are the ID's I use in my script:
YEW_NORMAL = 2104;
YEW_CUT = 9714;

EDIT; The reason your R_TileToMSHeight works, is because the tiles height is 200-240.


All the tree codes changed with the most recent wildy update. I'm not sure 2104 works anymore, I had to rescan just the other day to get 2111.
So what you're saying is my TiletoMSheight works by chance, despite doubling up on the height?

Frement

2014-03-15 16:16:20

From: vizzyy
All the tree codes changed with the most recent wildy update. I'm not sure 2104 works anymore, I had to rescan just the other day to get 2111.
So what you're saying is my TiletoMSheight works by chance, despite doubling up on the height?


Yes, it works by chance :) If you used the same thing for a rock, it would most likely "overshoot".

vizzyy

2014-03-15 16:33:53

From: Frement
Yes, it works by chance :) If you used the same thing for a rock, it would most likely "overshoot".


Thank you for pointing it out. I'll have to improve upon that later.

poop123456

2014-06-03 17:53:01

Unknown identifier 'R_ChooseOptionTile' at line 131
Compiling failed.

MirSar

2014-06-10 18:07:50

I tried running it and I had a lot of errors.
First off is the one poop123456 pointed out, this I fixed by commenting out the FindBirdsNest1 function, I really don't need that anyways. (and the "if" in the main loop)

Then at line 333, that's not working, changed it to - Result:= R_selectOption('Drop');

Fair enough, now it is running. I start off in the bank and it runns as it should to the trees. and stands still, for about 2 min until I Disable and Enable smart. Then it finds and clicks a tree.
Tree is chopped down, I got 10 logs, and it stands still, for another 2 min until I have to disable and enable smart.
Not sure what causes this… the antiban sequence is not running and it looks like it is searching for a color. (based on the output of java)

Then I have filled my inventory with yew manually, it detects it and runs towards the bank. last point have a tendency to get outside the bank, so removed the Randomrange from that.

But now it can't open the bank, looks like it can't find it at all. And here is where I got tired of trying to fix it myself with my limited knowledge of scripting.

I hope this information will prove helpful. The script looks very good, but the current buggs makes it unusable.

wegginger

2014-06-14 18:05:19

Could this script be adapated to fit a 'yew gnome home stronghold cutter'? Would really be interested in this.