Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Picture of the puzzle:
- http://i.imgur.com/Vju5E2X.png
- Picture of the sand as well, it might help:
- http://i.imgur.com/O2lwiuc.png
- Goes through the script and always outputs:
- ali found
- 300406005072000380058000160800902007000040000900508006087000690034000750100307002
- We have encountered an error solving this puzzle.
- Starting a new puzzle... (This used to break our script.)
- Which is on line 588.
- program RuneSudoku;
- //uses SysUtils;
- {$DEFINE SMART8}
- {$I SRL-OSR/SRL.Simba}
- const
- Username = '';
- Password = '';
- buyMindRunes = true;
- buyDeathRunes = false;
- buyCosmicRunes = true;
- buyNatureRunes = true;
- buyChaosRunes = false;
- NumbOfPlayers = 1;
- ClickDelay = 5; //Delay between the input of answers
- var
- numbstring, posfind:string;
- ansArray : Array[1..81] of String;
- count, i, v, c, z, x, y, row, col, boxrow, boxcol, buy_runes:integer;
- procedure DeclarePlayers;
- var i, buy_runes:integer;
- begin
- NumberOfPlayers(1);
- CurrentPlayer := 0;
- for i := 0 to NumbOfPlayers-1 do
- Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];
- with Players[0] do
- begin
- Name := Username; // Username
- Pass := Password; // Password
- Active := True;
- Pin := ''; // Leave blank if you have no pin.
- buy_runes := 0
- end;
- end;
- Procedure Antiban;
- Begin
- Case Random(100) Of
- 10: HoverSkill('random', False);
- 20: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
- 30: IdleTime(100+random(700), 100+Random(100), 0.2+RandomE/2);
- 40: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
- 60: RandomMovement;
- End;
- end;
- procedure LogIn;
- var a, b, c, d:integer;
- Begin
- writeln('Attempting to log in...');
- if (FindColorTolerance(a, b, 6181970, 340, 220, 340, 220, 5)) then
- begin
- writeln('We have detected that we are on the log in page. Trying to log in now...');
- MMouse(455, 290, 5, 5);
- wait(100);
- ClickMouse2(mouse_left);
- wait(100 + Random(500));
- SendKeys(Username, 50+Random(51), 30+Random(30));
- wait(500 + Random(69)); //haha 69
- KeyDown(9); //Tab key down PressKey seems to hit the key twice sometimes so we're doing it this way even though it doesn't make sense...
- KeyUp(9); //Tab key up
- wait(1000 + Random(100));
- //MMouse(343, 276, 2, 2);
- //ClickMouse2(mouse_left);
- //wait(200 + Random(200));
- SendKeys(Password, 50+Random(51), 30+Random(30));
- wait(100);
- MMouse(304, 321, 5, 5);
- ClickMouse2(mouse_left);
- repeat
- wait(1000 + random(500));
- until FindColorTolerance(c, d, 584, 336, 316, 336, 316, 5);
- MMouse(398, 335, 5, 5);
- wait(200);
- ClickMouse2(mouse_left);
- end
- else
- begin
- writeln('We have detected that we are not on the login page...');
- writeln('If you are not already logged in please restart the script.');
- end;
- end;
- procedure CheckIfLoggedOut;
- Var a, b:integer;
- Begin
- if (FindColorTolerance(a, b, 6181970, 340, 220, 340, 220, 5)) then
- begin
- writeln('We were logged out somehow... Logging back in.');
- LogIn;
- end;
- end;
- procedure TalkToAli;
- var
- counter, x, y:integer;
- begin
- writeln('starting to find ali');
- if FindObjCustom(x, y, ['li', 'orri'], [13818072, 5723997, 16118771], 5) then
- begin
- writeln('ali found')
- ClickMouse2(mouse_left);
- Wait(100+random(500));
- counter := 0;
- repeat
- counter := counter + 1;
- ClickToContinue;
- Wait(100 + Random(100)); //Added this delay because it wasn't always registering correctly
- until (FindNPCChatText('unes', Nothing)) or (counter > 100);
- wait(400 + Random(200));
- FindNPCChatText('unes', clickleft);
- ClickToContinue;
- counter := 0;
- repeat
- counter := counter + 1;
- ClickToContinue;
- Wait(300 + Random(100));
- until (FindNPCChatText('arge', Nothing)) or (counter > 10);
- wait(100 + Random(200));
- FindNPCChatText('arge', clickleft);
- counter := 0;
- repeat
- counter := counter + 1;
- ClickToContinue;
- Wait(100 + Random(100));
- until (FindNPCChatText('xamine', Nothing)) or (counter > 10);
- wait(100 + Random(200));
- FindNPCChatText('xamine', clickleft);
- end;
- end;
- procedure writeAnsArray(inputString : string);
- begin
- for i:=1 to 81 do
- begin
- if not (strtoint(copy(inputString,i,1)) = 0) then
- begin
- ansArray[i] := (copy(inputString,i,1));
- end else
- begin
- ansArray[i] := '123456789';
- end;
- end;
- end;
- function checkRows : boolean;
- begin
- for i:=1 to 81 do
- begin
- if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the row
- begin
- row := (((i-1)/9)+1); //determines the row
- for v:=1 to 81 do
- begin
- if (row = (((v-1)/9)+1)) then //checks if the row of boxes 1-81 matches the row of the string above ^
- begin
- if not (v = i) then //if the box is not the same box as the correct string ^
- begin
- if not ((pos(ansArray[i], ansArray[v])) = 0) then //if the string can be found in any of the strings on the same row
- begin
- //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same row');
- delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
- result := true;
- end;
- end;
- end;
- end;
- end;
- end;
- end;
- function checkCols: boolean;
- begin
- for i:=1 to 81 do
- begin
- if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the col
- begin
- col := (((i-1) mod 9)+1); //determines the col
- for v:=1 to 81 do
- begin
- if (col = (((v-1) mod 9)+1)) then //checks if the col of boxes 1-81 matches the col of the string above ^
- begin
- if not (v = i) then //if the box is not the same box as the correct string ^
- begin
- if not ((pos(ansArray[i], ansArray[v])) = 0) then //if the string can be found in any of the strings on the same col
- begin
- //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same col');
- delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
- result := true;
- end;
- end;
- end;
- end;
- end;
- end;
- end;
- function checkTbTbox : boolean;
- begin
- for i:=1 to 81 do
- begin
- if (length(ansArray[i]) = 1) then //if the string length is 1, the answer is decided. need to remove the number from the 3x3 box
- begin
- boxrow := ((((i-1)/9)/3)+1); //determines the boxrow
- boxcol := ((((i-1) mod 9)/3)+1); //determines the boxcol
- for v:=1 to 81 do
- begin
- if ((boxrow = ((((v-1)/9)/3)+1)) and (boxcol = ((((v-1) mod 9)/3)+1))) then //checks if the boxcol and boxrow match the boxcol and boxrow of the string above ^
- begin
- if not (v = i) then //if the box is not the same box as the correct string ^
- begin
- if not ((pos(ansArray[i], ansArray[v])) = 0 ) then //if the string can be found in any of the string on the same boxcol and boxrow
- begin
- //writeln(ansArray[i]+' is at box '+inttostr(i)+' and removed from box '+inttostr(v)+' because they are at the same boxcol and boxrow');
- delete(ansArray[v], (pos(ansArray[i], ansArray[v])), 1); //finds and removes said string from the other string
- result := true;
- end;
- end;
- end;
- end;
- end;
- end;
- end;
- function solvesquares : boolean;
- begin
- if (checkRows or checkCols or checkTbTbox) then
- begin
- result := true;
- end;
- end;
- function singlesRows : boolean;
- begin
- for row:=1 to 9 do //for rows 1 - 9
- begin
- for c:=1 to 9 do //for numbers 1 - 9
- begin
- z := 0;
- posfind := '';
- for v:=1 to 81 do //for boxes 1 - 81
- begin
- if (row = (((v-1)/9)+1)) then //checks if the row of boxes 1-81 matches the row above ^
- begin
- if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
- begin
- z := z+1; //count + 1
- posfind := posfind + inttostr(v); //string of box
- end;
- end;
- end; //if only 1 is found
- if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
- begin
- ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
- result := true;
- end;
- end;
- end;
- end;
- function singlesCols : boolean;
- begin
- for col:=1 to 9 do //for col 1 - 9
- begin
- for c:=1 to 9 do //for numbers 1 - 9
- begin
- z := 0;
- posfind := '';
- for v:=1 to 81 do //for boxes 1 - 81
- begin
- if (col = (((v-1) mod 9)+1)) then //checks if the row of boxes 1-81 matches the row above ^
- begin
- if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
- begin
- z := z+1; //count + 1
- posfind := posfind + inttostr(v); //string of box
- end;
- end;
- end; //if only 1 is found
- if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
- begin
- ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
- result := true;
- end;
- end;
- end;
- end;
- function singlesTbTbox : boolean;
- begin
- for boxrow:=1 to 3 do //for col 1 - 9
- begin
- for boxcol:=1 to 3 do
- begin
- for c:=1 to 9 do //for numbers 1 - 9
- begin
- z := 0;
- posfind := '';
- for v:=1 to 81 do //for boxes 1 - 81
- begin
- if (boxrow = ((((v-1)/9)/3)+1)) and (boxcol = ((((v-1) mod 9)/3)+1)) then //checks if the row of boxes 1-81 matches the row above ^
- begin
- if not ((pos(inttostr(c), ansArray[v])) = 0) then //if the number is found in the box
- begin
- z := z+1; //count + 1
- posfind := posfind + inttostr(v); //string of box
- end;
- end;
- end; //if only 1 is found
- if ((z = 1) and not (length(ansArray[strtoint(posfind)]) = 1)) then
- begin
- ansArray[strtoint(posfind)] := inttostr(c); //replaces the string with the number
- result := true;
- end;
- end;
- end;
- end;
- end;
- function solvesingles : boolean;
- begin
- if (singlesRows or singlesCols or singlesTbTbox) then
- begin
- result := true;
- end;
- end;
- procedure outputPuzzle;
- begin
- i := 1;
- for v:=1 to 9 do
- begin
- writeln('output puzz ['+ansArray[i]+']['+ansArray[i+1]+']['+ansArray[i+2]+']['+ansArray[i+3]+']['+ansArray[i+4]+']['+ansArray[i+5]+']['+ansArray[i+6]+']['+ansArray[i+7]+']['+ansArray[i+8]+']');
- i := i + 9;
- end;
- end;
- procedure findAnswer;
- begin
- repeat
- repeat
- //it attempts to solve in the until
- until not (solvesquares);
- //it attempts to solve in the until
- until not (solvesingles);
- end;
- procedure writeNumbstring;
- var
- x, y, mind1, mind11, fire2, fire22, air3, air33, water4, water44, earth5, earth55, body6, body66, death7, death77, chaos8, chaos88, law9, law99:integer;
- begin //air and chaos detection needs to be fixed
- mind1 := 133906; // new
- fire2 := 1121418; //new
- air3 := DTMFromString('mFQEAAHic42VgYOhgZGDoAuJeIO6D4n6oWBsQNwFxAxQ3QsXsgPpMgdgCiK0ZIHxHIHYFYhcgdgJieyC2AWJLqLonDx6QjPmB+kjFjGRgFAAAz50tPg==');
- water4 := 9049105; //new
- earth5 := 538965; //new
- body6 := 10951188; //new
- death7 := DTMFromString('m1gAAAHic42JgYPAFYi8oHQjEwUAcAMRBUNoHiD2B+CwQnwHiU0B8EsoGiV0E4itQfB6IRQQFGfZu3oyCsYnxA9USgxmJxAgAAMESHUs=');
- chaos8 := 608072; //fix
- law9 := 11934228; //new
- mind11 := 1738719; //new
- fire22 := 1319335; //new
- air33 := DTMFromString('mFQEAAHic42VgYOhgZGDoAuJeIO6D4n6oWBsQNwFxAxQ3QsXsgPpMgdgCiK0ZIHxHIHYFYhcgdgJieyC2AWJLqLonDx6QjPmB+kjFjGRgFAAAz50tPg==');
- water44 := 10951188; //new
- earth55 := 870508; //new
- body66 := 13639447; //new
- death77 := DTMFromString('mWAAAAHicY2FgYGgG4hYgbgfiViCOBeJIII4B4gQgFhEUZHjy4AGYBmF+oBgyZkTDIAAAnHoHEA==');
- chaos88 := 1613009; //new
- law99 := 14623002; //new
- c := 22;
- numbstring := '';
- for i:=1 to 9 do
- begin
- z := 133;
- for v:=1 to 9 do
- begin
- if (FindColorTolerance(x, y, mind1, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, mind11, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '1';
- end else if (FindColorTolerance(x, y, fire2, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, fire22, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '2';
- end else if (FindDTM(air3, x, y, z-15, c-15, z+15, c+15)) then
- begin
- numbstring := numbstring + '3';
- end else if (FindColorTolerance(x, y, water4, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, water44, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '4';
- end else if (FindColorTolerance(x, y, earth5, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, earth55, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '5';
- end else if (FindColorTolerance(x, y, body6, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, body66, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '6';
- end else if (FindDTM(death7, x, y, z-15, c-15, z+15, c+15) or FindDTM(death77, x, y, z-15, c-15, z+15, c+15)) then
- begin
- numbstring := numbstring + '7';
- end else if (FindColorTolerance(x, y, chaos8, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, chaos88, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '8';
- end else if (FindColorTolerance(x, y, law9, z-15, c-15, z+15, c+15, 5) or FindColorTolerance(x, y, law99, z-15, c-15, z+15, c+15, 5)) then
- begin
- numbstring := numbstring + '9';
- end else
- begin
- numbstring := numbstring + '0';
- end;
- z := z+37;
- end;
- c := c+37;
- end;
- FreeDTM(air3);
- FreeDTM(death7);
- FreeDTM(air33);
- FreeDTM(death77);
- end;
- procedure inputAnswer;
- var
- x1, y1:integer;
- begin
- x1 := 29;
- y1 := 112;
- for v:=1 to 9 do
- begin
- MMouse(x1, y1, 5, 5);
- wait(100)
- ClickMouse2(mouse_left);
- for i:=1 to 81 do
- begin
- if (strtoint(ansArray[i]) = v) then
- begin
- if not (strtoint(numbstring[i]) = v) then
- begin
- MMouse(((133)+(37*((i-1) mod 9))), ((22)+(37*((i-1)/9))), 3, 3);
- wait(50+random(55));
- ClickMouse2(mouse_left);
- wait(ClickDelay+random(2));
- end;
- end;
- end;
- y1 := y1 + 50;
- if (v = 5) then
- begin
- y1 := 160; //used to be 112
- x1 := x1 + 50;
- end;
- end;
- end;
- procedure SolveLargePuzzle;
- var
- x, y:integer;
- begin
- v := 0
- repeat
- wait(100+random(100));
- v := v+1;
- // writeln('1');
- until ((FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5) or (v = 30)))
- if (FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)) then
- begin
- // writeln('2');
- writeNumbstring;
- writeln(numbstring);
- writeAnsArray(numbstring);
- findAnswer;
- outputPuzzle;
- inputAnswer;
- end;
- end;
- procedure BuyRunes;
- var
- counter, x, y,a,b,c,d,e,f,g,h:integer; //gotta call the throw away variables
- begin
- if (FindColorTolerance(x, y, 797794, 470, 20, 490, 40, 5)) then
- begin
- MMouse(50, 70, 30, 5);
- wait(50+random(40));
- ClickMouse2(mouse_left);
- Wait(3000+random(500));
- FindNPCChatText('what', Clickleft);
- wait(900);
- //FindColorSpiralTolerance(x, y, 1411858, MSX1, MSY1, MSX2, MSY2, 30); //finds the nature rune
- //Deaths Start
- if (buyDeathRunes = true) then
- begin
- counter := 0;
- while FindColorTolerance(a,b,8290184,136,83,136,83,15) and (counter < 7) do
- begin
- counter := counter + 1;
- mousebox(137,79,149,91,mouse_right);
- wait(150+random(50));
- waitoption('10',mouse_left);
- wait(100);
- end;
- end;
- //Minds Start
- if (buyMindRunes = true) then
- begin
- counter := 0;
- while FindColorTolerance(c,d,8158598,181,83,181,83,15) and (counter < 7) do
- begin
- counter := counter + 1;
- mousebox(185,80,195,91,mouse_right);
- wait(200+random(50));
- waitoption('10',mouse_left);
- wait(100);
- end;
- end;
- //Nats Start
- if (buyNatureRunes = true) then
- begin
- counter := 0;
- while FindColorTolerance(e,f,7434874,274,87,274,87,15) and (counter < 7) do
- begin
- counter := counter + 1;
- mousebox(278,80,290,92,mouse_right);
- wait(200+random(50));
- waitoption('10',mouse_left);
- wait(100);
- end;
- end;
- //Chaos
- if (buyChaosRunes = true) then
- begin
- counter := 0;
- while FindColorTolerance(g,h,1812704,374,81,374,81,15) and (counter < 7) do
- begin
- counter := counter + 1;
- MMouse(373,82,5,5);
- wait(115);
- ClickMouse2(mouse_right);
- wait(150+random(50));
- waitoption('10',mouse_left);
- wait(100);
- end;
- end;
- //Cosmics Start
- if (buyCosmicRunes = true) then
- begin
- counter := 0;
- while FindColorTolerance(g,h,8421770,87,129,87,129,15) and (counter < 8) do
- begin
- counter := counter + 1;
- mousebox(91,127,101,138,mouse_right);
- wait(200+random(50));
- waitoption('10',mouse_left);
- wait(100);
- end;
- end;
- wait(200);
- MMouse(484, 39, 5, 5);
- wait(200);
- ClickMouse2(mouse_left);
- end;
- //put buy stuff here
- end;
- Procedure MainLoop;
- var
- a, b, c, d:integer; //gotta call the throw away variables
- begin
- CheckIfLoggedOut;
- MakeCompass(-95+random(40));
- TalkToAli;
- Try
- begin
- SolveLargePuzzle;
- BuyRunes;
- Writeln('RunTime : '+TimeRunning);
- Writeln('Caskets Opened : '+toStr(count));
- Writeln('Large caskets per hour : ' + toStr((3600000*count)/GetTimeRunning));
- end;
- Except
- if (FindColorTolerance(a,b,797794,67,39,67,39,15)) then
- begin
- MMouse(19, 19, 5, 5);
- wait(200);
- ClickMouse2(mouse_left);
- Writeln('We have encountered an error solving this puzzle.');
- Writeln('Starting a new puzzle... (This used to break our script.)');
- wait(200);
- end
- else
- begin
- Writeln('We have encountered an error somewhere...');
- Writeln('We are somehow also not on the Rune Sudoku screen anymore...');
- Writeln('Attempting to log out and then back in to restart the script.');
- MMouse(642, 483, 5, 5);
- ClickMouse2(mouse_left);
- wait(200);
- MMouse(637, 375, 5, 5);
- ClickMouse2(mouse_left);
- wait(5000);
- if (FindColorTolerance(c,d,5458504,356,215,356,215,15)) then //Checks for login screen
- begin
- MMouse(437, 288, 5, 5);
- ClickMouse2(mouse_left);
- wait(1000);
- LogIn;
- end;
- end;
- end;
- end;
- begin
- SetupSRL();
- Declareplayers;
- LogIn;
- Repeat
- MainLoop;
- Until false;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement