PDA

View Full Version : Help With Letting Script Know It's Time To Bank And Summon Another Familiar



Adieux
08-07-2014, 11:35 PM
So I'm trying to write a script where after a certain time it will need to go back to bank, end the procedure its doing and withdraw a pouch, summon it, then begin doing other procedures.

Is their an easy way to do this?
I was thinking like just putting a wait command but, way too many things can go wrong with that.

Any help is appreciated!

The Mayor
08-07-2014, 11:44 PM
var
summonTimer: TTimeMarker;

procedure checkTimers();
begin

if summonTimer.getTime() > 300000 then
begin
writeLn('5 minutes have passed, time to bank');
goToBank();

// bank stuff + summon familiar

summonTimer.reset();
summonTimer.start(); //reset & start the timer
end;

end;

procedure mainLoop();
begin
repeat

//all your stuff

checkTimers();

until l33t;
end;

Adieux
08-08-2014, 08:48 PM
var
summonTimer: TTimeMarker;

procedure checkTimers();
begin

if summonTimer.getTime() > 300000 then
begin
writeLn('5 minutes have passed, time to bank');
goToBank();

// bank stuff + summon familiar

summonTimer.reset();
summonTimer.start(); //reset & start the timer
end;

end;

procedure mainLoop();
begin
repeat

//all your stuff

checkTimers();

until l33t;
end;


You're awesome will be trying to implement this, thank you!


edit: Ok @themayor, so I havent been able to test out the timer as I cant get to 47 minutes yet but it compiles.
I need help with something else, resetting integer variables. Or how to make it so that the deposit feature works and doesn't withdraw and stuff when I dont want it it
obviously will be adding picking up of the fruit afterwards but right now just want to get the deposit feature to work without it repeating the whole script again. I was thinking of making a depositCount, and when its below 1 it will withdraw and the required items like potions and scrolls when its above 1 it will just deposit the fruit and continue doing the loop, but when I do depositCount.reset it says unknown. I've declared depositCount a global variable

here is what I have so far

program ABitPoorFruitFallV01;

{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}


/////////////////////////////////////////
// Change who you're banking with here //
// //
var //
banker: integer = BANK_NPC_BLUE; //
// //
// BANK_NPC_BLUE //
// BANK_NPC_GREY //
// BANK_NPC_GREEN //
// BANK_NPC_DRAYNOR //
// BANK_BOOTH //
// BANK_CHEST_SW //
// BANK_CHEST_SHANTAY //
// BANK_CHEST_DUEL //
// BANK_CHEST_CW //
// BANK_CHEST_GROTTO //
// BANK_CHEST_LUMBRIDGE //
// BANK_TABLE_BURTHORPE //
// //
////////////////////////////////////////

procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'username';
password := 'password';
isActive := true;
isMember := true;
end
currentPlayer := 0;
end;

var
BO: integer;
depositCount: integer;
timesUsedFruitFall: integer;
potionTimer: TTimeMarker;

procedure antiBan(); //Straight outta includes (imma noob)
begin
if not isLoggedIn() then
begin
writeLn('Not logged in, exiting');
end;

begin
case random(100) of
1..25: begin
writeLn('Performing AntiBan, Hovering Over Skills');
hoverRandomSkill();
end;

26..46: begin
writeLn('Performing AntiBan, Bored Human');
BoredHuman;
wait(randomRange(2000,4000));
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;

47..67: begin
writeLn('Performing AntiBan, Move Mouse Like A Downy');
smallRandomMouse();
end;

68..88: begin
writeLn('Performing AntiBan, I Fell Asleep On The Computer Oh No!');
sleepAndMoveMouse(2000 + random(3000));
end;

89..99: begin
writeLn('Performing AntiBan, Are We 99 Yet');
pickUpMouse();
end;
end;
end;
end;

procedure doWePerformAntiBan();
begin
writeLn('AntiBan or nah?');
case Random(10) of
1..6: begin
writeLn('Nah, no AntiBan');
end;

7..9: begin
writeLn('Yah, Performing AntiBan');
antiBan();
end;
end;
end;

procedure openBank();
begin
if not isLoggedIn() then
begin
writeLn('Not logged in, retrying');
players[currentPlayer].login();
exitSquealOfFortune();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;

if BACKPACK_SLOT_HIGH = 28 then
if depositCount > 1 then
exit;


if isLoggedIn() then
if depositCount < 1 then
begin
writeLn('Opening bank screen');
bankScreen.open(banker);
wait(randomRange(500,800));
inc(depositCount) + 1
end;

if not (bankScreen.isOpen()) then
exit;
end;

procedure withdrawItems();
begin
if not isLoggedIn() then
exit;

if not bankScreen.isOpen then
exit;

if depositCount >= 1 then
exit;

if bankScreen.isOpen then
begin
wait(randomRange(700,900));
bankScreen.clickButton(BANK_BUTTON_PRESET_2);
end;
end;

procedure depositProcedure();
begin

if depositCount >= 1 then
exit;

if not BACKPACK_SLOT_HIGH = 28 then
exit

if BACKPACK_SLOT_HIGH = 28 then
begin
openBank();
wait(randomRange(600,900));
if not bankScreen.isOpen then
exit
if bankScreen.isOpen then
begin
openbank();
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
withdrawItems();
end;
end;
end;

var
pouchesSummoned: integer;

procedure summonPouch();
begin

if not (bankScreen.close()) then
exit;

if (bankScreen.Close()) then
begin
tabBackPack.mouseSlot(2, MOUSE_LEFT);
doWePerformAntiBan();
inc(pouchesSummoned) + 1;
end;
end;

procedure walkOutSideBank();
var
pathToOutSideBank: TPointArray;
begin
wait(randomRange(700,1000));

if not isLoggedIn() then
exit;

pathToOutSideBank := [Point(210, 183), Point(179, 197)]

if SPS.walkPath(pathToOutSideBank) then
minimap.waitPlayerMoving()
else
writeLn('Could not make it outside, too fat');
end;

procedure useSummoningPotion();
begin

if potionTimer.getTime() < 29000 then
exit;

if potionTimer.getTime() > 29000 then
begin
wait(randomRange(500,600));
actionBar.clickSlot(1);
end;
end;

procedure useFruitFall();
begin
repeat
wait(randomRange(1000,1200));
potionTimer.start();
actionBar.mouseIcon(AB_BAR_SUMMONING, MOUSE_LEFT);
inc(timesUsedFruitFall) + 1;
until potionTimer.getTime() > 29000 or BACKPACK_SLOT_HIGH = 28

if not potionTimer.getTime() > 29000 then
begin
wait(randomRange(100,200));
end;

if potionTimer.getTime() > 29000 then
begin
writeLn('Out of special moves drinking pot');
useSummoningPotion();
wait(randomRange(100,250));
potionTimer.reset();
potionTimer.start();
end;

if BACKPACK_SLOT_HIGH = 28 then
begin
depositProcedure();
end;
end;

var
summonTimer: TTimeMarker;

procedure checkTimers();
begin

if not summonTimer.getTime() > 2820000 then
exit;

if summonTimer.getTime() > 2820000 then
begin
writeLn('47 minutes have passed, time to re-summon');
openBank();
withdrawItems();
summonPouch();
summonTimer.reset();
summonTimer.start(); //reset & start the timer
end;

end;
















// main loop
begin
smartPlugins := ['d3d9.dll'];
clearDebug();
smartEnableDrawing := true;
setupSRL();
declarePlayers();
SPS.setup('FRUIT_FALL_EDGE', RUNESCAPE_OTHER);
openBank();
withdrawItems();
summonPouch();
walkOutSideBank();
useSummoningPotion();
useFruitFall();


if not isLoggedIn() then
begin
players[currentPlayer].login();
exitSquealOfFortune();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
end.