Log in

View Full Version : 1st Hard Script, Double Banking! Why?



jibber
01-24-2012, 01:32 AM
ok well im currently learning, im quiet new. ive made a miner script from scratch, and a woodcutter.

ive used loads of different scripts to make this script. Its only for me to learn on so dont flame me for leaching and copy and pasting some of your scripts.

so far the script, which is a summoning script:

logs in
puts in bank pin
withdraws 1st item in bank
exits bank screen
opens bank screen
deposits items 5-28
then withdraws 1st item in bank
uses sps walking from fally bank to taverly gate
opens gate
detects summoning symbol
detects ladder
climbs down ladder
makes summoning pouches
teles to fally.
sps walks to bank
repeats.

items set up: any order. Charms, Shards, Pouches(empty), Fally tele tabs.

1st item in bank needs to be the 2nd for the summoning.

im currently making fruit bats, bananas as 1st item in bank

Start at fally west bank.


program SuMMOnMe;
{$i srl/srl/misc/smart.simba}
{$loadlib sps}
{$i srl/srl.simba}
{$i sps/sps.simba}

const
SRLStats_User = ''; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = ''; // Your SRL Stats Password (If you dont have one then just leave it as it is)
Var
X, Y, T, W, Flax, Breaks, Loads: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players, for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // Don't touch
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0

Players[0].Name := '; // Username
Players[0].Pass := ''; // Password
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].Integers[1] := 200;//# of loads to do.
Players[0].Integers[2] := 100; // Time before breaking ( In minutes)
end;

procedure SetupLogin;
begin
ClearDebug;
// Setting up SMART;
Smart_Server := 9;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
SetupSRLStats(295, SRLStats_User, SRLStats_Password);
DeclarePlayers;
LoginPlayer; // Logging in...
end;

procedure BreakTime;
var
s, i: Integer;
begin
if (s = 0) then
s := Players[0].Integers[2] * 60000; //+ RandomRange(300000, 600000);
if T = 1 then
begin
W:= GetTimeRunning;
if (W > s) then
begin
Logout;
i:= RandomRange(10, 15);
Writeln('Taking a break for ' + IntToStr(i) + ' minutes');
i:= i * 60000;
Wait(i);
T := 0;
s:= W + s;
Inc(Breaks);
LoginPlayer;
end;
end else
if T = 0 then
begin
T := T + 1;
end;

end;

procedure SetupSps;

begin
SPS_Setup(RUNESCAPE_SURFACE, ['9_7','8_7']);
SPS_Continue := false;
end;

procedure StartFancy;
var
i: Integer;
e: String;
begin
e := '=';
while i < 68 do
begin
Writeln(e);
if (InRange(i, 1, 19)) then
begin
Writeln('Welcome');
if (InRange(i, 20, 29)) then
begin
Writeln('Thanks For Helping me out');
end;
if (InRange(i, 30, 39)) then
begin
Writeln('It Keeps Double Banking');
end;
if (InRange(i, 40, 49)) then
begin
Writeln('All Help');
end;
if (InRange(i, 50, 59)) then
begin
Writeln('it means alot to get this first script running properly');
end;
if (InRange(i, 60, 69)) then
begin
Writeln('Next will be Mort Myre Fungi');
end;
Writeln(e);
e := e + '=';
Wait(50);
Inc(i);
ClearDebug;
end;
Writeln('Well Thanks all');
Wait(5000);
end;



procedure Antiban; //idea taken from Coh3n's tutorial.
begin
if not (LoggedIn) then
Exit;
begin
case Random(100) of // Random(100) generates a random integer from 0 to 59
10: RandomRClick;
30: PickUpMouse;
50: RandomMovement;
70: BoredHuman;
89: ExamineInv;
end;
end;
end;

procedure RestUp;
begin
if not (LoggedIn) then
Exit;
begin
SetRest;
while not RunEnergy(95) do
begin
Antiban;
Wait(Random(1000));
end;
end;
end;
procedure WithdrawItems;
var
x,y: integer;

begin
if FindNormalRandoms then //finds randoms and if in random, logs out if
if not LoggedIn then
makecompass('N');
if OpenBank(Players[CurrentPlayer].Loc, False, False) then
begin
MouseBox(45, 100, 60, 113, 3);
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(380 + random(50));
ChooseOption('raw-All');
end;
end;
CloseBank;
wait(1000);
if (Waituptext('pouch',1000)) then
Wait(750 + random(200));
end;

