View Full Version : Invalid number of parameters at line 55
[Error] C:\Simba\Includes\srl/srl/misc/smart.simba(56:19): Invalid number of parameters at line 55
Compiling failed.
Quite new to Simba. So i don't know if it is because or me :L
Stray Bullets
09-04-2012, 06:30 PM
Change that line to {$DEFINE SMART}
Ashaman88
09-04-2012, 06:35 PM
What script are you trying to use?
Change that line to {$DEFINE SMART}
What Line it opened up a new file
What script are you trying to use?
W100S-EM W100 Shantay Bonfires
Stray Bullets
09-04-2012, 06:51 PM
What Line it opened up a new file
Post line 55 of the script you're trying to use. Or better yet, just post the whole script lol.
program W100S_EM;
{************************************************* ******************************
W100S-EM - World 100 Shantay Chest Bonfires Er1k's Mod
author; CephaXz
modded; Er1k
Description: World 100 Shantay Chest Bonfire trainer
1.2 changelog
- Added SRL Stats
- Added more FindNormalRandoms for better random detection
- Minor additions to the object finders, showing colors count/ no detection
- Script turns assists to off for you, set chat to game at start
************************************************** *****************************}
{$define SMART}
{$define USESPS}
//{$define USEODTM} //you must only enable either ODTM or SPS
{.include srl/srl/misc/smart.simba}
{.include srl/srl.simba}
{$IFDEF USEODTM}
{.include ObjectDTM\ObjDTMInclude.simba}
{$ELSE}
{.include srl/srl/misc/paintsmart.simba}
{$ENDIF}
{$IFDEF USESPS}
{.include sps/sps.simba} //now used again
{$ENDIF}
const
ODTM_WALK = '81:91:4:9:7:39:60:9:7:30:81:9:7:91:95:9:7:99:74';
ODTM_AREA = '81:91:4:9:7:39:60:9:7:30:81:9:7:91:95:9:7:99:74:7 :56:47:82:47:96:73:85:102:56:102:48:91:48:55';
var
Stats, Logs, CollectedRewards, StartingXP: Integer;
const
version = '1.2';
SRLStats_Username = '';
SRLStats_Password = '';
{Which slot in bank is your log is?}
LOGS_BANKSLOT = 1;
{How many ms to timeout for re-adding, change if you're LOW LEVEL}
FM_TIMEOUT = 10000;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Players[0].WorldInfo := [False, 100]; //thanks olly
end;
procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
if (SRLStats_Username = '') then
SetupSRLStats(1155, 'Anonymous', 'anon1337')
else
SetupSRLStats(1155, SRLStats_Username, SRLStats_Password);
DeclarePlayers;
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
OpenWorldScreen;
if not WorldScreen then
OpenWorldScreen;
if WorldScreen then
begin
writeln('picking world 100');
SelectWorld(100);
LogInPlayer;
end;
end;
while not LoggedIn do
wait(500);
if LoggedIn then
begin
ClickNorth(SRL_ANGLE_HIGH);
ExitSquealOfFortune();
if not IsXPBarOpen then
ToggleXPBar(True);
StartingXP := GetXPBarTotal;
SetChat('off', CHAT_ASSIST); //turn off your assist so that you wont complain
SetChat('off', CHAT_PUBLIC);
Mouse(90 + (CHAT_GAME * 55), 496, 8, 3, mouse_left); //click game tab
end;
end;
Procedure StartDTM;
begin
Logs := DTMFromString('mwQAAAHic42RgYHBiYmCwZoLQ3kDsA8SBUL YLVO4pUN0dIL4NxDeA+CEQPwPiN0D8Dog/ArGJngCQZMKL/zMQBoxEYDgAAI5rDB0=');
end;
Procedure EndDTM;
begin
FreeDTM(Logs);
end;
Function FindInvLogs: Boolean; //Modified by Er1k
var x, y: integer;
begin
Result := FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2);
end;
Function NotFindInvLogs: Boolean;
var x, y: integer;
begin
Result := not FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2);
end;
Function FoundInvLogs: Boolean;
var x, y: integer;
begin
if FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MouseItem(CoordsToItem(x, y), mouse_move);
Result := True;
end;
end;
function OpeningBank: boolean; //Modified by Er1k
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
if PinScreen then
InPin(Players[CurrentPlayer].Pin);
if WaitFunc(@BankScreen, 100, 5000) then
begin
if not InvEmpty then DepositAll;
writeln('Withdrawing logs');
//Keep inventory slot
while GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10) = 0 do
begin
wait(100+random(50));
if not LoggedIn then Exit; //didn't expect this to fail actually, but it did
end;
writeln('amount of logs: ' + IntToStr(GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10)));
if GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10) < 29 then //sorry guys
begin
writeln('Not enough logs - Logout');
Logout;
TerminateScript;
end;
MouseBankSlot(LOGS_BANKSLOT, mouse_Right);
result:= WaitOption('All', 1000);
if result then
result:= CloseBank;
end;
end;
Function RewardsCollected :Boolean; //Unused
begin
Result := IsChatBoxTextAnyLine('spirit', clBlack);
end;
Function FindSpirit :Boolean; //Modified by Er1k
var
a: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
begin
result:=false;
if(not(LoggedIn))then Exit;
FindNormalRandoms;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
// Original colors
// SetColorSpeed2Modifiers(0.52, 0.55);
// if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 4021133, 202, 129, 325, 230, 14) then
SetColorSpeed2Modifiers(0.19, 0.75);
if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3825566, 202, 129, 325, 230, 12) then
begin
writeln('color count: ' + InttoStr(length(tpa)));
if Length(TPA) < 20 then //modded
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end else
begin
writeln('OMG SPIRIT?');
end;
end;
ATPA := TPAtoATPAEx(TPA, 20, 20);
SortATPAFromSize(ATPA, 1000, true);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
{$IFDEF SMART}
SMART_DrawDotsEx(false, ATPA[a], clYellow);
{$ENDIF}
Mouse(MP.X, MP.Y, 2, 2, mouse_move);
if WaitUpText('spiri', 500) then //using Uptext detection instead of just right-click
begin
ClickMouse2(mouse_right);
// Mouse(MP.X, MP.Y, 2, 2, mouse_Right);
if WaitOption('ollect', 3000) then
begin
WaitFunc(@RewardsCollected, 10, 3000);
writeln('Collect rewards');
writeln('Back to BonBon');
Result := True;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
Break;
end;
end;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function BankScreenEx: boolean; //New
begin
result:= BankScreen or PinScreen;
end;
function FindShantayChest: boolean; //New
var a, tmpCTS, Tries: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
result:=false;
if not LoggedIn then Exit;
if BankScreenEx then
begin
result:=true;
Exit;
end;
FindNormalRandoms;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.12);
if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
begin
writeln('shantay chest tpa count: ' + IntToStr(length(tpa)));
ATPA:= TPAtoATPAEx(tpa, 25, 25);
for a:=0 to high(atpa) do
begin
{$IFDEF SMART}
SMART_DrawDotsEx(false, ATPA[a], clYellow);
{$ENDIF}
MP:= MiddleTPA(atpa[a]);
Mouse(mp.x, mp.y, 4, 4, mouse_move);
if WaitUpTextMulti(['pen S', 'antay','tay c', 'hest'], 500) then
begin
ClickMouse2(mouse_left);
if WaitFunc(@DidRedClick, 50, 1000) then
begin
writeln('Clicked Bank chest');
if WaitFunc(@BankScreenEx, 100, 5000) then
begin
writeln('BankScreenEx found');
result:= true;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
break;
end;
end;
end;
end;
end
else writeln('Shantay chest not found...');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
procedure AntiBan;
var r: Integer;
begin
if not LoggedIn then Exit;
r := (RandomRange(1, 14));
if (r = 4) then
begin
writeln('Doing antiban');
case Random(20) of
0, 3: PickUpMouse;
1: RandomRClick;
2:
begin
HoverSkill('firemaking', false);
GameTab(tab_Inv);
end;
4: MMouse(MIX1, MIY1, MIX2, MIY2);
5: MMouse(MMX1, MMY1, MMX2, MMY2);
end;
end;
end;
function AddingScreen :Boolean;
begin
Result := CountColorTolerance(4543066, 17, 355, 484, 456, 2) > 2000;
end;
function BonBon: boolean; //Modified by Er1k
begin
result:=false;
if not LoggedIn then Exit;
if not (getCurrentTab = tab_Inv) then
FTab(tab_Inv);
if WaitFunc(@FoundInvLogs, 200, 5000) then
begin
ClickMouse2(mouse_Left);
if WaitFunc(@AddingScreen, 200, 5000) then
begin
writeln('Found add to bonfire screen');
MouseBox(323, 411, 389, 448, mouse_Left);
writeln('BONBONBONBON-ing');
result:= true;
end;
end;
end;
procedure XPTotalFinding;
var
XPGained: Integer;
begin
XPGained := GetXPBar(1);
writeln('EXP Gained' + IntToStr(XPGained));
end;
Procedure DrawTheBox;
var
XPBOX: TBox;
begin
XPBOX := IntToBox(375, 7, 421, 21);
SMART_DrawBox(XPBOX);
end;
procedure PlayerStats;
var
Wet, Wst, Cst, Srt, Tih, Tim, Tis, Awt, Sec, sst, EndingXP, XPGained: Integer;
begin
Cst := GetSystemTime;
Srt := (cst - sst) / 1000;
Tih := srt / 3600;
tim := (srt / 60) - tih * 60;
Tis := srt - tim * 60 - tih * 3600;
Awt := wet - wst
Sec := GetTimeRunning div 1000 + 1;
EndingXP := GetXPBarTotal;
XPGained := EndingXP - StartingXP;
Writeln('######################################### ##############');
Writeln(' Shantay Bank Chest Bonfire ');
Writeln('######################################### ##############');
Writeln('Logs / Hour : ' + IntToStr(Round(3600 * Players[CurrentPlayer].Integers[3] / Sec)));
Writeln('Logs Done : ' + IntToStr(Players[CurrentPlayer].Integers[3]));
Writeln('Fire Spirit : ' + IntToStr(CollectedRewards));
writeln('EXP Gained : ' + IntToStr(XPGained));
writeln('EXP / Hour : ' + IntToStr(Round(3600 * XPGained / Sec)));
Writeln('Running for : ' + TimeRunning);
Writeln('-------------------------------------------------------');
//SRL stats
if (TimeFromMark(Stats) > 360000) then // 6 minutes.
begin
Stats_Commit;
MarkTime(Stats);
end;
end;
function LogsDecreased(start: integer): boolean; //New
begin
result:= CountItems('dtm', logs, []) < start;
end;
function InShantayPassTPA: boolean;
var tpa: TPointArray;
begin
result:= false;
SetColorToleranceSpeed(1);
if FindMMColorsSpiralTolerance(tpa, 2248829, 25) then //rock brown
begin
writeln('tpa count: '+ IntToStr(length(tpa)));
result:= length(tpa) >= 850;
end;
writeln('InShantayPassTPA: ' + booltostr(result));
end;
function AdjustPositionTPA: boolean;
var x, y: integer;
tpa: TPointArray;
begin
result:= false;
if not InShantayPassTPA then Exit; //
SetColorToleranceSpeed(1);
if FindMMColorsSpiralTolerance(tpa, 2413294, 25) then //bank symbol
begin
writeln('tpa count: '+ IntToStr(length(tpa)));
MiddleTPAEx(tpa, x, y);
Mouse(x, y, 3, 3, mouse_left);
wait(1000+random(250));
while IsMoving do
wait(100+random(50));
result:= true;
end;
writeln('AdjustPositionTPA: ' + booltostr(result));
end;
//odtm main point
//'84:84:3:9:7:49:39:9:7:31:56:9:7:36:80'
//odtm area
//'80:80:3:9:7:49:39:9:7:31:56:9:7:36:80:8:58:40:77: 40:92:53:92:83:76:96:61:96:51:81:51:46'
{$IFDEF USEODTM}
function InShantayPass: boolean; //New
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
result:= ObjDTM_InArea(ODTM_AREA, true);
end;
function AdjustPosition: boolean; //New
var odtm: string;
cx, cy: integer;
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
odtm:=ODTM_WALK;
if ObjDTM_Find(odtm, cx, cy, True) then
begin
result:= true;
Writeln('We found it, now lets walk it!');
ObjDTM_Walk(odtm, 2, 200, 10, True);
end else
Writeln('We could not walk here, what a shame');
if result then
FFlag(2);
end;
{$ENDIF}
{$IFDEF USESPS}
function InShantayPass: boolean;
var p: TPoint;
begin
result:= false;
FindNormalRandoms;
if not InShantayPassTPA then Exit;
p:= SPS_GetMyPos;
writeln('Acquiring position...');
writeln('SPS located: ' + format('%d %d', [p.x, p.y]));
if (p.x <= -1) and (p.y <= -1) then Exit; //lost
result:= (Distance(p.x, p.y, 5065, 4185) <= 75);
writeln('InShantayPass: ' + booltostr(result));
end;
function AdjustPosition: boolean; //New
var p: TPoint;
begin
result:= false;
FindNormalRandoms;
if not InShantayPass then
begin
writeln('Cannot adjust as we''re not in Shantay Pass');
writeln('AdjustPosition: ' + booltostr(result));
Exit;
end;
p:= SPS_GetMyPos();
writeln('Adjusting position...');
writeln('SPS located: ' + format('%d %d', [p.x, p.y]));
result:= SPS_WalkPath([Point(5060, 4185)]);
writeln('AdjustPosition: ' + booltostr(result));
end;
{$ENDIF}
function CheckWorld100: boolean;
var cw: integer;
begin
result:=false;
FindNormalRandoms;
cw:= CurrentWorld;
writeln('current world is: ' + IntToStr(cw));
if (cw<>100) then
begin
writeln('world switch required');
result:= ChangeWorld(100);
writeln('world switch success: ' + booltostr(result));
end
else result:= true;
end;
procedure MainLoop; //New
var action: string;
t, t2, t3, ts, start, fail, fail2, fail3: integer;
check, redo: boolean;
v: TVariantArray;
begin
action:= 'bank';
while LoggedIn do
begin
FindNormalRandoms;
writeln('Current action is: ' + action);
if fail > 0 then
writeln('fail: ' + IntToStr(fail));
if (fail >= 5) then
begin
writeln('banking failed consecutively...');
writeln('checking our position...');
FindNormalRandoms;
if InShantayPass then
action:='walk'
else
action:='lode';
end;
if (fail3 >= 3) then //verify if we''re in world 100
begin
writeln('failed to add to bonfires for quite a bit...');
writeln('verifying if we''re on world 100 at all...');
FindNormalRandoms;
if not CheckWorld100 then
begin
Logout; //finish the script and hope SMARTManager/CrashSMART restarts it
TerminateScript;
end
else fail3:= 0; //continue, we''re just having very bad luck
end;
case action of
'bank': begin
if FindShantayChest then
begin
if OpeningBank then
begin
WaitFunc(@FindInvLogs, 200, 2000);
action:= 'burn';
fail:= 0;
end;
end
else Inc(fail);
end;
'burn': begin
redo:= true;
check:=true;
if (CountItems('dtm', Logs, []) = 0) then
begin
action:='bank';
continue;
end;
if Bonbon then
begin
start:= CountItems('dtm', Logs, []);
writeln('starting logs: ' + IntToStr(start));
v:= [start];
//use first log adding as heuristic, does not work for low levels
//because low levels might have large delays in adding first log to bonfire
if not WaitFuncEx('LogsDecreased', v, 500, 5000) then
begin
writeln('Guessing no bonfires nearby, relocate!');
AdjustPosition;
Inc(fail2); //silent updated
//Maybe try to find fire here later??
//todo
//if you insist you want to make your own fires
//add code here, but i aint doing this for your safety
if (fail2 >= 2) then //force banking to relocate
begin
writeln('position adjusting doesnt seem to work...');
writeln('will try to find bank chest to relocate...');
action:='bank';
fail2:= 0;
Inc(fail3);
end;
continue;
end;
fail2:=0;
MarkTime(t);
MarkTime(t2);
MarkTIme(t3);
repeat
FindNormalRandoms;
// writeln('current logs: ' + IntToStr(CountItems('dtm', Logs, [])));
//find fire spirit, thanks Ashaman88 for the tips
if IsChatBoxTextAnyLine('emerges', 397249) and (InvCount<24) and check then
// if (FindChatBoxText('emerges',8,397249{clRed})) and (InvCount<24) then
begin
writeln('Spirit is around!');
if FindSpirit then
begin
check:= false; //dont scan after we have collected rewards
Inc(CollectedRewards);
break;
end;
end;
//update and continue
if LogsDecreased(start) then
begin
start:= CountItems('dtm', Logs, []);
MarkTime(t);
end;
//No update in FM_TIMEOUT ms, force redo
if (TimeFromMark(t) > FM_TIMEOUT) and not LogsDecreased(start) then
begin
writeln('Logs stopped burning - will reburn');
break;
end;
wait(250+random(250));
until (CountItems('dtm', Logs, []) = 0) or (TimeFromMark(t2) > 120000);
//Decide action
if (CountItems('dtm', Logs, []) = 0) then
begin
IncEx(Players[CurrentPlayer].Integers[3], 28);
redo:= false;
PlayerStats;
end;
if not redo then
action:= 'bank';
end;
end;
'walk': begin
if AdjustPosition then
begin
action:='bank';
fail:= 0;
end;
end;
'lode': begin
FindNormalRandoms;
writeln('If you get this chances are you''ve failed a random!');
writeln('Or you''ve got a random but SRL failed to detect it');
writeln('TODO - logout and terminate');
Logout;
TerminateScript;
end;
end;
wait(100+random(50));
end;
end;
procedure DebugLocations; //Acid test on location finders
begin
InShantayPass;
AdjustPosition;
end;
begin
SetupLogin;
{$IFDEF USEODTM}
ObjDTM_Setup; //req'd for ODTM usage
ObjDTM_Debug := True;
{$ENDIF}
{$IFDEF USESPS}
SPS_SETUP(RUNESCAPE_SURFACE,['12_10']);
{$ENDIF}
SMART_ClearCanvas;
AddOnTerminate('EndDTM');
StartDTM;
// UseFindMod := false; //uncomment if you don't want mods to mess up
// DebugLocations; //uncomment if you need debug
MainLoop;
end.
Stray Bullets
09-04-2012, 07:06 PM
Edit: Thought better of just posting the fix.
Refer here and see if you can't work it out yourself.
http://villavu.com/forum/showthread.php?t=88578&highlight=walkthrough
The fix is incredibly easy.
I Have looked at that but i get the same issue.
Stray Bullets
09-04-2012, 07:29 PM
program W100S_EM;
{************************************************* ******************************
W100S-EM - World 100 Shantay Chest Bonfires Er1k's Mod
author; CephaXz
modded; Er1k
Description: World 100 Shantay Chest Bonfire trainer
1.2 changelog
- Added SRL Stats
- Added more FindNormalRandoms for better random detection
- Minor additions to the object finders, showing colors count/ no detection
- Script turns assists to off for you, set chat to game at start
************************************************** *****************************}
{$define SMART}
{$define USESPS}
//{$define USEODTM} //you must only enable either ODTM or SPS
{$DEFINE SMART}
{.include srl/srl.simba}
{$IFDEF USEODTM}
{.include ObjectDTM\ObjDTMInclude.simba}
{$ELSE}
{$i SRL/SRL/Misc/SmartGraphics.simba}
{$ENDIF}
{$IFDEF USESPS}
{.include sps/sps.simba} //now used again
{$ENDIF}
const
ODTM_WALK = '81:91:4:9:7:39:60:9:7:30:81:9:7:91:95:9:7:99:74';
ODTM_AREA = '81:91:4:9:7:39:60:9:7:30:81:9:7:91:95:9:7:99:74:7 :56:47:82:47:96:73:85:102:56:102:48:91:48:55';
var
Stats, Logs, CollectedRewards, StartingXP: Integer;
const
version = '1.2';
SRLStats_Username = '';
SRLStats_Password = '';
{Which slot in bank is your log is?}
LOGS_BANKSLOT = 1;
{How many ms to timeout for re-adding, change if you're LOW LEVEL}
FM_TIMEOUT = 10000;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Players[0].WorldInfo := [False, 100]; //thanks olly
end;
procedure SetupLogin;
begin
ClearDebug;
SRL_SixHourFix := True;
SMART_FixSpeed := True;
SetupSRL;
if (SRLStats_Username = '') then
SetupSRLStats(1155, 'Anonymous', 'anon1337')
else
SetupSRLStats(1155, SRLStats_Username, SRLStats_Password);
DeclarePlayers;
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
OpenWorldScreen;
if not WorldScreen then
OpenWorldScreen;
if WorldScreen then
begin
writeln('picking world 100');
SelectWorld(100);
LogInPlayer;
end;
end;
while not LoggedIn do
wait(500);
if LoggedIn then
begin
ClickNorth(SRL_ANGLE_HIGH);
ExitSquealOfFortune();
if not IsXPBarOpen then
ToggleXPBar(True);
StartingXP := GetXPBarTotal;
SetChat('off', CHAT_ASSIST); //turn off your assist so that you wont complain
SetChat('off', CHAT_PUBLIC);
Mouse(90 + (CHAT_GAME * 55), 496, 8, 3, mouse_left); //click game tab
end;
end;
Procedure StartDTM;
begin
Logs := DTMFromString('mwQAAAHic42RgYHBiYmCwZoLQ3kDsA8SBUL YLVO4pUN0dIL4NxDeA+CEQPwPiN0D8Dog/ArGJngCQZMKL/zMQBoxEYDgAAI5rDB0=');
end;
Procedure EndDTM;
begin
FreeDTM(Logs);
end;
Function FindInvLogs: Boolean; //Modified by Er1k
var x, y: integer;
begin
Result := FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2);
end;
Function NotFindInvLogs: Boolean;
var x, y: integer;
begin
Result := not FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2);
end;
Function FoundInvLogs: Boolean;
var x, y: integer;
begin
if FindDTM(Logs, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
MouseItem(CoordsToItem(x, y), mouse_move);
Result := True;
end;
end;
function OpeningBank: boolean; //Modified by Er1k
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
if PinScreen then
InPin(Players[CurrentPlayer].Pin);
if WaitFunc(@BankScreen, 100, 5000) then
begin
if not InvEmpty then DepositAll;
writeln('Withdrawing logs');
//Keep inventory slot
while GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10) = 0 do
begin
wait(100+random(50));
if not LoggedIn then Exit; //didn't expect this to fail actually, but it did
end;
writeln('amount of logs: ' + IntToStr(GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10)));
if GetBankItemAmount((LOGS_BANKSLOT-1) mod 10, (LOGS_BANKSLOT-1) div 10) < 29 then //sorry guys
begin
writeln('Not enough logs - Logout');
Logout;
TerminateScript;
end;
MouseBankSlot(LOGS_BANKSLOT, mouse_Right);
result:= WaitOption('All', 1000);
if result then
result:= CloseBank;
end;
end;
Function RewardsCollected :Boolean; //Unused
begin
Result := IsChatBoxTextAnyLine('spirit', clBlack);
end;
Function FindSpirit :Boolean; //Modified by Er1k
var
a: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
tmpCTS : Integer;
begin
result:=false;
if(not(LoggedIn))then Exit;
FindNormalRandoms;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
// Original colors
// SetColorSpeed2Modifiers(0.52, 0.55);
// if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 4021133, 202, 129, 325, 230, 14) then
SetColorSpeed2Modifiers(0.19, 0.75);
if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3825566, 202, 129, 325, 230, 12) then
begin
writeln('color count: ' + InttoStr(length(tpa)));
if Length(TPA) < 20 then //modded
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end else
begin
writeln('OMG SPIRIT?');
end;
end;
ATPA := TPAtoATPAEx(TPA, 20, 20);
SortATPAFromSize(ATPA, 1000, true);
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
{$IFDEF SMART}
SMART_DrawDotsEx(false, ATPA[a], clYellow);
{$ENDIF}
Mouse(MP.X, MP.Y, 2, 2, mouse_move);
if WaitUpText('spiri', 500) then //using Uptext detection instead of just right-click
begin
ClickMouse2(mouse_right);
// Mouse(MP.X, MP.Y, 2, 2, mouse_Right);
if WaitOption('ollect', 3000) then
begin
WaitFunc(@RewardsCollected, 10, 3000);
writeln('Collect rewards');
writeln('Back to BonBon');
Result := True;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
Break;
end;
end;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function BankScreenEx: boolean; //New
begin
result:= BankScreen or PinScreen;
end;
function FindShantayChest: boolean; //New
var a, tmpCTS, Tries: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
result:=false;
if not LoggedIn then Exit;
if BankScreenEx then
begin
result:=true;
Exit;
end;
FindNormalRandoms;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.12);
if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
begin
writeln('shantay chest tpa count: ' + IntToStr(length(tpa)));
ATPA:= TPAtoATPAEx(tpa, 25, 25);
for a:=0 to high(atpa) do
begin
{$IFDEF SMART}
SMART_DrawDotsEx(false, ATPA[a], clYellow);
{$ENDIF}
MP:= MiddleTPA(atpa[a]);
Mouse(mp.x, mp.y, 4, 4, mouse_move);
if WaitUpTextMulti(['pen S', 'antay','tay c', 'hest'], 500) then
begin
ClickMouse2(mouse_left);
if WaitFunc(@DidRedClick, 50, 1000) then
begin
writeln('Clicked Bank chest');
if WaitFunc(@BankScreenEx, 100, 5000) then
begin
writeln('BankScreenEx found');
result:= true;
{$IFDEF SMART}
SMART_ClearCanvas;
{$ENDIF}
break;
end;
end;
end;
end;
end
else writeln('Shantay chest not found...');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
procedure AntiBan;
var r: Integer;
begin
if not LoggedIn then Exit;
r := (RandomRange(1, 14));
if (r = 4) then
begin
writeln('Doing antiban');
case Random(20) of
0, 3: PickUpMouse;
1: RandomRClick;
2:
begin
HoverSkill('firemaking', false);
GameTab(tab_Inv);
end;
4: MMouse(MIX1, MIY1, MIX2, MIY2);
5: MMouse(MMX1, MMY1, MMX2, MMY2);
end;
end;
end;
function AddingScreen :Boolean;
begin
Result := CountColorTolerance(4543066, 17, 355, 484, 456, 2) > 2000;
end;
function BonBon: boolean; //Modified by Er1k
begin
result:=false;
if not LoggedIn then Exit;
if not (getCurrentTab = tab_Inv) then
FTab(tab_Inv);
if WaitFunc(@FoundInvLogs, 200, 5000) then
begin
ClickMouse2(mouse_Left);
if WaitFunc(@AddingScreen, 200, 5000) then
begin
writeln('Found add to bonfire screen');
MouseBox(323, 411, 389, 448, mouse_Left);
writeln('BONBONBONBON-ing');
result:= true;
end;
end;
end;
procedure XPTotalFinding;
var
XPGained: Integer;
begin
XPGained := GetXPBar(1);
writeln('EXP Gained' + IntToStr(XPGained));
end;
Procedure DrawTheBox;
var
XPBOX: TBox;
begin
XPBOX := IntToBox(375, 7, 421, 21);
SMART_DrawBox(XPBOX);
end;
procedure PlayerStats;
var
Wet, Wst, Cst, Srt, Tih, Tim, Tis, Awt, Sec, sst, EndingXP, XPGained: Integer;
begin
Cst := GetSystemTime;
Srt := (cst - sst) / 1000;
Tih := srt / 3600;
tim := (srt / 60) - tih * 60;
Tis := srt - tim * 60 - tih * 3600;
Awt := wet - wst
Sec := GetTimeRunning div 1000 + 1;
EndingXP := GetXPBarTotal;
XPGained := EndingXP - StartingXP;
Writeln('######################################### ##############');
Writeln(' Shantay Bank Chest Bonfire ');
Writeln('######################################### ##############');
Writeln('Logs / Hour : ' + IntToStr(Round(3600 * Players[CurrentPlayer].Integers[3] / Sec)));
Writeln('Logs Done : ' + IntToStr(Players[CurrentPlayer].Integers[3]));
Writeln('Fire Spirit : ' + IntToStr(CollectedRewards));
writeln('EXP Gained : ' + IntToStr(XPGained));
writeln('EXP / Hour : ' + IntToStr(Round(3600 * XPGained / Sec)));
Writeln('Running for : ' + TimeRunning);
Writeln('-------------------------------------------------------');
//SRL stats
if (TimeFromMark(Stats) > 360000) then // 6 minutes.
begin
Stats_Commit;
MarkTime(Stats);
end;
end;
function LogsDecreased(start: integer): boolean; //New
begin
result:= CountItems('dtm', logs, []) < start;
end;
function InShantayPassTPA: boolean;
var tpa: TPointArray;
begin
result:= false;
SetColorToleranceSpeed(1);
if FindMMColorsSpiralTolerance(tpa, 2248829, 25) then //rock brown
begin
writeln('tpa count: '+ IntToStr(length(tpa)));
result:= length(tpa) >= 850;
end;
writeln('InShantayPassTPA: ' + booltostr(result));
end;
function AdjustPositionTPA: boolean;
var x, y: integer;
tpa: TPointArray;
begin
result:= false;
if not InShantayPassTPA then Exit; //
SetColorToleranceSpeed(1);
if FindMMColorsSpiralTolerance(tpa, 2413294, 25) then //bank symbol
begin
writeln('tpa count: '+ IntToStr(length(tpa)));
MiddleTPAEx(tpa, x, y);
Mouse(x, y, 3, 3, mouse_left);
wait(1000+random(250));
while IsMoving do
wait(100+random(50));
result:= true;
end;
writeln('AdjustPositionTPA: ' + booltostr(result));
end;
//odtm main point
//'84:84:3:9:7:49:39:9:7:31:56:9:7:36:80'
//odtm area
//'80:80:3:9:7:49:39:9:7:31:56:9:7:36:80:8:58:40:77: 40:92:53:92:83:76:96:61:96:51:81:51:46'
{$IFDEF USEODTM}
function InShantayPass: boolean; //New
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
result:= ObjDTM_InArea(ODTM_AREA, true);
end;
function AdjustPosition: boolean; //New
var odtm: string;
cx, cy: integer;
begin
result:=false;
if not LoggedIn then Exit;
FindNormalRandoms;
odtm:=ODTM_WALK;
if ObjDTM_Find(odtm, cx, cy, True) then
begin
result:= true;
Writeln('We found it, now lets walk it!');
ObjDTM_Walk(odtm, 2, 200, 10, True);
end else
Writeln('We could not walk here, what a shame');
if result then
FFlag(2);
end;
{$ENDIF}
{$IFDEF USESPS}
function InShantayPass: boolean;
var p: TPoint;
begin
result:= false;
FindNormalRandoms;
if not InShantayPassTPA then Exit;
p:= SPS_GetMyPos;
writeln('Acquiring position...');
writeln('SPS located: ' + format('%d %d', [p.x, p.y]));
if (p.x <= -1) and (p.y <= -1) then Exit; //lost
result:= (Distance(p.x, p.y, 5065, 4185) <= 75);
writeln('InShantayPass: ' + booltostr(result));
end;
function AdjustPosition: boolean; //New
var p: TPoint;
begin
result:= false;
FindNormalRandoms;
if not InShantayPass then
begin
writeln('Cannot adjust as we''re not in Shantay Pass');
writeln('AdjustPosition: ' + booltostr(result));
Exit;
end;
p:= SPS_GetMyPos();
writeln('Adjusting position...');
writeln('SPS located: ' + format('%d %d', [p.x, p.y]));
result:= SPS_WalkPath([Point(5060, 4185)]);
writeln('AdjustPosition: ' + booltostr(result));
end;
{$ENDIF}
function CheckWorld100: boolean;
var cw: integer;
begin
result:=false;
FindNormalRandoms;
cw:= CurrentWorld;
writeln('current world is: ' + IntToStr(cw));
if (cw<>100) then
begin
writeln('world switch required');
result:= ChangeWorld(100);
writeln('world switch success: ' + booltostr(result));
end
else result:= true;
end;
procedure MainLoop; //New
var action: string;
t, t2, t3, ts, start, fail, fail2, fail3: integer;
check, redo: boolean;
v: TVariantArray;
begin
action:= 'bank';
while LoggedIn do
begin
FindNormalRandoms;
writeln('Current action is: ' + action);
if fail > 0 then
writeln('fail: ' + IntToStr(fail));
if (fail >= 5) then
begin
writeln('banking failed consecutively...');
writeln('checking our position...');
FindNormalRandoms;
if InShantayPass then
action:='walk'
else
action:='lode';
end;
if (fail3 >= 3) then //verify if we''re in world 100
begin
writeln('failed to add to bonfires for quite a bit...');
writeln('verifying if we''re on world 100 at all...');
FindNormalRandoms;
if not CheckWorld100 then
begin
Logout; //finish the script and hope SMARTManager/CrashSMART restarts it
TerminateScript;
end
else fail3:= 0; //continue, we''re just having very bad luck
end;
case action of
'bank': begin
if FindShantayChest then
begin
if OpeningBank then
begin
WaitFunc(@FindInvLogs, 200, 2000);
action:= 'burn';
fail:= 0;
end;
end
else Inc(fail);
end;
'burn': begin
redo:= true;
check:=true;
if (CountItems('dtm', Logs, []) = 0) then
begin
action:='bank';
continue;
end;
if Bonbon then
begin
start:= CountItems('dtm', Logs, []);
writeln('starting logs: ' + IntToStr(start));
v:= [start];
//use first log adding as heuristic, does not work for low levels
//because low levels might have large delays in adding first log to bonfire
if not WaitFuncEx('LogsDecreased', v, 500, 5000) then
begin
writeln('Guessing no bonfires nearby, relocate!');
AdjustPosition;
Inc(fail2); //silent updated
//Maybe try to find fire here later??
//todo
//if you insist you want to make your own fires
//add code here, but i aint doing this for your safety
if (fail2 >= 2) then //force banking to relocate
begin
writeln('position adjusting doesnt seem to work...');
writeln('will try to find bank chest to relocate...');
action:='bank';
fail2:= 0;
Inc(fail3);
end;
continue;
end;
fail2:=0;
MarkTime(t);
MarkTime(t2);
MarkTIme(t3);
repeat
FindNormalRandoms;
// writeln('current logs: ' + IntToStr(CountItems('dtm', Logs, [])));
//find fire spirit, thanks Ashaman88 for the tips
if IsChatBoxTextAnyLine('emerges', 397249) and (InvCount<24) and check then
// if (FindChatBoxText('emerges',8,397249{clRed})) and (InvCount<24) then
begin
writeln('Spirit is around!');
if FindSpirit then
begin
check:= false; //dont scan after we have collected rewards
Inc(CollectedRewards);
break;
end;
end;
//update and continue
if LogsDecreased(start) then
begin
start:= CountItems('dtm', Logs, []);
MarkTime(t);
end;
//No update in FM_TIMEOUT ms, force redo
if (TimeFromMark(t) > FM_TIMEOUT) and not LogsDecreased(start) then
begin
writeln('Logs stopped burning - will reburn');
break;
end;
wait(250+random(250));
until (CountItems('dtm', Logs, []) = 0) or (TimeFromMark(t2) > 120000);
//Decide action
if (CountItems('dtm', Logs, []) = 0) then
begin
IncEx(Players[CurrentPlayer].Integers[3], 28);
redo:= false;
PlayerStats;
end;
if not redo then
action:= 'bank';
end;
end;
'walk': begin
if AdjustPosition then
begin
action:='bank';
fail:= 0;
end;
end;
'lode': begin
FindNormalRandoms;
writeln('If you get this chances are you''ve failed a random!');
writeln('Or you''ve got a random but SRL failed to detect it');
writeln('TODO - logout and terminate');
Logout;
TerminateScript;
end;
end;
wait(100+random(50));
end;
end;
procedure DebugLocations; //Acid test on location finders
begin
InShantayPass;
AdjustPosition;
end;
begin
SetupLogin;
{$IFDEF USEODTM}
ObjDTM_Setup; //req'd for ODTM usage
ObjDTM_Debug := True;
{$ENDIF}
{$IFDEF USESPS}
SPS_SETUP(RUNESCAPE_SURFACE,['12_10']);
{$ENDIF}
SMART_ClearCanvas;
AddOnTerminate('EndDTM');
StartDTM;
// UseFindMod := false; //uncomment if you don't want mods to mess up
// DebugLocations; //uncomment if you need debug
MainLoop;
end.
Works fine for me.
Mods, if posting this is against any sort of forum rules, I apologize. Or if that author wants me to take it down, please lemme know.
print
09-04-2012, 10:30 PM
do this on the lines that dont work or give you errors // mostly the misco lines and smart server things
I Found out what i wasn't doing :) Thanks Everyone :) Mod Close Topic Please :)
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.