Turok255
2013-06-13 15:19:36
I Get this error when trying to run this script…. sadly I know very little java, i took c++ in school :(
[Error] C:\Users\Casey\Documents\Simba\Includes\SRL\SRL\misc\SMART.simba(46:19): Invalid number of parameters at line 45
Compiling failed.
Here is the script
[Error] C:\Users\Casey\Documents\Simba\Includes\SRL\SRL\misc\SMART.simba(46:19): Invalid number of parameters at line 45
Compiling failed.
Here is the script
{$DEFINE SMART8}
{******************************************************************************}
{*Script: Teh Flax Spinner
{*Author: Emaziz
{*Info: Spins flax in lumbridge, yeeah!
{******************************************************************************}
{.include SRL\SRL\misc\SMART.simba}
{.include SRL\SRL.simba}
const
// Fill in these \\
doDebug = True;
SRLStats_Username = ''; // Plzplzplz fill in these! =D
SRLStats_Password = ''; // Register at stats.villavu.com ;)
cFlaxToSpin = 1000000; // Can be higher than what you have, it will then spin all
cVersion = 'v2.21';
cAntiBan = 2200; // Chance of performing antiban = 3300/cAntiBan.
// cAntiBan = 2200 means chance of performing antiban is 1.5%
// Procedure is called every 200-400ms while spinning.
var
vPreviousBreak, vNextBreak, vBreakTime, vBMP_String: longint;
vNumberofBreaks, vStartExperience, vFlaxSpinned: integer;
procedure declarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Pin := '';
Active := True;
Booleans[0] := True; // Want breaks?
Integers[0] := 60; // How many minutes between each break. +- 12%.
end;
end;
{*function Debug, debugs if doDebug is true.*}
procedure debug(s:string);
begin
if doDebug then
writeln('['+TheTime+'] ' + s);
end;
{*procedure Terminate, performs final actions and terminates script.*}
procedure terminate(reason:string);
begin
debug('*** ERROR *** ' + reason + '. Terminating!');
FreeBitmap(vBMP_String);
TerminateScript;
end;
{*function TimeToStr, turns a LongInt into a time string containing *}
{*hours, minutes and seconds. *}
function TimeToStr(ms: integer; short: boolean): string;
var
hours, mins, secs, h, m, s: string;
begin
if short then
begin
h := 'h, '; m := 'm, '; s := 's.';
end
else
begin
h := ' hours(s), '; m := ' minute(s), '; s := ' second(s).';
end;
if floor(ms/3600000) > 0 then
begin
hours := (inttostr(floor(ms/3600000)) + h);
end;
if floor(ms/60000) > 0 then
begin
mins := (inttostr(floor(ms/60000)-(60*floor(ms/3600000))) + m);
end;
if floor(ms/1000) > 0 then
begin
secs := (inttostr(floor(ms/1000)-(60*floor(ms/60000))) + s);
end;
Result := (hours + mins + secs);
end;
{*function round2, rounds an extended to a given amount of decimals*}
function round2(Number: extended;Places: longint): extended;
begin
result := round((Number*pow(10, places))/(pow(10, places)));
end;
{*function R_OpenBankNPC, opens bank using NPC*}
function R_OpenBankNPC: boolean;
var npc: TNPC; thetile: TTile; thepoint: TPoint; attempts: integer; time: longInt;
begin
if R_BankScreen then
begin
result := True;
exit;
end;
npc := GetNPC('Banker');
theTile := npc.Tile;
if not TileOnMS(thetile,0) then exit;
thepoint := TileToMS(thetile,0);
while attempts <= 3 do
begin
npc := GetNPC('Banker');
theTile := npc.Tile;
thepoint := TileToMS(thetile,0);
Mouse(thepoint.x-5,thepoint.y-20,5,20,false);
result := R_ChooseOption('Bank Banker');
if result then
begin
time := GetSystemTime;
result := false;
while ((GetSystemTime-time) < 2000) do
begin
wait(50+random(50));
if (R_BankScreen or R_PinScreen) then
result := True;
if result then exit;
end;
end
else
attempts := attempts + 1;
end;
end;
{*procedure doBank, banking procedure. *}
function doBank: boolean;
var i, trash: integer; t: TInvItem; p: Tpoint; timer: longInt; tt: TBankItem;
begin
result := False;
debug('Doing banking...');
if R_ItemExists(1779,t) then result := True;
if result = True then
begin
debug('Player has flax, no need to bank :)');
exit;
end;
// Enter PIN
if InPin(Players[CurrentPlayer].Pin) then
begin
debug('Successfully entered PIN');
end;
wait(200+random(200));
// Deposit stuff
if DepositAll then
debug('Deposit items')
else
debug('Failed to deposit items');
// Withdraw stuff
wait(200+random(100));
if (not R_ItemExistsInBank(1779,tt)) and R_BankScreen then
terminate('No more flax in bank');
if R_BankScreen and not InvFull then
if not R_WithdrawItemEx(1779,0,trash,false) then
debug('Failed to withdraw')
else
debug('Withdrew items');
// Close bank
wait(200+random(200));
if (random(100) > 90) then CloseBank;
end;
{*procedure AntiBan*}
procedure AntiBan;
begin
case random(cAntiBan) of
0..5: HoverSkill('crafting',false);
6..8: ExamineInv;
9..10: RandomRClick;
11..30: PickupMouse;
31..33: RandomMovement;
end;
end;
{*procedure PrintOnSmart, prints text on SMART client*}
{*Credits to HobboBobbo for this procedure, thanks! *}
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], UpChars, H);
for B := 0 to High(TTP) do
begin
try
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
except
end;
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
{*procedure setBreaks, sets break variables*}
procedure setBreaks;
begin
vPreviousBreak := GetSystemTime;
debug('Set vPreviousBreak to ' + TheTime);
vNextBreak := GetSystemTime + (Players[CurrentPlayer].Integers[0] * 60000) -
((12*Players[CurrentPlayer].Integers[0] * 60000)/100) +
((random(24)*Players[CurrentPlayer].Integers[0] * 60000)/100);
debug('Set vNextBreak to occur in ' + TimeToStr(vNextBreak-GetSystemTime,false));
end;
{*procedure doBreak, checks whether script should break. Breaks if needed. *}
procedure doBreak;
var lobby: boolean; vBreakStart: longint;
begin
if ((Players[CurrentPlayer].Booleans[0]) and
((vNextBreak - GetSystemTime) < 0)) then
begin
CloseBank;
vBreakTime := ((Players[CurrentPlayer].Integers[0]*60000*10)/100)+random((Players[CurrentPlayer].Integers[0]*60000*2)/100)
debug('vBreaktime set to ' + timetostr(vBreakTime,false));
debug('');
vBreakStart := GetSystemTime;
Lobby := True;
if random(100) > 60 then lobby := False;
If (Lobby) then ExitToLobby
else LogOut;
while (vBreakTime-(GetSystemTime - vBreakStart) > 0) do
begin
wait(5000);
writeln('Time remaining: ' + TimeToStr(vBreakTime-(GetSystemTime - vBreakStart),false));
end;
inc(vNumberofBreaks);
setBreaks;
LogInPlayer;
wait(3000+random(1000));
end;
end;
{*procedure paintReport, paints an on-screen progress report on SMART client*}
procedure paintReport;
var Exp: integer;
begin
Exp := R_GetSkillExperience('crafting') - vStartExperience;
PrintOnSmart([' Teh Flax Spinner ' + cVersion + ' ~ By Emaziz'],Point(20, 25), 16777215, 8388736);
PrintOnSmart(['Running for: ' + TimeRunning,
'Experience: ' + ToStr(Exp),
'Exp/hour: ' + ToStr(Round2((Exp * 3600) / (GetTimeRunning / 1000),2)),
'',
'Flax spun: ' + ToStr(vFlaxSpinned),
'Flax/hour: ' + ToStr(Round2((vFlaxSpinned * 3600) / (GetTimeRunning / 1000),2)),
'',
'Next break: ' + TimeToStr(vNextBreak-GetSystemTime,true),
'Breaks: ' + IntToStr(vNumberofBreaks)], Point(20,55), 16777215, 8388736);
//debug('Printed on-screen progress report');
end;
{*procedure printReport, outputs a progress report in debug box*}
procedure printReport;
var Exp: integer;
begin
Exp := R_GetSkillExperience('crafting') - vStartExperience;
writeln('*-*- Teh Flax Spinner ' + cVersion + ' ~ By Emaziz -*-*');
writeln('* Running for: ' + TimeRunning);
writeln('* Experience: ' + ToStr(Exp));
writeln('* Exp/hour: ' + ToStr(Round2((Exp * 3600) / (GetTimeRunning / 1000),2)));
writeln('* Flax spun: ' + ToStr(vFlaxSpinned));
writeln('*Flax spun/hour: ' + ToStr(Round2((vFlaxSpinned * 3600) / (GetTimeRunning / 1000),2)));
writeln('*-*- flaxflaxflaxflaxflaxflax -*-*');
end;
function isSpinning: boolean;
var timer: longInt; ani: integer;
begin
timer := GetSystemTime;
while (GetSystemTime-timer) < 1000 do
begin
ani := GetMe.Animation;
if (ani <> -1) then
begin
result := True;
exit;
end;
end;
result := False;
end;
function hasFlax: boolean;
var timer: longInt; trash: TInvItem;
begin
timer := getSystemTime;
while (GetSystemTime-timer) < 300 do
begin
if R_ItemExists(1779,trash) then
begin
result := True;
exit;
end;
end;
result := False;
end;
{*procedure SetupScript, *duh*}
procedure SetupScript;
begin
Smart_Server := 68;
Smart_Members := True;
Smart_Signed := True;
SetupSRL;
SetupSRLStats(73, SRLStats_Username, SRLStats_Password);
SetupReflectionEx(False);
LogInPlayer;
SetAngle(true);
setBreaks;
vStartExperience := R_GetSkillExperience('crafting');
vBMP_String := BitmapFromString(54, 12, 'meJzNVFsOwjAM60344A0Tbzbeuy' +
'a3hUgWkeVuXQc/VFblOIkTTdWKqi6qevB8hRCKiP+IhJWlMk2W5cN' +
'g9Q4LzZZ1cISNnEVuES5dmCItjXOhhM8RT1F4eedSj8O2PNRDGd02' +
'd3G8G1AmvI3YLS0OrMGh2OZPcTI/3AyNvI3wjRYGUgnbzClOZvurg' +
'd+hhaLHioiJFEIQrvcwJmxlynR3AQIdF12PFRETKQ87ddkHG06253' +
'+DLebkiw3Rzq+CPXstkK5BmW043pzyYV12+/fnH1QvK/ikAWcjo3W' +
'VD2zCRPS+PjkYrsp8wBkEEN1T3BJzru/EGzxUyAc=');
end;
{*procedure StartScript, the main loop}
procedure StartScript;
var me: TMe; stairs, wheel: TRSObject; tehPoint: Tpoint; tehTile: TTile;
timer, timer2: longInt; attempts, x, y, prevCount: integer; trash: TInvItem;
begin
while (vFlaxSpinned < cFlaxToSpin) do
begin
if not R_LoggedIn then
terminate('Not logged in');
R_FindRandoms;
wait(200+random(200));
// WALK TO FLOOR 1 \\
if ((hasFlax) and (GetPlaneIndex = 2)) then
begin
debug('Walking to floor 1');
WalkToTile(Tile(3205,3209),1,1);
attempts := 0;
while (attempts <= 5) do
begin
debug('Attempts: ' + ToStr(attempts));
stairs := GetObjectByID(36775,OBJECT_TYPE_INTERACTABLE,20);
tehTile := stairs.Tile;
tehPoint := TileToMS(tehTile,0);
timer := GetSystemTime;
while (GetSystemTime-timer < 2000) do
begin
MMouse(tehPoint.x-5,tehPoint.y-5,5,5);
if R_IsUpText('Climb-down') then
begin
ClickMouse2(true);
timer2 := GetSystemTime;
while (GetPlaneIndex = 2) do
begin
wait(20+random(10));
if ((GetSystemTime-timer2) > 1000) then
break;
end;
end;
if (GetPlaneIndex = 1) then
break;
end;
if (GetPlaneIndex <> 1) then
attempts := attempts + 1
else
break;
if (attempts = 6) then
Terminate('Failed to walk down stairs');
end;
debug('Walked down stairs');
end;
// SPIN FLAX \\
if ((hasFlax) and (GetPlaneIndex = 1)) then
begin
debug('Spinning flax');
wheel := GetObjectByID(36970,OBJECT_TYPE_INTERACTABLE,20);
tehTile := wheel.Tile;
if not TileOnMS(tehTile,0) then
WalkToTile(Tile(3209,3213),1,1);
attempts := 0;
while (attempts <= 3) do
begin
wheel := GetObjectByID(36970,OBJECT_TYPE_INTERACTABLE,20);
tehTile := wheel.Tile;
tehPoint := TileToMS(tehTile,0);
timer := GetSystemTime;
while (GetSystemTime-timer < 2000) do
begin
MMouse(tehPoint.x-5,tehPoint.y-5,5,5);
if R_IsUpText('Spin') then
begin
ClickMouse2(true);
timer2 := GetSystemTime;
while (not FindBitmapToleranceIn(vBMP_String,x,y,MCX1,MCY1,MCX2,MCY2,6)) do
begin
wait(20+random(10));
if ((GetSystemTime-timer2) > 3000) then
break;
end;
end;
if (FindBitmapToleranceIn(vBMP_String,x,y,MCX1,MCY1,MCX2,MCY2,6)) then
break;
end;
if (not FindBitmapToleranceIn(vBMP_String,x,y,MCX1,MCY1,MCX2,MCY2,6)) then
attempts := attempts + 1
else
break;
if (attempts = 4) then
Terminate('Failed to find string DTM');
end;
Mouse(x,y,3,3,true);
prevCount := R_CountItem(1777);
wait(500+random(500));
while ((isSpinning) and (hasFlax)) do
begin
if prevCount <> R_CountItem(1777) then
begin
vFlaxSpinned := vFlaxSpinned + R_CountItem(1777) - prevCount;
stats_IncVariable('Flax (Spun)', R_CountItem(1777) - prevCount);
end;
prevCount := R_countItem(1777);
AntiBan;
paintReport;
wait(500+random(100));
end;
end;
// WALK TO FLOOR 2 \\
if ((not hasFlax) and (GetPlaneIndex = 1)) then
begin
debug('Walking to floor 2');
WalkToTile(Tile(3205,3209),1,1);
attempts := 0;
while (attempts <= 3) do
begin
stairs := GetObjectByID(36774,OBJECT_TYPE_INTERACTABLE,20);
tehTile := stairs.Tile;
tehPoint := TileToMS(tehTile,0);
timer := GetSystemTime;
while (GetSystemTime-timer < 1000) do
begin
MMouse(tehPoint.x-5,tehPoint.y-5,5,5);
if R_IsUpText('Climb') then
begin
ClickMouse2(false);
R_WaitOption('Climb-up',500);
timer2 := GetSystemTime;
while (GetPlaneIndex = 1) do
begin
wait(20+random(10));
if ((GetSystemTime-timer2) > 1500) then
break;
end;
end;
if (GetPlaneIndex = 2) then
break;
end;
if (GetPlaneIndex <> 2) then
attempts := attempts + 1
else
break;
if (attempts = 4) then
Terminate('Failed to walk up stairs');
end;
debug('Walked up stairs');
end;
// WALK TO DA BANK \\
if ((not hasFlax) and (GetPlaneIndex = 2)) and not R_OpenBankNPC then
WalkToTile(Tile(3209,3220),1,1);
// DO BANK \\
if ((not hasFlax) and (GetPlaneIndex = 2)) and R_OpenBankNPC then
doBank;
// Do stuff
Stats_Commit;
DoBreak;
AntiBan;
PrintReport;
PaintReport;
end;
writeln('Script ran successfully! Hoorah!');
end;
procedure TestS;
begin
while(true) do
begin
writeln(GetPlaneIndex);
end;
end;
begin
DeclarePlayers;
SetupScript;
//TestS;
StartScript;
end.