procedure WithdrawBank; //Finding Bank Procedure

var
Tr, Bo: integer;
x, y: integer;

begin
if FindNormalRandoms then //finds randoms and if in random, logs out if
if not LoggedIn then
begin;
end else
makecompass('N');
if BankScreen = false then
begin
writeln('Trying to open bank..');
MakeCompass('N');
OpenBankFast('fwb');
end;
repeat
wait(10);
Tr := Tr +1;
until (Tr = 1000) or (BankScreen = true);
if BankScreen = True then
begin
Writeln('Bank successfully Opened');
wait(1000 + random(1000));
if BankScreen then
begin
Wait (200 + Random(300));
FixBank;
if (InvFull) then
Mousebox(570, 260, 585, 265, 3);
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(380 + random(50));
ChooseOption('sit-All');
end;
ActivateClient;
WithdrawItems;
end;
end else
if BankScreen = False then
begin
Bo := Bo + 1;
writeln('Lets Try that again - ' + IntToStr(Bo) + ' Times');
if (Bo >= 5) then
begin
writeln('Could not Find Bank, Logging Out Now'); //Logout;
NextPlayer(false);
TerminateScript;
end;
end;
CloseBank;
end;


function Banking: Boolean;
var
p, t: Integer;

begin
if not (LoggedIn) then
Exit;
if (InvCount < 1) then
Exit;
while (IsMoving) do
begin
Wait(RandomRange(900, 1200));
end;
t := 0; //Tries starts at zero
repeat
Inc(t);
Writeln('Trying to open the bank, this is the ' + IntToStr(t) + ' try out of 5');
MakeCompass('n');
Wait(RandomRange(700, 1000));
if not(OpenBankNPC) then
OpenBank('clt', True, True);
until BankScreen or PinScreen or (t = 5);

if PinScreen then
begin
p := 0;
repeat
InPin(Players[0].Pin);
Inc(p)
until BankScreen or (p > 0) or not (LoggedIn);
end;

if BankScreen then
begin
Writeln('Opened the bank...');
WithdrawBank;
Wait(RandomRange(500, 1500));
CloseBank;
end;

if (t = 5) then
begin
Writeln('failed to find bank.');
Writeln('Terminating...');
TerminateScript;
end;
end;

function Walking(Color, Tolerance: Integer; SortFrom: tpoint): Boolean;// credit to Camaro' for the tutorial and function!
var
i, x, y, rx, ry: Integer;
TPA: TPointArray;
begin
if not LoggedIn then Exit;
FindNormalRandoms;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, Tolerance);
SortTPAFrom(TPA, SortFrom);

for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;

rx := RandomRange(-6, 6);
ry := RandomRange(-6, 6);
if (not rs_OnMinimap(x + rx, y + ry)) then
Continue;

Mouse(x + rx, y + ry, 0, 0, true);
FFlag(0);
Wait(200 + Random(500));
Result := True;
Break;
end;
end;

procedure WalkToStore;
var
BankToStore: TPointArray;

begin
if not (LoggedIn) then
Exit;
if not FindNormalRandoms then
begin
if not RunEnergy(25) then
RestUp;
MakeCompass('n');
Writeln('Walking to Taverly Summoning Store...');
Wait(Random(1000));
BankToStore := [Point(3615, 3174), Point(3617, 3156), Point(3640, 3148),
Point(3649, 3129), Point(3681, 3125), Point(3698, 3103),
Point(3699, 3065), Point(3701, 3029), Point(3694, 3004),
Point(3665, 2982), Point(3642, 2964), Point(3638, 2946),
Point(3633, 2919), Point(3627, 2886), Point(3617, 2855),
Point(3593, 2847), Point(3583, 2847)];
if SPS_WalkPath(BankToStore) then
Writeln('Near The Gate?');
Wait(RandomRange(1200, 1500));
end;
end;
procedure Summoningsymbol;
var
x,y:integer;

begin
If (findsymbol(x,y,'summoning store')) then
begin
mouse(x,y,1,1,true);
Writeln('Summoning Store Found');
wait(280+random(220));
end else
begin
Writeln('Summoning Store Not Found');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'Walking to Summoning Store';
LogOut;
TerminateScript;
end;
end;
procedure CheckGate;
var
x,y:integer;

begin
if (findobjcustom(x,y,['lose'],[8420225,8354175,7959417],5)) then
begin
Writeln('Gate Open');
Summoningsymbol;
end else
begin
Mouse(x,y,1,1,true);
Writeln('Gate Closed - Opening Gate');
wait(500+ random(250));
summoningsymbol;
end;
end;
procedure findTD;
var
x,y,t:integer;

