SRL Archive - OSR Help

Need help with Zanaris random event


CephaXz

2012-04-26 20:02:40

Have been trying to make a cosmic runecrafter. Script doesn't use advance codes since I only started scripting 2 weeks ago. I've been running the script for quite some time now. Zanaris doesn't have normal randoms like Maze, Evil Bob, Molly and such. It will have NPC popping up randomly to interrupt your activity.
For the banking procedure, I can use:

if not BankScreen then
ClickBank;
until BankScreen;

While for the agility shortcut to bank and to altar, I don't know what failsafe to make when NPC comes and interrupt me for going through the shortcut. It won't let me go through the shortcut even if it clicked the shortcut while the NPC pops up.

It would be great if someone could guide me. Need for guidance and advises from you guys.
1. I don't know how to use functions, so the script is all procedures only:duh:
2. Don't know TPA :duh:
3. Don't know how to create custom SPS map :duh:
4. Using crappy check color in minimap and crappy mouse for inside altar walking, since it randoms where you are when you enter the altar :duh:
5. Don't know how to use constants so that I can choose either to use NPC contact or pouch repair spell for repairing pouch, its only using NPC contact now :duh:
6. Am I using DTM right? Loading and freeing them the correct way? :duh:
7. How can I improve the script using other functions and statements? Because I only know how to use If…Then statement :duh:
8. Is there a faster withdrawing procedure? Like mousekey? :duh:
9. And any other things you can point out. Thanks! :p

So here's my script:

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

var
giant, cosmic, decay, air, astral, pure, small, medium, large: Integer;


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'blabla';
Players[0].Pass := 'blabla';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;

Procedure getposition;
begin
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
repeat
wait(1000);
SPS_GetMyPos();
until (false);
end;


Procedure StartAllDTM;

begin
giant := DTMFromString('mrAAAAHic42BgYOADYikGCGACYgEglgNicSBmg/IlgZgfSssAsRBULQhEBDhDedixHAN+wEgAwwAA9+oCHg==');
cosmic := DTMFromString('mggAAAHicY2NgYOADYgkgZgJiXiCWYUAAHiDmAmIBKJ8RiG/flIOqRsWSDNgBIw4MAQDL+wJ6');
decay := DTMFromString('mwQAAAHic42RgYOADYl4gZgNiUSCWY4AAFiAWg8qLQMUYobQQEAsDsTQUywKxraUJkGTCi2Hm4AOMRGA4AAD+TQHq');
air := DTMFromString('mrAAAAHic42BgYEgE4nQgjgLifCjOgopHAnE2FGdBcQEQVwBxFZS+fekiHDMwMGFgOSAJw9gAIwEMAwCVzg6X');
astral := DTMFromString('m6wAAAHic42ZgYOgD4i4gngjEU6DsViCeDcXTgbgXiDuAOAuIi4A4B4hTgTgJiDOBOAOI84C4DIiroPjsxrNYMQMDEwaWA5LYMDbASAJGAgCRIhl9');
pure := DTMFromString('mlwAAAHicY2dgYJjOxMCwGIiXQOl+IJ4GxPOBmIORgYEJiDmBmA+IRYFYDIiFgTgrNRWomwkrFmHADRjxYCgAAOuOBhw=');
small := DTMFromString('mwQAAAHic42RgYHBiYmBwAGJLIPYAYi8o2wKIHYHYE4h5GBkY/gDVMjKCCAYGTigWAGJhIBYEYi9nS6AkE15sxEAYMBKB4QAA0FsEzA==');
medium := DTMFromString('mwQAAAHic42RgYHBiYmBwAGIbIPYCYm8gtgRiayB2B2JHIDZgZGCQB2IFIFZhhPD1gdgciC2A2BKIA73sgKYx4cVGDIQBIxEYDgD6CwUy');
large := DTMFromString('mwQAAAHic42RgYHBiYmBwBGJrIPYAYl8gNgNiGyD2BGIHIA5jZGBwBWIPIPZkhPDDgTgOiGOhtJezJdA0JrzYiIEwYCQCwwEAqPcGdg==');
end;


Procedure FreeAllDTM;

begin
FreeDTM(decay);
FreeDTM(medium);
FreeDTM(large);
FreeDTM(giant);
FreeDTM(small);
FreeDTM(astral);
FreeDTM(air);
FreeDTM(pure);
FreeDTM(cosmic);
end;


procedure Walktoagi;
var
myPath:TPointArray;

begin
writeln('Walking to Altar');
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(117, 136), Point(122, 139), Point(127, 140), Point(131, 145), Point(137, 151), Point(141, 155), Point(146, 158), Point(151, 161), Point(157, 164), Point(163, 168), Point(170, 170), Point(175, 172), Point(184, 177), Point(190, 180), Point(193, 184), Point(198, 187), Point(201, 191), Point(207, 194), Point(217, 204), Point(222, 209), Point(228, 214), Point(235, 220), Point(240, 227), Point(243, 236), Point(246, 242), Point(250, 251), Point(253, 259), Point(255, 268), Point(256, 273), Point(256, 282), Point(255, 289), Point(262, 294), Point(262, 301), Point(262, 308), Point(261, 316), Point(258, 324), Point(254, 333), Point(249, 339), Point(245, 345), Point(243, 351), Point(242, 360), Point(244, 369)];
SPS_WalkPath(myPath);
FFlag(2);
end;


procedure PassWall1;
var
t: Integer;
begin
writeln('Clicking shortcut');
MarkTime(t);
repeat
MouseBox(265, 192, 282, 217, mouse_move);
If TimeFromMark(t) > 4000 then
begin
Walktoagi;
end;
until WaitUptext('eeze', 2000);
writeln('Going through shortcut');
ClickMouse2(mouse_Left);
wait(3000);
end;



procedure PassWallSlowOne;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
repeat
MouseBox(265, 192, 282, 217, mouse_move);
until IsUpText('eeze');
ClickMouse2(mouse_Left);
repeat
wait(500);
until AveragePixelShift(PBox, 800, 800) < 1000;
writeln('Got through first obstacle');
end;

procedure NextAgi;
var
myPath:TPointArray;

begin
writeln('Walking to next shortcut');
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(227,379), Point(215,399)];
SPS_WalkPath(myPath);
FFlag(2);
end;


procedure PassWall2;
var
t: Integer;
begin
writeln('Clicking shortcut');
MarkTime(t);
repeat
MouseBox(265, 192, 282, 217, mouse_move);
If TimeFromMark(t) > 4000 then
begin
NextAgi;
end;
until WaitUptext('eeze', 2000);
writeln('Going through shortcut');
ClickMouse2(mouse_Left);
wait(3000);
end;



procedure PassWallSlowTwo;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
repeat
MouseBox(265, 192, 282, 217, mouse_move);
until IsUpText('eeze');
ClickMouse2(mouse_Left);
repeat
wait(500);
until AveragePixelShift(PBox, 800, 800) < 1000;
writeln('Got through second obstacle');
end;


procedure ToAltar;
var
myPath:TPointArray;

begin
writeln('Reaching altar');
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(203, 423), Point(211, 465)];
SPS_WalkPath(myPath);
FFlag(0);
wait(1000);
end;



procedure EnterAltar;
var
x, y, t:Integer;

begin
MarkTime(t);
repeat
FindColorSpiralTolerance(x, y, 8936313, MSX1, MSY1, MSX2, MSY2, 15);
MMouse(x, y, 2, 2);
if TimeFromMark(t) > 5000 then
begin
ToAltar;
end;
until IsUpText('ster')
writeln('Entering altar');
ClickMouse2(mouse_Left);
wait(5000);
end;



Procedure GoCenter;
var
x, y:Integer;

