Obquility
2014-12-01 00:26:45
Hey Fellas!
I have here a script which can be found in the SRL Public section, the Astral Crafter. Due to the fact that the script has not been updated in a while, I have had to make some changes. The script works smoothly, it has been run for 8 hours without fail, although since its colour banking, the script sometimes clicks randomly if there is someone at the bank with the same colours. The script also has break procedure, which leads to the script being unable to run unattended for extremely long periods without risking a ban. I understand if breaks is put in, I will also need a DeclarePlayers procedure, which is for me, way out of my scripting knowledge. If someone that knows all of this in the back of their head, can give me a few pointers, and examples of what to do, that would be great.
Here is the edited script below:
Again, if someone with knowledge could help me out, a big thankyou to you- its not that hard to people like you!
Thanks, Josh
I have here a script which can be found in the SRL Public section, the Astral Crafter. Due to the fact that the script has not been updated in a while, I have had to make some changes. The script works smoothly, it has been run for 8 hours without fail, although since its colour banking, the script sometimes clicks randomly if there is someone at the bank with the same colours. The script also has break procedure, which leads to the script being unable to run unattended for extremely long periods without risking a ban. I understand if breaks is put in, I will also need a DeclarePlayers procedure, which is for me, way out of my scripting knowledge. If someone that knows all of this in the back of their head, can give me a few pointers, and examples of what to do, that would be great.
Here is the edited script below:
Program AstralCrafterRS3; //cleaned up
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I sps/lib/sps-rs3.simba}
const
ColorAltar = 7958133;
ColorTolAltar = 20;
ColorDecayedPouch = 2698287;
ColorTolDecayedPouch = 5;
ColorCountDecayedPouch = 20;
ColorAbyssMage = 1381655;
ColorTolAbyssMage = 10;
ColorBanker = 8682105;
ColorTolBanker = 5;
ColorMage = 1447447;
debug = true;
var
PathBank: TPointArray;
PathBankToAltar: TPointArray;
MyScriptTimer: TTimeMarker;
TripsMade: Integer;
WE, FL, FM, FS, EG, EL, EM, ES, telefails, SlotNum: Integer;
p: tpoint;
DTMBank: Integer;
label
WalkToAltarLabel, TeleToMoonClanLabel, WithdrawEssLabel;
procedure WaitRandom(MsecToWait: Integer); //procedure that makes random wait time
begin
Wait(MsecToWait + Random(Round(MsecToWait / 5.0)));
end;
procedure LoadResources; //loads up all the resources the script uses (paths and dtms)
begin
DTMBank := DTMFromString('mggAAAHicY2NgYOhjgeAOIJ4GxF1APAWILwHlTgDxWSi+B8Q3gLih0pihvDKX4cLCTIb+Ag+Gy4uzGXZNiGPABRhxYAgAALlpEZo=');
PathBank := [Point(157, 206), Point(139, 193)];
PathBankToAltar := [Point(207, 209), Point(196, 220), Point(184, 288), Point(190, 290), Point(177, 290), Point(217, 324), Point(206, 329), Point(194, 338), Point(212, 368), Point(223, 361), Point(236, 352), Point(248, 362), Point(242, 367), Point(234, 372), Point(248, 384), Point(257, 374), Point(264, 366), Point(271, 362), Point(281, 388), Point(270, 388), Point(264, 389), Point(281, 416), Point(288, 427), Point(296, 433), Point(313, 430), Point(313, 418), Point(327, 423), Point(331, 432), Point(341, 424), Point(345, 411)];
end;
procedure SetUp; //set up for the script to run
begin
SmartEnableDrawing := True;
SetUpSrl;
LoadResources;
Sps.Setup('0_0MOONCLAN', RUNESCAPE_SURFACE);
TripsMade := 0;
writeLn('=====Setting up player camera!=====');
minimap.setAngle(MM_DIRECTION_NORTH);
TRSMainscreen.setAngle(MS_ANGLE_HIGH);
mouseScroll(p, 50+Random(20));
writeLn('=====Setting up complete!=====');
end;
procedure WhereAreWe; //Locates where the character is and determines whether to teleport or not
begin
If not (minimap.findsymbol(p, MM_SYMBOL_BANK, minimap.getbounds)) then
begin
writeLn('=====Could not find bank, now teleporting=====');
ActionBar.ClickSlot(1);
end
end;
procedure findNormalrandoms;
begin
exitSquealOfFortune;
ClaimSpinTicket;
closePollWindow();
closeAdWindow();
end;
procedure Antiban; //performs an antiban
var
i: integer;
begin
if not isLoggedIn then
exit;
i := random(500);
case i of
1..50: begin pickUpMouse(); writeLn('==PickUpMouse==') end;
51..70: begin randomRClickItem(); writeLn('==randomRClickItem==') end;
71..100: begin sleepAndMoveMouse(random(2000) + 750); writeLn('==SleepAndMoveMouse==') end;
101..125: begin smallRandomMouse(); writeLn('==SmallRandomMouse==') end;
125..300: begin mouseOffClient(OFF_CLIENT_RANDOM); writeLn('==MouseOffClient==') end;
301..400: begin hoverSkill(Skill_Runecrafting); writeLn('==HoverSkillRunecrafting==') end;
401..500: begin hoverSkill(Skill_Magic); writeLn('==HoverSkillMagic==') end;
end
end;
procedure ChatBoxOpen; //checks if the chat box is open, if so it hits continue until its closed
begin
if conversationBox.isOpen then
begin
repeat
writeLn('==============Ahhh chatbox is open, now closing!===============');
Conversationbox.Continue(True, True);
until(not conversationBox.isOpen);
writeLn('==============Chat closed!===============');
//WaitRandom(1000);
end
end;
procedure TeleToMoonclan; //Teleports to the Moonclan using the Action bar slot 1 + initializes antiban
begin
writeLn('==============Teleporting to MoonClan================');
ActionBar.ClickSlot(1);
Antiban;
wait(2500 + randomrange(100,150));
end;
procedure WalkToBank; // Checks for full inventory, if full it exits WalkToBank and jumps to WalkToAltar, if not it walks to the Bank
begin
if (tabBackpack.isFull) then
begin
writeln('======seems like theres no need to bank, going to altar======');
goto WalkToAltarLabel;
end else
begin
writeLn('================= Walking to bank!=======================');
Sps.WalkPath(PathBank);
writeLn('==================Should be at the bank!==================');
WaitRandom(400);
end
end;
function HavePouchesDecayed: Boolean; //function for decayed pouch indentification
begin
Result := False;
writeln('no decayed pouches found');
for SlotNum := 1 to 4 do
begin
if CountColorTolerance(ColorDecayedPouch, TabBackpack.GetSlotBox(SlotNum), ColorTolDecayedPouch) > ColorCountDecayedPouch then
begin
writeLn('Detected decayed pouch in slot ' + IntToStr(SlotNum));
Result := True;
Break;
end
end
end;
procedure CastRepairSpell; //casts pouch repair spell in actionbar slt 9 repeats until no pouches are decayed
begin
Repeat
ActionBar.ClickSlot(9);
Mouse(tabBackpack.getSlotBox(SlotNum).GetMiddle, MOUSE_LEFT);
wait(2000 + randomrange(100,200));
until (HavePouchesDecayed = False);
end;
procedure CastNpcContact; //casts npc contact to repair pouches actionbar slt2
var
ColorsFound: TPointArray;
MidPoint: TPoint;
jew:= Point(297,209);
begin
writeLn('==============Using NPC contact!===============');
ActionBar.ClickSlot(2);
WaitRandom(1000);
if debug then
writeln('Gut');
mouseScroll(jew.rand(16), 4);
WaitRandom(1000);
if debug then
writeln('Sehr Gut!');
if FindColorsTolerance(ColorsFound, ColorMage, MainScreen.GetBounds, ColorTolBanker) then
MidPoint := MedianTpa(ColorsFound);
Mouse(MidPoint, MOUSE_LEFT);
wait(900 + randomrange(50,100))
repeat
conversationBox.continue(true, true);
until(conversationBox.findOption(['epair']))
if (conversationBox.selectOption(['epair'])) then
writeln('Ich hasse Hippies!');
repeat
wait(50+random(10));
until(conversationBox.continue(true,true))
end;
procedure SelectAbyssMage;
var
TpaAbyssMage: TPointArray;
AtpaAbyssMage: T2DPointArray;
begin
writeLn('==============Looking for Dark Mage!===============');
MouseScroll(MainScreen.GetBounds.GetMiddle, 4);
WaitRandom(500);
if FindColorsTolerance(TpaAbyssMage, ColorAbyssMage, MainScreen.GetBounds, ColorTolAbyssMage) then
begin
AtpaAbyssMage := TpaAbyssMage.ToAtpa(20);
SortAtpaSize(AtpaAbyssMage, True);
TpaAbyssMage := AtpaAbyssMage[Low(AtpaAbyssMage)];
Mouse(MedianTpa(TpaAbyssMage), MOUSE_LEFT);
WaitRandom(6000);
end
end;
procedure ChatWithAbyssMage;
var
IX: Integer; b: string;
begin
for IX := 1 to 6 do
begin
writeLn('==============Clicking continue!===============');
ConversationBox.Continue(True, True);
WaitRandom(1000);
end
ConversationBox.SelectOption(['Can you repair mv pouches?']);
writeLn('==============Selecting repair pouches!===============');
wait(500 + randomrange(100,150));
for IX := 1 to 2 do
begin
writeLn('==============Clicking continue!===============');
wait(500 + randomrange(100,150));
ConversationBox.Continue(True, True);
end
end;
procedure RepairPouches; //goes through the procedures to repair pouches
begin
CastRepairSpell;
//CastNpcContact;
//SelectAbyssMage;
//ChatWithAbyssMage;
end;
procedure RepairPouchesIfNeeded; //if pouches need repair this begins the process
begin
writeln('======checking pouches======');
if HavePouchesDecayed = true then
begin
writeLn('==============Beggining repair pouches!===============');
RepairPouches;
end
end;
procedure OpenBank; //tires to find banker,if found it left clicks on it to open bank, if pin screen is open it terminates script. it then checks to see if bank is open, if it is then it exits procedure, if it isnt open it goes to TeleToMoonClan
var
ColorsFound: TPointArray;
MidPoint: TPoint;
begin
if FindColorsTolerance(ColorsFound, ColorBanker, MainScreen.GetBounds, ColorTolBanker) then
begin
MidPoint := MedianTpa(ColorsFound);
Mouse(MidPoint, MOUSE_LEFT);
wait(900 + randomrange(50,100));
if pinscreen.isOpen() then
begin
Writeln('======pin screen open, terminating script======');
terminateScript();
end
end
begin
wait(1500 + randomrange(50,100));
if bankscreen.isOpen then
goto WithdrawessLabel;
end
end;
procedure WithdrawEss; //check to see if bank is open, if so it withdraws essense until pack is full or its tried 5 or more times. if bank is not open it goes to TeleToMoonClanLabel.
begin
//repeat
writeLn('=====Withdrawing essence=====');
BankScreen.Withdraw(10, WITHDRAW_AMOUNT_ALL, ['']);
wait(1500 + randomrange(5,20));
//inc(WE);
//until bankscreen.getPackCount = 28 or (WE >= 2);
end
procedure FillPouches1; //looks for giant pouch, rightclicks it, selects fill, and repeats until pack=16 or its tried 2 times
var
FG: Integer;
begin
repeat
writeLn('==============Filling up the Giant pouch===============');
Mouse(BankScreen.GetPackSlotBox(1).GetMiddle, MOUSE_RIGHT);
ChooseOption.Select(['Fill Giant pouch'], 0.70);
wait(1000 + randomrange(50,100));
inc(FG);
until ((bankscreen.getPackCount = 16) or (FG > 2));
end;
procedure FillPouches2; //does the same at fillpouch1 but for large=19, medium=13, and small=10
var
FL, FM, FS: Integer;
begin
repeat
writeLn('==============Filling up the large pouch===============');
Mouse(BankScreen.GetPackSlotBox(2).GetMiddle, MOUSE_RIGHT);
ChooseOption.Select(['Fill Large pouch'], 0.80);
wait(1000 + randomrange(50,100));
inc(FL);
until ((bankscreen.getPackCount = 19) or (FL >= 2));
repeat
writeLn('==============Filling up the Medium pouch===============');
Mouse(BankScreen.GetPackSlotBox(3).GetMiddle, MOUSE_RIGHT);
ChooseOption.Select(['Fill Medium pouch'], 0.80);
wait(1000 + randomrange(50,100));
inc(FM);
until ((bankscreen.getPackCount = 13) or (FM >= 2));
repeat
writeLn('==============Filling up the small pouch===============');
Mouse(BankScreen.GetPackSlotBox(4).GetMiddle, MOUSE_RIGHT);
ChooseOption.Select(['Fill Small pouch'], 0.80);
wait(1000 + randomrange(50,100));
inc(FS);
until ((bankscreen.getPackCount = 10) or (FS >= 2));
end;
procedure BankStep; //performs included procedures in this order withdrawess,fillpouches1,withdrawess,fillpouches2,withdrawess, and closes bank
var OB: integer;
begin
WaitRandom(200);
WithdrawEss;
FillPouches1;
WithdrawEss;
FillPouches2;
WithdrawEss;
WaitRandom(30);
BankScreen.Close;
WaitRandom(25);
end;
procedure WalkToAltar; //walks to the altar
begin
writeLn('==============Walking to the Altar!===============');
Sps.WalkPath(PathBankToAltar);
wait(randomrange(100,500));
end;
procedure CraftRunes(WaitLonger: Boolean); //finds altar colors, if found it clicks altar. does some stuff im not sure is necessary - probably needs afailsafe
var
ColorsFound: TPointArray;
MidPoint: TPoint;
begin
if FindColorsTolerance(ColorsFound, ColorAltar, MainScreen.GetBounds, ColorTolAltar) then
begin
writeLn('==============Crafting runes!===============');
MidPoint := MedianTpa(ColorsFound);
Mouse(MidPoint, MOUSE_LEFT);
writeLn('==============Done crafting runes!===============');
wait(1500 + randomrange(100,150));
end else
MiniMap.WaitFlag;
if (WaitLonger) then
begin
wait(900 + randomrange(100,150));
end
end;
procedure CraftStep; //combines CraftRunes
var
craftfailure: integer;
begin
repeat
CraftRunes(True);
wait(900 + randomrange(100,150));
inc(craftfailure);
if (craftfailure >=3) then
begin
writeln('===oh shit, need to teleport!!===');
ActionBar.ClickSlot(1);
exit;
end
until ((TabBackPack.Count < 11) or (craftfailure >= 3));
ChatBoxOpen;
writeLn('==============Completely done crafting!===============');
claimTicket();
end;
procedure PrintStatsReport; //makes the stats report - time run, runescrafted, runescrafted p/r, trips made, trips p/h, profit, profit p/r
var
runescrafted, profit, profitPerHour, runesPerHour, tripsPerHour: integer;
begin
runescrafted := TripsMade * 100;
profit := (runescrafted * 344);
profitPerHour := round((profit * 60) / (MyScriptTimer.getTime() / 60000));
runesPerHour := round((runescrafted * 60) / (MyScriptTimer.getTime() / 60000));
tripsPerHour := Round((TripsMade * 60) / (MyScriptTimer.getTime() / 60000));
writeLn('========================================================');
writeLn('Astral Crafter');
writeLn('Time Run: ' + MsToTime(MyScriptTimer.getTime, TIME_FORMAL));
writeLn('Runescrafted: ' + intToStr(runescrafted));
writeLn('Runescrafted Per Hour: ' + intToStr(runesPerHour));
writeLn('Trips Made: ' + intToStr(TripsMade));
writeLn('Trips Per Hour: ' + intToStr(tripsPerHour));
writeLn('Profit Made: ' + intToStr(profit));
writeLn('Per Hour: ' + intToStr(profitPerHour));
writeLn('========================================================');
end;
procedure MainLoopIteration; //the mainloop!
begin
//RestartScript:
WaitRandom(500);
WalkToBank;
RepairPouchesIfNeeded;
OpenBank;
WithdrawEssLabel:
WithdrawEss;
FillPouches1;
WithdrawEss;
FillPouches2;
WithdrawEss;
WaitRandom(30);
BankScreen.Close;
WaitRandom(25);
WalkToAltarLabel:
WalkToAltar;
CraftStep;
TeleToMoonClanLabel:
TeleToMoonclan;
TripsMade := TripsMade + 1;
//cleardebug;
PrintStatsReport;
end;
begin //the brain
SetUp;
whereAreWe;
MyScriptTimer.start;
repeat
MainLoopIteration;
until False;
end. Again, if someone with knowledge could help me out, a big thankyou to you- its not that hard to people like you!
Thanks, Josh