begin
t:=t+100;
if (findobjcustom(x,y,['pen','limb'],[855309, 921102, 798517],5))then
begin
Writeln('TrapDoor found');
movemouse(x,y);
If(WaitUptext('Open', 300)) then
begin
Mouse(x, y, 0, 0, true);
repeat
wait(t);
until (not IsMoving)
wait(300);
mousebox(232,154,251,152,1);
end else
If(WaitUptext('Climb', 300)) then
begin
Mouse(x, y, 0, 0, true);
end;
end;
end;
procedure TrapDoor;
var
x,y,t: integer;

begin
repeat
wait(t);
until (Not isMoving)
Writeln('Trying to Find TrapDoor');
if FindNormalRandoms then
if not LoggedIn then
begin
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'Inactive.';
Exit;
end else
t:=t+1000;
Makecompass(115+random(5));
wait(1000 + random(500));
repeat
wait(t);
until (Not IsMoving)
if (Findcolortolerance(x,y,859681,MSX1,MSY1,MSX2,MSY2 ,30)) then
begin
findTD;
end else
begin
summoningsymbol;
repeat
wait(t);
until (Not IsMoving)
findTD;
end;
end;
procedure findob;
var
x,y,t:integer;

begin
t:=t+100;
if (findobjcustom(x,y,['pen','limb'],[855309, 921102, 798517],5))then
begin
Writeln('TrapDoor found');
movemouse(x,y);
If(WaitUptext('Open', 300)) then
begin
Mouse(x, y, 0, 0, true);
repeat
wait(t);
until (not IsMoving)
wait(300);
mousebox(232,154,251,152,1);
end else
If(WaitUptext('Climb', 300)) then
begin
Mouse(x, y, 0, 0, true);
end;
end;
end;
procedure MakePouch;

var
x,y,c,t,a,b:integer;

begin
if FindNormalRandoms then
if not LoggedIn then
begin
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'Inactive.';
Exit;
end else
c := 105 + random(30);
makecompass(c);
repeat
wait(t);
t := t+1;
until (not IsMoving) or (t>=1000)
wait(1000 + random(500));
if (findobjcustom(x,y,['nfuse','ouch'],[2389103, 2058596, 2058082,1992032],5)) then
begin
writeln('Obelisk Found');
movemouse(x,y);
wait(500+ random(250));
mouse(x,y,0,0,true);
repeat
wait(t);
until (Not IsMoving)
if (findcolor(a,b,105157,200,35,210,45)) then
begin
Mousebox(50,71,75,80,3);
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(1000 + random(50));
ChooseOption('use-All');
Wait(1000 + random(500));
mousebox(690,222,710,227,1);
end else
begin
Writeln('Checkbox not toggled - Toggling Checkbox');
wait(200);
Mousebox(200,35,210,45,1);
Mousebox(50,71,75,80,3);
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(1000 + random(50));
ChooseOption('use-All');
Wait(1000 + random(500));
mousebox(690,222,710,227,1);
end;
end;
end;
procedure BacktoBank; //Return Path to the Bank After teleport
var
TeleToBank: TPointArray;

begin
if not (LoggedIn) then
Exit;
if not FindNormalRandoms then
begin
if not RunEnergy(25) then
RestUp;
MakeCompass('n');
Writeln('We Should Be At The Tele Spot...');
Wait(Random(1000));
TeleToBank := [Point(3697, 3129), Point(3669, 3128),
Point(3642, 3139), Point(3618, 3158),
Point(3622, 3176)];
if SPS_WalkPath(TeleToBank) then
Writeln('At Bank');
Wait(RandomRange(1200, 1500));
end;
end;


procedure MainLoop;
begin
SetupLogin;
SetupSps;
T := 0;
for Loads := 0 to Players[0].Integers[1] do
begin
if not (LoggedIn) then
Break;
BreakTime;
Banking;
WithdrawBank;
WalkToStore;
CheckGate;
TrapDoor;
MakePouch;
BackToBank;

end;
end;

begin
StartFancy;
MainLoop;
end.

Kyle Undefined
01-24-2012, 02:51 PM
In your WithdrawItems, WithdrawBank, and Banking procedures you're opening and closing the bank each time. I'd make one procedure and just make it generic so it can withdraw/deposit in one call.

Keep up the good work!