begin
repeat
writeln('Walking to the Center');
//north portal
if FindColorTolerance(x, y, 6183782, 605, 142, 649, 161, 13) then
Mouse(633, 159, 0, 0, mouse_Left)
else
//east portal
if FindColorTolerance(x, y, 6183782, 550, 61, 565, 107, 13) then
Mouse(561, 89, 0, 0, mouse_Left)
else
//west portal
if FindColorTolerance(x, y, 6183782, 687, 64, 703, 106, 13) then
Mouse(696, 84, 0, 0, mouse_Left)
else
//south portal
if FindColorTolerance(x, y, 6183782, 603, 9, 652, 27, 13) then
Mouse(629, 21, 0, 0, mouse_Left);
wait(RandomRange(1000,1500));
until FlagPresent;
repeat
wait(500);
until FindColorTolerance(x, y, 6644067, MSX1, MSY1, MSX2, MSY2, 3);
repeat
wait(500);
until not FlagPresent;
writeln('Reached Center');
wait(1000);
end;


Procedure ClickAltar4;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL, t: Integer;
P: TPoint;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

if not(FindColorsTolerance(arP, 6644067, MSX1, MSY1, MSX2, MSY2, 4)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;

SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
begin;
ClickMouse2(mouse_Left);
writeln('Crafting Runes');
MarkTime(t)
repeat
wait(500);
until (FindChatBoxText('bind', 8, clBlack)) or (TimeFromMark(t) > 4000);
wait(700);
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
end;



Procedure Altarpls;
var
x, y, t: Integer;

begin
repeat
wait(100);
until FindColorTolerance(x, y, 6644067, MSX1, MSY1, MSX2, MSY2, 3);

begin;
MMouse(x, y, 5, 5);
if WaitUptext('raft', 2000) then
begin
ClickMouse2(mouse_Left);
writeln('Crafting Runes');
MarkTime(t)
repeat
wait(500);
until (FindChatBoxText('bind', 8, clBlack)) or (TimeFromMark(t) > 4000);
wait(700);
end else
begin
writeln('Cant find altar again');
TerminateScript;
end;
end;
end;


Procedure ClickAltarTwo;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2, t, c: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.78, 0.54);

FindColorsTolerance(arP, 6709603, MSX1, MSY1, MSX2, MSY2, 3);


arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 11.57) and (X <= 12.46) and (Y >= 11.76) and (Y <= 12.77) and (Z >= 13.95) and (Z <= 14.92) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
begin;
ClickMouse2(mouse_Left);
writeln('Crafting Runes');
MarkTime(t)
repeat
wait(500);
until (FindChatBoxText('bind', 8, clBlack)) or (TimeFromMark(t) > 4000);
wait(700);
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
c:= 0
repeat
Inc(c);
Writeln('Altar could not be found');
ClickAltarTwo;
wait(RandomRange(1000,1500));
until c > 5;
Exit;
end;
end;


Procedure ClickAltarOne;
var
x, y, t:Integer;

begin
if FindColorSpiralTolerance(x, y, 6643555, MSX1, MSY1, MSX2, MSY2, 4) then
begin
writeln('Crafting Rune');
Mouse(x, y, 5, 5, mouse_Left);
MarkTime(t);
repeat
wait(500);
until (FindChatBoxText('bind', 8, clBlack)) or (TimeFromMark(t) > 5000);
wait(1500);
end else
begin
ClickAltarTwo;
end;
end;


Procedure EmptyGiant;
var
x, y:Integer;
begin

