Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {*+++++++++++++*}
- {+ Insructions +}
- {+ To Hide The Instructions Press the Minus '-' on the first line +}
- {+ Be sure to do your setup correctly! +}
- {*+++++++++++++*}
- {*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
- ================================================================================
- A|(InGame-Setup)
- A1) Brightness to highest.
- A2) Equip a ring of life.
- A3) Start either inside the bank or the Cook's shop.
- A4) Have Coins in your first inventory & bank slots.
- ______________________________________________________________________________
- B|(Script-Setup)
- B1) you need the SRL-OSR include, Smart8.3 & reflection.
- B2) If smart is already opened, pair it up before you launch the script.
- B3) Redefine your player settings to your choice.
- B4) If you launched and got an error, paste it at: http://ilya.xxx/ssf/
- ________________________________________________________________________________
- ================================================================================
- {Start of the script}
- program Pizbuyer;
- {$DEFINE SMART8}
- {$I SRL-OSR/SRL.Simba}
- {$I SRL-OSR/SRL/misc/al_functions.simba}
- {$I SRL-OSR/SRL/Reflection/Reflection.simba}
- var
- BankCord, shopcord: tpointarray;
- Fails, cx, cy, pizzasbought, potatobought, WorldsHopped: integer;
- Myloc: tpoint;
- const
- TermCheck = true; // Checks for Errors/Lost and terminates if they occur.
- UseReflection = true; // This is specific to NPC/Bank Booth finding only.
- BuysPizza = true; // Buy pizza?
- BuysPotato = true; // Buy Potato with cheese?
- procedure playerSetup;
- begin
- HowManyPlayers := 1;
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- Players[0].Name := 'zezima'; // username
- Players[0].Pass := 'iscool'; // password
- Players[0].Nick := 'ezim'; // 4 leters no capital letters/first letter.
- Players[0].pin := '1234' // bankpin
- Players[0].Active := True;
- end;
- procedure findallrandoms;
- begin
- if (UseReflection = true) then
- R_FindNormalRandoms;
- FindNormalRandoms;
- FindNonInventoryRandoms;
- end;
- procedure MMouseRandom(x, y: integer);
- 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 WaitHumanClick3;
- begin
- case random(600) of
- 1..450: Wait(RandomRange(3000, 5000));
- 451..570: Wait(RandomRange(5000, 5500));
- 571..590: Wait(RandomRange(6000, 6500));
- 591..600: Wait(RandomRange(7000, 7500));
- end;
- end;
- procedure myvars;
- begin
- BankCord := [point(2843, 3542)];
- shopcord := [point(2838, 3549)];
- end;
- procedure DebugPosition;
- begin
- repeat
- wait(400);
- Myloc := R_GetTileGlobal;
- writeln(Myloc);
- until (false);
- end;
- function GetGreenUptext: string;
- var
- WhiteT, BlueT, YellowT, OrangeT, GreenT, FoundText: string;
- begin
- WhiteT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 14541281, 55, 'UpChars07');
- BlueT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 13423640, 65, 'UpChars07');
- YellowT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 1235160, 40, 'UpChars07');
- OrangeT := GetTextAtExWrap(35, 8, 300, 21, 0, 5, 1, 4687583, 53, 'UpChars07');
- GreenT := GetTextAtExWrap(8, 8, 300, 21, 0, 5, 1, 120577, 65, 'UpChars07');
- FoundText := WhiteT + ' ' + BlueT + YellowT + OrangeT + GreenT;
- FoundText := ReplaceWrap(FoundText, '.', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '/', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '\', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, ',', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '*', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '^', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '"', '', [rfReplaceAll]);
- Result := FoundText;
- end;
- function IsUpTextMultiCustom2(Text: TStringArray): Boolean;
- var
- TheText: string;
- i, n: Integer;
- begin
- TheText := GetGreenUptext;
- n := High(Text);
- for i := 0 to n do
- if (Pos(Text[i], TheText) > 0) then
- begin
- Result := True;
- Exit;
- end;
- end;
- function WaitUpTextMulti2(S: TStringArray; Time: Integer): Boolean;
- var
- T: Integer;
- begin
- Result := false;
- T := GetSystemTime + Time;
- while (GetSystemTime < T) do
- begin
- if (IsUpTextMultiCustom2(S)) then
- begin
- Result := True;
- Exit;
- end;
- Wait(20 + Random(20));
- end;
- end;
- procedure WaitHumanClick;
- begin
- case random(600) of
- 1..450: Wait(RandomRange(400, 600));
- 451..570: Wait(RandomRange(400, 600));
- 571..590: Wait(RandomRange(600, 800));
- 591..600: Wait(RandomRange(800, 1000));
- end;
- end;
- procedure WaitHumanClick2;
- begin
- case random(600) of
- 1..450: Wait(RandomRange(1000, 1500));
- 451..570: Wait(RandomRange(1500, 2000));
- 571..590: Wait(RandomRange(2000, 2500));
- 591..600: Wait(RandomRange(2500, 3000));
- end;
- end;
- function FindObjExX(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tol, CTS: integer; Hue, Sat: Extended; Step, xs, ys, xe, ye: Integer): Boolean;
- var
- MidX, MidY, i, j, k, x, y, width, height, HalfWidth, HalfHeight: Integer;
- ColorFound: Boolean;
- SearchBoxes: array of array of TBox;
- p: TPointArray;
- begin
- if (not (loggedin)) then
- exit;
- Result := False;
- for i := 0 to (GetArrayLength(Color) - 1) do
- begin
- ColorToleranceSpeed(CTS);
- SetColorSpeed2Modifiers(Hue, sat);
- if (FindColorSpiralTolerance(cx, cy, Color[i], xs, ys, xe, ye, Tol)) then
- begin
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- ColorFound := True;
- Break;
- end;
- end;
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- if not (ColorFound) then
- Exit;
- MidX := Round((xe - xs) / 2);
- MidY := Round((ye - ys) / 2);
- Width := Ceil(abs(xe - xs) / 2 / Step - 0.5) * 2 + 1;
- Height := Ceil(abs(ye - ys) / 2 / Step - 0.5) * 2 + 1;
- SetLength(SearchBoxes, Width);
- HalfWidth := Floor(Width / 2);
- HalfHeight := Floor(Height / 2) for x := - 1 * HalfWidth to HalfWidth do
- begin
- SetLength(SearchBoxes[x + HalfWidth], Height);
- for y := - 1 * HalfHeight to HalfHeight do
- SearchBoxes[x + HalfWidth][y + HalfHeight] := IntToBox(Max(xs, xs + Round(MidX + ((x - 0.5) * Step))), Max(ys, ys + Round(MidY + ((y - 0.5) * Step))), Min(xe, xs + Round(MidX + ((x + 0.5) * Step))), Min(ye, ys + Round(MidY + ((y + 0.5) * Step))));
- end;
- p := TPAFromBox(IntToBox(0, 0, Width - 1, Height - 1));
- SortTPAFrom(p, Point(floor(Width / 2), floor(Height / 2)));
- for k := 0 to High(Color) do
- for j := 0 to High(p) do
- begin
- ColorToleranceSpeed(CTS);
- SetColorSpeed2Modifiers(Hue, sat);
- if (FindColorTolerance(cx, cy, Color[k], SearchBoxes[p[j].x][p[j].y].x1, SearchBoxes[p[j].x][p[j].y].y1, SearchBoxes[p[j].x][p[j].y].x2, SearchBoxes[p[j].x][p[j].y].y2, Tol)) then
- begin
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- MMouse(cx, cy, 3, 3);
- wait(randomrange(200, 300));
- if (WaitUptextMulti2(Text, 300)) then
- begin
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- GetMousePos(cx, cy);
- Result := True;
- Exit;
- end;
- end;
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- end;
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.2, 0.2);
- end;
- procedure Termination(const Status: string);
- begin
- if (TermCheck = false) then
- exit;
- writeln(Status);
- if loggedin then
- begin
- if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then
- terminatescript
- else
- terminatescript;
- end
- else
- terminatescript;
- end;
- function LogMeOut: boolean;
- begin
- writeln('Logging out..');
- if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then
- begin
- writeln('We have managed to log out');
- result := true;
- end
- else
- termination('We have failed to log out, ending script');
- end;
- function Clickobject(Objpoint: tpoint; OffSetRunX, OffSetRunY: integer; Uptext: TStringArray): Boolean;
- var
- Bp, Booth: TPoint;
- begin
- if (not LoggedIn) then
- Exit;
- if R_DistanceFromTile(Objpoint) > 3 then
- begin
- Bp.x := Objpoint.x + OffsetRunX;
- Bp.Y := Objpoint.y - OffsetRunY;
- R_WalkPath([Bp]);
- waithumanclick2;
- end;
- if R_DistanceFromTile(Objpoint) < 5 then
- begin
- Booth := R_TileToMS(ObjPoint);
- MMouse(Booth.X, Booth.Y, 2, 2);
- Sleep(100 + Random(100));
- if (R_IsUpTextMulti(Uptext)) then
- begin
- result := true;
- end;
- end;
- end;
- function LocateNPC(Name, Uptext: string; RunOffSetX, RunOffSetY: integer): boolean;
- var
- Bp, Tp: Tpoint;
- NpcName: tnpc;
- begin
- if R_FindNpc(Name, NpcName) then
- begin
- if NpcName.InCombat then
- exit;
- Tp := NpcName.Tile;
- if R_DistanceFromTile(Tp) > 3 then
- begin
- Bp.x := Tp.x + RunOffSetX;
- Bp.Y := Tp.y + RunOffSetY;
- case random (10) of
- 0..5: R_WalkPath([Bp]);
- 6..10: R_WebWalk(bp);
- end;
- waithumanclick2;
- end;
- if R_DistanceFromTile(tp) < 5 then
- begin
- Tp := R_TileToMs(Tp);
- Mmouse(Tp.x, Tp.y, 0, 0);
- if R_WaitUptext(Uptext, 200) then
- begin
- result := true;
- end;
- end;
- end;
- end;
- function R_FindObjects(ObjectID: integer): tpoint;
- var
- objects:trsobjectarray;
- i:integer;
- begin
- result:=point(0,0);
- objects:=R_GetAllObjects(0);
- for i:=0 to high(objects) do
- begin
- if (objects[i].ID = ObjectID) then
- begin
- result:=objects[i].tile;
- break;
- end;
- break;
- end;
- end;
- function onshopscreen: boolean;
- var
- tpa: tpointarray;
- begin
- result := FindColorsTolerance(tpa, 65535, 254, 60, 292, 82, 0);
- end;
- function ShopScreenS: Boolean;
- begin
- Result := (FindTextTPA(2070783, 10, 22, 30, 476, 52, 'Store', 'UpChars07', Nothing) or (GetColor(482, 36) = 65536));
- end;
- procedure BuyPizza;
- var
- s: string;
- PizzaCount: integer;
- begin
- if InvFull then
- exit;
- wait(randomrange(200, 400));
- s := GetTextAtExWrap(160, 60, 200, 82, 0, 5, 1, 65535, 0, statchars07);
- PizzaCount := StrToIntDef(GetNumbers(s), - 1);
- writeln(PizzaCount);
- if (PizzaCount > 0) or (PizzaCount = -1) then
- begin
- IncEx(pizzasbought, pizzacount) mouse(randomrange(185, 190), randomrange(75, 83), 0, 0, mouse_right);
- wait(randomrange(200, 300));
- mouse(randomrange(145, 149), randomrange(150, 154), 0, 0, mouse_left);
- waithumanclick;
- end;
- end;
- procedure BuyPotato;
- var
- s: string;
- PizzaCount: integer;
- begin
- if InvFull then
- exit;
- wait(randomrange(200, 400));
- s := GetTextAtExWrap(200, 60, 240, 82, 0, 5, 1, 65535, 0, statchars07);
- PizzaCount := StrToIntDef(GetNumbers(s), - 1);
- writeln(PizzaCount);
- if (PizzaCount > 0) or (PizzaCount = -1) then
- begin
- IncEx(potatobought, pizzacount) mouse(randomrange(235, 240), randomrange(75, 83), 0, 0, mouse_right);
- wait(randomrange(200, 300));
- mouse(randomrange(235, 240), randomrange(150, 154), 0, 0, mouse_left);
- waithumanclick;
- end;
- end;
- procedure Getpizza;
- begin
- if shopscreens then
- begin
- waithumanclick2;
- if (buyspizza = true) then
- BuyPizza;
- if (Buyspotato = true) then
- BuyPotato;
- waithumanclick;
- mouse(randomrange(486, 487), randomrange(40, 41), 0, 0, mouse_right);
- WaitOption('lose', 1000);
- waithumanclick2;
- if shopscreens then
- mouse(randomrange(486, 487), randomrange(40, 41), 0, 0, mouse_left);
- if InvFull then
- exit;
- if not (ExistsItem(28)) then
- begin
- if LogMeOut then
- writeln('we have managed to logout')
- else
- Termination('we have failed to log out, ending script');
- end;
- end;
- end;
- procedure ProgressReport;
- begin
- if (not (loggedin)) then
- exit;
- ClearDebug;
- WriteLn('* Pizza buyer');
- WriteLn('* Runtime: ' + TimeRunning);
- Writeln('*');
- writeln('* Worlds Hopped: ' + IntToStr(WorldsHopped));
- writeln('* Pizzas Bought: ' + IntToStr(pizzasbought));
- Writeln('* Potato Bought: ' + IntToStr(pizzasbought));
- end;
- procedure bankthings;
- begin
- if bankscreen then
- begin
- QuickDeposit('inv');
- waithumanclick2;
- MouseBankSlot(1, mouse_Right);
- waithumanclick;
- if (WaitOption('ut-one', 500)) then
- writeln('we did it');
- waithumanclick;
- R_WalkPath(shopcord);
- end;
- end;
- function OpenWScreen: Boolean;
- begin
- Result := False;
- if WorldScreen then
- exit;
- if Loggedin then
- Exit;
- if not WorldScreen then
- begin
- Mmouse(54, 475, 1, 1);
- WaitHumanClick;
- ClickMouse2(Mouse_Left);
- waithumanclick;
- Result := True;
- end;
- end;
- function whitecolor: boolean;
- var
- Monster: TpointArray;
- TmpCts: Integer;
- begin
- tmpcts := GetColorToleranceSpeed;
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.22, 1.69);
- result := FindColorsTolerance(Monster, 9163999, 192, 67, 583, 469, 4);
- ColorToleranceSpeed(tmpcts);
- SetColorSpeed2Modifiers(0.2, 0.2);
- end;
- procedure loginloop;
- var
- B,MyWorld1:integer;
- begin
- MyWorld1 := CurrentWorldLS;
- OpenWorldScreen;
- repeat
- if whitecolor then
- break;
- if whitecolor then
- writeln('we have the world select screen white color in sight');
- if not whitecolor then
- writeln('No world elect screen white color in sight, yet');
- case random(10) of
- 0..2: mouse(randomrange(397, 554), randomrange(78, 394), 1, 1, mouse_move);
- 3..4: mouse(randomrange(298, 462), randomrange(200, 392), 1, 1, mouse_move);
- 5..6: mouse(randomrange(205, 555), randomrange(80, 154), 1, 1, mouse_move);
- 7..10: mouse(randomrange(211, 555), randomrange(246, 367), 1, 1, mouse_move);
- end;
- until (whitecolor);
- if whitecolor then
- begin
- writeln('we have a world in selection!');
- clickmouse2(mouse_left);
- waithumanclick2;
- b := CurrentWorldLS;
- if (CurrentWorldLS = 365) or (CurrentWorldLS = myworld1) then
- exit;
- writeln('logging in..');
- loginplayer;
- exit;
- end;
- end;
- procedure getfood;
- begin
- MakeCompass('N');
- if shopscreens then
- begin
- Getpizza;
- end;
- if (UseReflection = true) then
- begin
- writeln('we are using reflection to find the cook');
- if locatenpc('Lidio', 'Lidio', + 1, + 1) then
- begin
- clickmouse2(mouse_right);
- waitoption('rade', 1000);
- waithumanclick3;
- if shopscreens then
- begin
- Getpizza;
- end;
- end;
- end
- else
- begin
- writeln('we are using Color to find the cook');
- if not FindObjExX(cx, cy, ['Lidio', 'Lid', 'dio', 'idio', 'talk', 'talk-to', 'alk-t', 'alk-to', 'alk', 'to'], [6179915], 15, 2, 0.06, 0.09, 50, MSX1, MSY1, MSX2, MSY2) then
- begin
- R_WalkPath(shopcord);
- end;
- if FindObjExX(cx, cy, ['Lidio', 'Lid', 'dio', 'idio', 'talk', 'talk-to', 'alk-t', 'alk-to', 'alk', 'to'], [6179915], 15, 2, 0.06, 0.09, 50, MSX1, MSY1, MSX2, MSY2) then
- begin
- clickmouse2(mouse_right);
- waitoption('rade', 1000);
- waithumanclick3;
- if shopscreens then
- begin
- Getpizza;
- end;
- end;
- end;
- end;
- function InsideArea: boolean;
- begin
- result := R_inPolygon([point(2834, 3536), point(2835, 3560), point(2850, 3560), point(2850, 3536)]);
- end;
- //if Clickobject(point(2842, 3542), 1, 0, ['Bank', 'booth', 'Bank booth', 'ank', 'ooth']) then
- procedure bankstuff;
- begin
- writeln('entered banking mode...');
- SetAngle(0);
- MakeCompass('n');
- if not R_OnTile(point(2843, 3543)) then
- begin
- repeat
- waithumanclick;
- if R_OnTile(point(2843, 3543)) then
- exit;
- if not loggedin then
- exit;
- findallrandoms;
- case random(10) of
- 0..5: R_WalkPath(bankcord);
- 6..10: R_WebWalk(point(2843, 3542));
- end;
- until (R_OnTile(point(2843, 3543)));
- end;
- if R_OnTile(point(2843, 3543)) then
- begin
- if bankscreen then
- begin
- writeln('we are on shop screen..');
- bankthings;
- end;
- if (UseReflection = true) then
- begin
- writeln('using reflection to find the booth..');
- if LocateNPC('Jade', 'Jade', + 1, 0) then
- begin
- writeln('we have found the banker!!, banking!');
- ClickMouse2(mouse_right);
- waithumanclick;
- waitoption('ank', 1000);
- end;
- waithumanclick3;
- if pinscreen then
- InPin(Players[0].pin);
- if bankscreen then
- bankthings;
- end
- else
- begin
- writeln('we have failed to find the banker');
- IncEx(fails, 1);
- if (fails > 10) then
- termination('We have failed To find the bank booth 10 times, ending script');
- end;
- end
- else
- begin
- if not FindObjExX(cx, cy, ['jade', 'ade'], [6182999], 15, 2, 0.16, 0.06, 50, MSX1, MSY1, MSX2, MSY2) then
- begin
- writeln('we have failed to find the banker - Jade, error alert');
- IncEx(Fails, 1);
- if (fails > 20) then
- termination('we have failed to find the banker jade too many times, ending script');
- end;
- if FindObjExX(cx, cy, ['jade', 'ade'], [6182999], 15, 2, 0.16, 0.06, 50, MSX1, MSY1, MSX2, MSY2) then
- begin
- writeln('yes2');
- clickmouse2(mouse_right);
- waitoption('ank', 1000);
- waithumanclick3;
- end;
- if pinscreen then
- begin
- InPin(Players[0].pin);
- end;
- if bankscreen then
- bankthings;
- end;
- end;
- procedure mainloop;
- begin
- if not loggedin then
- exit;
- findallrandoms;
- if InsideArea then
- begin
- findallrandoms;
- if (not (ExistsItem(28))) and (not (existsitem(1))) then
- bankstuff;
- if pinscreen then
- InPin(Players[0].pin);
- if (not (ExistsItem(28))) then
- getfood;
- if (ExistsItem(28)) then
- bankstuff;
- end else termination('we are NOT inside the warriors guild shop/bank area, ending script!');
- end;
- begin
- playerSetup;
- setupsrl;
- SetupReflection;
- BankCord := [point(2843, 3542)];
- shopcord := [point(2838, 3549)];
- addonterminate('progressreport');
- repeat
- wait(400);
- if not loggedin then
- loginloop;
- wait(400);
- if loggedin then
- mainloop;
- until (false);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement