Posted a script for Wells. Maybe you can include it somehow?
I just changed a few words around and cut out some code and made the wait time to match production time etc.
Just out of curiosity, is there a way for the screen to locate the colour of the well and then click it, instead of mouse over? i.e. identify colour hotspot, then click on it. Autodetect takes mouse off screen.
Thanks for tips. It's great :)
I love the way it finds the bank chests :)
program ForgeOMatic;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i SRL-6/LIB/MISC/SRLPLAYERFORM.simba}
{*
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
JUST PRESS PLAY AND FILL OUT THE FORM
*}
var
IngsDone: integer;
NorthBox, SouthBox, EastBox, WestBox, box: TBox;
outOfForges: Boolean;
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'ForgeOMatic';
scriptHelpThread := '';
editBoxLabels := ['Number to do','Number/Inventory','Antiban Chance'];
editBoxDefaults := ['5000','28','2400'];
editBoxHints := ['How many Ores/Bars do you want to process?','Number of Ores/Bars used per Inventory','The longer it takes to Smelt/Smith, the higher this number should be'];
checkBoxLabels := ['Disable SRL Debug?', 'Disable Script Debug?'];
checkBoxDefaults := ['True','True'];
checkBoxHints := ['Do you want to Disable SRL Debug?','Do you want to Disable the Script Debug?'];
comboBoxLabels := ['Forge Direction','Bank Location','Preset','Mode','Hosting?'];
comboBoxDefaults := ['Auto Detect','CA','1','Smith','No'];
comboBoxItems := [['North','East','South','West','Auto Detect'], ['North','East','South','West','SP','Burth','CA','BA'], ['1','2'], ['Smith','Smelt'], ['Yes','No']];
comboBoxHints := ['Which direction the forge is at', 'Pick a bank or the direction of the bank.', 'Pick a bank preset to use', 'Which mode are we using?', 'Do you want to place a forge if non are found?'];
end;
end;
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
booleans[0] := strToBool(playerForm.players[i].settings[3]);
booleans[1] := strToBool(playerForm.players[i].settings[4]);
strings[0] := playerForm.players[i].settings[5];
strings[1] := playerForm.players[i].settings[6];
strings[2] := playerForm.players[i].settings[7];
strings[3] := playerform.players[i].settings[8];
strings[4] := playerform.players[i].settings[9];
end;
end;
procedure sDebug(Text: string);
begin
if not players[currentPlayer].booleans[1] then
writeLn(Text);
end;
procedure defineBoxes(); // The TBoxes to click for the forge
begin
NorthBox := intToBox(277, 44, 325, 87);
SouthBox := intToBox(240, 250, 306, 295);
EastBox := intToBox(382, 139, 428, 191);
WestBox := intToBox(144, 100, 158, 148);
end;
procedure FindRandoms();
begin
claimTicket();
exitTreasure();
end;
procedure bankCords(); //Opens the specified bank
var
x, y: Integer;
begin
if bankscreen.isOpen() then
exit;
case players[currentPlayer].strings[1] of
'North': begin MouseOval(299,111,20,20,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'East': begin mouseOval(365,184,20,20,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'South': begin mouseOval(281,283,30,30,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'West': begin mouseOval(185,180,25,25,Mouse_Move); if IsMouseOverText(['Bank','hest','nker'], 777) then begin fastclick(mouse_left); end; end;
'SP': begin if not bankScreen.open(BANK_CHEST_SHANTAY) then begin mouseOval(378,197,30,30,Mouse_Move); if IsMouseOverText(['Shantay c', 'y chest'], 777) then fastclick(mouse_left); end; end;
'Burth': begin if not bankScreen.open(BANK_TABLE_BURTHORPE) then begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['ank', 'booth'], 777) then fastclick(mouse_left); end; end;
'CA': begin if not bankScreen.open(BANK_CHEST_LUMBRIDGE) then begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['ank', 'hest'], 777) then fastclick(mouse_left); end; end;
'BA': begin if not mainscreen.findObject(x, y, 3424082, 8, colorSetting(2, 0.07, 0.14), mainscreen.playerPoint, 50, 50, 100, ['ank', 'hest'], MOUSE_LEFT) then begin mouseOval(376,193,30,30,Mouse_Move); if IsMouseOverText(['ank', 'hest'], 777) then fastclick(mouse_left); end; end;
end;
end;
procedure ForgeSpot(); //Moves the mouse to the specified location in the playerform
begin
case players[currentPlayer].strings[0] of
'North': MouseBox(NorthBox,Mouse_Move);
'East': MouseBox(EastBox,Mouse_Move);
'South': Mousebox(SouthBox,Mouse_Move);
'West': Mousebox(WestBox,Mouse_Move);
'Auto Detect': Mousebox(box,Mouse_Move);
end;
end;
procedure smithOrSmelt(); //Either Left or Right clicks the forge, depending on the mode selected
begin
case players[currentPlayer].strings[3] of
'Smelt': begin
fastclick(mouse_right);
wait(gaussRangeInt(100, 300));
chooseOption.select(['Mix','ix Portable', 'Take'], 400);
end;
'Smith': begin
fastclick(mouse_left);
end;
end;
end;
procedure AntiBan(Chance: Integer; ReHover: boolean);
begin
case random(Chance) of
1, 2: begin hoverSkill(SKILL_SMITHING); if Rehover then ForgeSpot(); end;
3..22: begin pickUpMouse; if Rehover then ForgeSpot(); end;
23..28: begin sleepAndMoveMouse(randomRange(500, 3000)); if Rehover then ForgeSpot(); end;
29..36: begin wait(RandomRange(777, 5000)); if Rehover then ForgeSpot(); end;
37: begin smallRandomMouse(); if Rehover then ForgeSpot(); end;
38: begin writeLn('Starting mini break.'); wait(RandomRange(9001, 25000)); writeLn('Finished mini break.'); if Rehover then ForgeSpot(); end;
end;
end;
procedure findForge();
var
i, r : integer;
fBoxes : array [1..4] of TBox;
MPos : TPoint;
begin
//Finds the Forge and assigns the TPoint MPos to the mouse position on the forge
mainscreen.findObject(MPos.x, Mpos.y, 3489698, 7, colorSetting(2, 0.08, 1.35), mainscreen.playerPoint, 20, 20, 50, ['ell Portable', 'able well'], MOUSE_Move);
fBoxes[1].setBounds(270, 24, 330, 102);
fBoxes[2].setBounds(226, 226, 338, 325);
fBoxes[3].setBounds(362, 119, 448, 211);
fBoxes[4].setBounds(144, 95, 213, 171);
for i := 1 to high(fBoxes) do //Checks which Direction MPos is at
if fBoxes[i].isPointInside(MPos) then
begin
r := i;
break();
end;
case r of // Assigns Click boxes depending on the mouse direction
0 : begin sDebug('No Forge Found'); end;
1 : begin box := NorthBox; sDebug('Forge is North'); end;
2 : begin box := SouthBox; sDebug('Forge is South'); end;
3 : begin box := EastBox; sDebug('Forge is East'); end;
4 : begin box := WestBox; sDebug('Forge is West'); end;
end;
end;
procedure placeForge();
begin
if outOfForges then
begin
writeLn('Out of Forges');
exit;
end;
typeSend('1', false);
if conversationBox.isOpen(3000) then
begin
wait(gaussRangeInt(100, 300));
typesend('1', false);
end else
begin
sDebug('Ran out of forges, Canceling hosting mode');
OutofForges := True;
end;
wait(gaussRangeInt(1000, 3000));
findForge();
end;
procedure ForgeDirection(); //Moves the mouse to the forge location, if not found, will look for it, if found will click it
var
Waited: Integer;
begin
if (Tabbackpack.count() <= 20) then //If the backpack doesnt have 20 or more items, the script terminates
begin
writeLn('Failed to withdraw enough items');
terminateScript();
end;
ForgeSpot(); //Moves the mouse to the pre-determined forge location
if not IsMouseOverText(['mix', 'Portable we', 'll', 'potions'], 500) then //If forge isnt found
begin
repeat
wait(gaussRangeInt(1500, 2500)); //Waits till it is found in this spot, or it has tried 10 times (usually takes 15-30 seconds)
AntiBan(800, true); //Increase the number for less antiban during the wait for forge
if isMouseOverText(['mix', 'Portable we', 'll potions'], 400) then
begin
sDebug('Found a Forge');
smithOrSmelt();
exit;
end;
inc(Waited);
until isMouseOverText(['mix', 'Portable we', 'll potions'], 400) or (Waited >= 10) or productionScreen.isOpen();
if (Waited >= 10) then //If it has tried 10 or more times, will look for forge again
begin //or terminate depending on playerform. To wait more, Increase the
if (players[currentPlayer].strings[0] = 'Auto Detect') then //Number for Waited
begin
sDebug('Could not find forge, Looking Around');
findForge();
end else
begin
writeLn('Could not find forge');
terminateScript();
end;
end;
end;
if IsMouseOverText(['mix', 'Portable we', 'll', 'potions'], 500) then //If forge is there
begin
sDebug('Found a Forge');
smithOrSmelt(); //Smith or Smelt, Depending on Mode
end else
begin
if (players[currentPlayer].strings[4] = 'Yes') then
placeForge();
end;
end;
procedure MakeStuff();
var
portaTry: Integer;
begin
if (Tabbackpack.count() <= 20) then
exit;
if not productionScreen.isOpen(gaussRangeInt(2000,4000)) then //If the production screen isnt open withing 8 seconds
begin
inc(portaTry);
sDebug('Failed to open Production screen trying again');
repeat
inc(portaTry); //Increase the number of tries
sDebug('Attempt to open production screen number ' + intToStr(portaTry));
mouseOffClient(OFF_CLIENT_RANDOM); //Moves the mouse off the screen
ForgeDirection(); //Tries to click the forge again. If no forge found, It will either look for it or terminate
if productionScreen.isOpen(gaussRangeInt(2000,4000)) then
break;
until productionScreen.isOpen() or (portaTry>19); //If the number of tries are more than 9 it will stop trying
if not productionScreen.isOpen(5000) then //If it still isnt open, will terminate
begin
writeLn('Failed to open production screen 20 times, Terminating');
terminateScript;
end;
end;
wait(gaussRangeInt(150, 500)); //Waits 0.1-0.5 seconds
productionScreen.clickStart(true); //Clicks the start button
wait(gaussRangeInt(15000, 20000));
end;
procedure CompactBanker(); //Credit to TrollCrank, modified version of his banker in ProteanPlankParade
var //Opens the specified bank, and withdraws the determined preset
bankTry,Att: integer;
begin
bankCords();
if Not bankScreen.isOpen(8000) then //If the bank doesnt open within 8 seconds
begin
sDebug('Could not open bank, trying again');
inc(bankTry)
repeat //Tries to open the bank again 9 times
bankCords();
if bankScreen.isOpen(gaussRangeInt(2000,3000)) then
break;
inc(bankTry);
sDebug('Attempt at opening bank number '+ intToStr(bankTry));
until (bankTry > 9); //Change this if you want it to do more than 10 attempts
end;
if (bankTry>9) then
begin
writeLn('Failed to open Bank 10 times. Terminating Script');
terminateScript();
end;
wait(gaussRangeInt(100, 500));
sDebug('Successfully opened the bank!');
typesend(players[currentPlayer].strings[2], false); //Clicks the preset Button
if not (tabBackpack.waitWhileLocked(8000)) then //If the bank doesnt close within 8 seconds
begin
sDebug('Bank Did not close, trying to Withdraw again');
repeat //Tries to click the preset button again twice
typesend(players[currentPlayer].strings[2], false);
inc(Att);
wait(gaussRangeInt(1000, 3000));
until (not tabBackpack.isLocked()) or (Att >= 2);
if tabBackpack.isLocked() then
begin //If the backpack hasnt been unlocked yet, will terminate
WriteLn('Could not exit bank, terminating script');
terminateScript();
end;
end;
IngsDone := IngsDone + players[currentPlayer].integers[1];
wait(RandomRange(200,900));
end;
procedure mainLoop();
begin
if not isLoggedIn() then
exit;
CompactBanker();
ForgeDirection;
MakeStuff;
clearDebug();
writeln('Ores/Bars Processed: ' + (toStr(IngsDone)));
writeLn('Processed/H: ' +intToStr(round(IngsDone/(getTimeRunning/3600000))));
if (not bankScreen.isOpen) and (Tabbackpack.isEmpty) then //If the Bankscreen is closed, and the backpack is empty, it Terminates
begin
WriteLn('Failed to withdraw anything.');
TerminateScript;
end;
end;
begin
clearDebug();
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
exit;
declarePlayers();
smartShowConsole := false;
disableSRLDebug := players[currentPlayer].booleans[0];
setupSRL();
FindRandoms();
minimap.clickCompass();
mainscreen.setAngle(MS_ANGLE_HIGH);
DefineBoxes();
if (players[currentPlayer].strings[0] = 'Auto Detect') then
findForge();
repeat
mouseSpeed := randomRange(25,32);
mainLoop();
if (IngsDone >= players[currentPlayer].integers[0]) then //Stops when Number to Do is reached
begin
writeLn('Reached our To-Do goal');
TerminateScript;
end;
until false;
end.