//Empty Giant Pouch
if FindDTM(giant, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Emptying Giant Pouch');
Mouse(x, y, 3, 3, mouse_Left);
end else
begin
writeln('No giant pouch');
Exit;
end;
end;



Procedure EmptySmall;
var
x, y:Integer;
begin

//Empty Small Pouch
if FindDTM(small, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Emptying Small Pouch');
Mouse(x, y, 3, 3, mouse_Left);
end else
begin
writeln('No small pouch');
Exit;
end;
end;



Procedure EmptyMedium;
var
x, y:Integer;
begin

//Empty Medium Pouch
if FindDTM(medium, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Emptying Medium Pouch');
Mouse(x, y, 3, 3, mouse_Left);
end else
begin
writeln('No medium pouch');
Exit;
end;
end;


Procedure EmptyLarge;
var
x, y:Integer;
begin

//Empty Large Pouch
if FindDTM(large, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Emptying Large Pouch');
Mouse(x, y, 3, 3, mouse_Left);
end else
begin
writeln('No large pouch');
Exit;
end;
end;


Procedure CraftRune;
begin
ClickAltarTwo;
EmptyGiant;
ClickAltarTwo;
EmptySmall;
EmptyMedium;
EmptyLarge;
ClickAltarTwo;
end;


Procedure GoBack;
var
x, y:Integer;

begin
writeln('Walking to portal');
//north portal
repeat
if FindColorTolerance(x, y, 6183782, 605, 142, 649, 161, 13) then
Mouse(x, y, 0, 0, mouse_Left)
else
//east portal
if FindColorTolerance(x, y, 6183782, 550, 61, 565, 107, 13) then
Mouse(x, y, 0, 0, mouse_Left)
else
//west portal
if FindColorTolerance(x, y, 6183782, 687, 64, 703, 106, 13) then
Mouse(x, y, 0, 0, mouse_Left)
else
//south portal
if FindColorTolerance(x, y, 6183782, 603, 9, 652, 27, 13) then
Mouse(x, y, 0, 0, mouse_Left);

wait(RandomRange(1000,1500));
until FlagPresent;

repeat
wait(1500);
if FlagPresent then
begin
wait(1500);
writeln('FlagPresent');
end;
until not FlagPresent;
wait(1500);
end;



Procedure GoOut;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.90);

FindColorsTolerance(arP, 8823462, MSX1, MSY1, MSX2, MSY2, 10);

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 132) and (R <= 195) and (G >= 130) and (G <= 193) and (B >= 116) and (B <= 156) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 20.98) and (X <= 47.03) and (Y >= 22.48) and (Y <= 51.56) and (Z >= 20.04) and (Z <= 38.49) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
repeat
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('nter')) then
ClickMouse2(mouse_Left);
until DidRedClick;
writeln('Clicked portal');
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find portal');
Exit;
end;
end;



Procedure AltartoWall;
var
myPath:TPointArray;

begin
wait(2000);
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(203, 423), Point(215, 391)];
SPS_WalkPath(myPath);
FFlag(1);
end;


Procedure BankWall;

begin
repeat
MouseBox(261, 121, 278, 150, mouse_move);
wait(RandomRange(500,1000));
until WaitUptext('eeze', 2000);
writeln('Going through shortcut');
ClickMouse2(mouse_Left);
wait(RandomRange(3000,3200));
end;



procedure BankAgi2;
var
myPath:TPointArray;

begin
writeln('Walking to next shortcut');
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(227,379), Point(243,363)];
SPS_WalkPath(myPath);
FFlag(1);
end;


procedure WalktoBank;
var
myPath:TPointArray;

begin
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
myPath := [Point(242, 359), Point(242, 352), Point(245, 343), Point(248, 340), Point(251, 334), Point(255, 329), Point(259, 320), Point(259, 314), Point(260, 307), Point(259, 300), Point(259, 293), Point(256, 286), Point(255, 277), Point(253, 269), Point(250, 261), Point(247, 253), Point(244, 247), Point(244, 241), Point(241, 231), Point(237, 226), Point(234, 220), Point(228, 213), Point(223, 209), Point(218, 205), Point(211, 198), Point(204, 193), Point(199, 190), Point(194, 187), Point(188, 183), Point(181, 179), Point(173, 175), Point(168, 171), Point(162, 167), Point(156, 163), Point(148, 158), Point(143, 154), Point(137, 151), Point(131, 145), Point(123, 141), Point(117, 138)];
SPS_WalkPath(myPath);
FFlag(6);
wait(2000);
end;



Procedure ClickBank;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 2.64);

if not(FindColorsTolerance(arP, 7328734, MSX1, MSY1, MSX2, MSY2, 11)) then
begin
repeat
writeln('Cant find bank. Trying to find again...');
WalktoBank;
wait(RandomRange(2000,2500));
until FindColorsTolerance(arP, 7328734, MSX1, MSY1, MSX2, MSY2, 11);
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 34.97) and (X <= 74.97) and (Y >= 39.10) and (Y <= 83.94) and (Z >= 17.49) and (Z <= 36.69) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('ank')) then
begin;
writeln('Found Bank');
ClickMouse2(mouse_Left);
repeat
wait(RandomRange(100,500));
until BankScreen;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
end;


Procedure BankFailsafe;
begin
if not BankScreen then
begin
repeat
writeln('Bank Screen not found');
wait(RandomRange(1500,2000));
ClickBank;
until BankScreen
end;
end;



Procedure DepositCos;
var
x, y:Integer;

begin

//Deposit Cosmics
if BankScreen then
begin
if FindColorTolerance(x, y, 2020052, MIX1, MIY1, MIX2, MIY2, 50) then
begin
writeln('Found Cosmic');
Mouse(x, y, 4, 4, mouse_Right);
WaitOptionMulti(['All', 'posit'], 300);
end else;
Exit;
end;
end;


Procedure WithdrawEss;
begin
//Withdraw Essence
if BankScreen then
begin
MouseBankSlot(1, mouse_move);
writeln('Withdrawing Pure Essence');
ClickMouse2(mouse_Right);
WaitOptionMulti(['Withdraw-All', 'w-A', 'll'], 1000);
end;
end;


Procedure FillGiant;
var
x, y:Integer;
begin

//Fill Giant Pouch
if BankScreen then
begin
if FindDTM(giant, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Filling Giant Pouch');
Mouse(x, y, 3, 3, mouse_Right);
WaitOption('ill',1000);
end else
begin
writeln('No giant pouch');
Exit;
end;
end;
end;



Procedure RepairDecay;
var
x, y:Integer;

begin

//Find Decayed Giant Pouch
if FindDTM(decay, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Found decayed pouch');
wait(RandomRange(1000,1500));
end else
begin
Exit;
end;

if InvFull then
begin
writeln('Cant withdraw NPC contact runes');
FindDTM(pure, x, y, MIX1, MIY1, MIX2, MIY2);
Mouse(x, y, 3, 3, mouse_Right);
WaitOption('-5 Pu', 500);
end;

if FindDTM(air, x, y, MBX1, MBY1, MBX2, MBY2) then
begin
writeln('Withdrawing airs');
Mouse(x, y, 3, 3, mouse_Left);
wait(RandomRange(500,1000));
ClickMouse2(mouse_Left);
if FindDTM(cosmic, x, y, MBX1, MBY1, MBX2, MBY2) then
begin
writeln('Withdrawing cosmic');
Mouse(x, y, 3, 3, mouse_Left);
if FindDTM(astral, x, y, MBX1, MBY1, MBX2, MBY2) then
begin
writeln('Withdrawing astral');
Mouse(x, y, 3, 3, mouse_Left);
CloseBank;
GameTab(tab_Magic);
wait(500);
writeln('Begin NPC contact');
MouseBox(689, 224, 702, 235, mouse_Left);
MouseBox(412, 314, 459, 319, mouse_move);
WaitUptext('peak', 1000);
ClickMouse2(mouse_Left);
repeat
wait(500);
until AreTalking;
repeat
ClickContinue(True, False);
until FindNPCChatText('repair', Clickleft);
repeat
DoConversation('', False);
until not AreTalking
writeln('Done repairing pouch');
GameTab(tab_Inv);
ClickBank;
BankFailsafe;
FillGiant;
end else
begin
writeln('No astrals');
TerminateScript;
end;
end else
begin
writeln('No cosmics');
TerminateScript;
end;
end else
begin
writeln('No airs');
TerminateScript;
end;
end;


Procedure FillSmall;
var
x, y:Integer;
begin

//Fill Small Pouch
if BankScreen then
begin
if FindDTM(small, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Filling Small Pouch');
Mouse(x, y, 3, 3, mouse_Right);
WaitOption('ill',300);
end else
begin
writeln('No small pouch');
Exit;
end;
end;
end;


Procedure FillMedium;
var
x, y:Integer;
begin

//Fill Medium Pouch
if BankScreen then
begin
if FindDTM(medium, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Filling Medium Pouch');
Mouse(x, y, 3, 3, mouse_Right);
WaitOption('ill',300);
end else
begin
writeln('No medium pouch');
Exit;
end;
end;
end;


Procedure FillLarge;
var
x, y:Integer;
begin

//Fill Large Pouch
if BankScreen then
begin
if FindDTM(large, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Filling Large Pouch');
Mouse(x, y, 3, 3, mouse_Right);
WaitOption('ill',300);
end else
begin
writeln('No large pouch');
Exit;
end;
end;
end;



Procedure BankingProcedure;
begin
BankFailsafe;
DepositCos;
WithdrawEss;
FillGiant;
WithdrawEss;
FillSmall;
FillMedium;
FillLarge;
RepairDecay;
WithdrawEss;
end;


Procedure MainLoop;
begin
WalktoBank;
clickbank;
BankingProcedure;
WalktoAgi;
PassWall1;
NextAgi;
Passwall2;
ToAltar;
EnterAltar;
GoCenter;
CraftRune;
GoBack;
GoOut;
AltartoWall;
Bankwall;
Bankagi2;
Bankwall;
end;


procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
end;


begin
SetupLogin;
DeclarePlayers;
LoginPlayer;

repeat
wait(500);
until LoggedIn;

if LoggedIn then
begin
ExitSquealOfFortune();
ClickNorth(SRL_ANGLE_HIGH);
end;

AddOnTerminate('FreeAllDTM');
StartAllDTM;

repeat
MainLoop;
until AllPlayersInactive;
end.

CephaXz

2012-04-27 07:53:57

Went to school, back from school, took a nap, still no replies :unsure:
Have been 12 hours since then.

Anyone? Bump.

stuartroad

2012-04-27 08:01:21

I don't know much about scripting, but can't you just use the same concept as banking, but add an amount of tries before logging out?

Again, if this doesn't help at all, I do not know a lot :P

CephaXz

2012-04-27 08:06:07

I don't know how to make sure I am at the EXACT coordinates, or there is nothing like that. If there is, I can make it to do the clicking again until I am at the coordinate. There are almost no objects around there, so I can't use ODTM.

stuartroad

2012-04-27 08:13:27

I don't think I really understand you. Perhaps you could make it skip the shortcut and just go all the way around?

Does getting the random in Zanaris stop you from walking?

Also many of the things you can't do, can you just copy them from someone else's script? E.g zmi for contact, for examples of sps maps.

Also aren't cosmic's cheaper than pure essence? :D

CephaXz

2012-04-27 08:25:37

For the bank, I can make it click the bank until the bank screen appears. There is a function for detecting bank screen.
For the shortcut, I cant make it click to pass the shortcut until I reached the coordinate of the position after get past the shortcut. Or make it if I'm not at the coordinate, then go all the way around. Because there is no function like

if not AtCoordinateAfterShortcut then
RunAllTheWayRound
or

repeat
ClickShortcut
until Reached Coordinate After Shortcut

get it now? And double cosmics is the second best profit for runecrafting now.
http://merchanting.geupdate.com/runecrafting.php

Gucci

2012-04-28 13:36:32

Well if you just have to talk to the NPC and he will go away then just use ClickContinue(True, True); this will have the script keep clicking continue. To see if the random is there you could have it look for the text in the chatbox that stops you from completing the task

CephaXz

2012-04-28 22:02:42

From: Gucci
Well if you just have to talk to the NPC and he will go away then just use ClickContinue(True, True); this will have the script keep clicking continue. To see if the random is there you could have it look for the text in the chatbox that stops you from completing the task


I had tried that once, but it seemed like the function can't find blue texts. But that was like when I just started to script this. Maybe I should try it again. Thanks :)