Log in

View Full Version : Invalid number of Parameters at line(xx). Compiling Failed.



DetectiveDoctor
08-05-2012, 09:28 PM
[Error] Z:\home\thedoctor\Downloads\sps_soul_wars (1).simba(43:35): Unknown identifier 'MMCX' at line 42
Compiling failed.

I have also tried running sps soul wars from within runescape_other as directed. I get the same result.

Also, for AOI Powerchopper v0.9:

[Error] C:\Simba\Includes\SRL/SRL/misc/smart.simba(53:19): Invalid number of parameters at line 52
Compiling failed.


This seems to be a recurring issue, I have no idea what's wrong here. Was told I needed to update the script manually or wait for everyone else to do it. I'm not that patient, so any help would be greatly appreciated, thank you.

DetectiveDoctor
08-06-2012, 12:39 AM
Umm.. bump?

Element17
08-06-2012, 04:53 AM
Update simba and smart.

keapor
08-06-2012, 08:06 AM
Um i have the same error:
[Error] C:\Simba\Includes\SRL/SRL/misc/SMART.simba(53:19): Invalid number of parameters at line 52
Compiling failed.

I have simba, Smart and everything else updated. I have this error for multiple scripts.

Etrnl Fear
08-06-2012, 09:05 PM
Is {$i SRL\SRL.simba} the very fisrt line under program name? After {$DEFINE SMART} of course.

keapor
08-06-2012, 11:21 PM
Is {$i SRL\SRL.simba} the very fisrt line under program name? After {$DEFINE SMART} of course.

{$DEFINE SMART}
{$DEFINE SPS}
{$i SRL/SRL/misc/SMART.simba}
{$i SRL/SRL.simba}
{$i SPS/SPS.simba}

keapor
08-07-2012, 12:17 AM
{$DEFINE SMART}
{$DEFINE SPS}
{$i SRL/SRL/misc/SMART.simba}
{$i SRL/SRL.simba}
{$i SPS/SPS.simba}

This is the script that i first recieved the error from.


program RangedGuilder;

{$DEFINE SMART}
{$DEFINE SPS}
{$i SRL/SRL/misc/SMART.simba}
{$i SRL/SRL.simba}
{$i SPS/SPS.simba}

{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{User Config}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

const
World = 65; // World The Player Logs into.
RightClickMethod = False; // Use Right Click To Schoot The Target.
// (For Low End Computers.)
LaggyComputer = 0; // Choose 0 (Fast), 1 (Normal) or 2 (Slow)
// Depending On Your Computer Speed.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Player Username.
Pass := ''; // Player Password.
Nick := ''; //Player nickname, 3-4 letters of Player username.
Pin := ''; // Bank PIN
Active := True;
end;
end;

{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{End of User Config}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

const
Version = '1.23';

var
x, y, Laggy, StartXP{, CoursesDone}, ClientTokenLogout, CTLRandom,
ArrowDTM, TicketDTM, StartTickets, CurrentTickets : Integer;

{************************************************* ******************************
function InCords(x1, y1, x2, y2 : Integer) : Boolean;
by; putonajonny
Description: Checks if player is in certain SPS area, returns true if in area.
************************************************** *****************************}
function InCords(x1, y1, x2, y2 : Integer) : Boolean;
var
Location : TPoint; xL, yL : Integer;
begin
Location := SPS_GetMyPos;
xL := Location.x;
yL := Location.y;
if(xL < x1) then
exit;
if(xL > x2) then
exit;
if(yL < y1) then
exit;
if(yL > y2) then
exit;
Result := True;
end;

procedure LaggyComp;
begin
if LaggyComputer = 0 then
Laggy := 0;
if LaggyComputer = 1 then
Laggy := 500;
if LaggyComputer = 2 then
Laggy := 1000;
end;

procedure StatsGuise(wat:string);
begin
Status(wat);
Disguise(wat);
end;

procedure Antiban;
begin
case Random(225) of
0..15: begin StatsGuise('Antiban...') GameTab(Tab_Stats) HoverSkill('Ranged', False); Wait(500 + Random(300)); GameTab(Tab_Inv); end;
25..30: begin StatsGuise('Antiban...') SleepAndMoveMouse(3000 + Random(500)); end;
50..55: begin StatsGuise('Antiban...') GameTab(Tab_Inv) ExamineInv; GameTab(Tab_Inv); end;
70..75: begin StatsGuise('Antiban...') GameTab(Tab_Stats); Wait(2000 + Random(500)); GameTab(Tab_Inv); end;
90..95: begin StatsGuise('Antiban...') GameTab(Tab_Stats) HoverSkill('random', False); GameTab(Tab_Inv); end;
end;
end;

procedure GetIntoPos; // (2515, 2970) // (2530, 2985) // (2520, 2980)
var
myPath: TPointArray;
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2520, 2980)];
SPS_WalkPath(myPath);
end;

procedure MainLoop;
var
i, Timer : Integer;
Judge, Judge2, RoundFin : Boolean;
myPath: TPointArray;
begin
StatsGuise('MainLoop');

if FindNormalRandoms then
if not LoggedIn then
Exit;

StatsGuise('Finding Judge');
repeat
MarkTime(Timer);
repeat
if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
begin
Mouse(x, y, 5, 5, False);
Wait(200 + Random(150) + Laggy);

if OptionsExist(['mpete'], Nothing) then
begin
Judge := True;
ChooseOption('mpete');
end else
Judge2 := True;
end else
begin
Mouse(266, 136, 10, 30, False);
if WaitOption('mpete', 500) then
Judge := True;
end;
until((TimeFromMark(Timer) > 20000) or Judge or Judge2);

if TimeFromMark(Timer) > 20000 then
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2554, 2927), Point(2542, 2935), Point(2534, 2947), Point(2524, 2955), Point(2515, 2963), Point(2515, 2982)];
SPS_WalkPath(myPath);
ClickNorth(1);
MakeCompass(35 + Random(5));

if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
Mouse(x, y, 5, 5, False);
Wait(200 + Random(150) + Laggy);
if WaitOption('to C', 500) then
Judge2 := True;
end;
until (Judge or Judge2)

StatsGuise('MainLoop');
Wait(800 + Random(150));

if Judge then
begin
KeyDown(49);
Wait(20+random(20));
KeyUp(49);
Wait(1500);
KeyDown(49);
Wait(20+random(20));
KeyUp(49);

Wait(800 + Random(150) + (Laggy * 2));
If PinScreen Then
begin
StatsGuise('Enter pin...');
InPin(Players[CurrentPlayer].Pin);
end;

ArrowDTM := DTMFromString('mggAAAHicY2NgYOACYhEgFgBiXiDmYIAAZi gN4vMDsTCUdtEA6WDCwCIM2AEjDgwBAGIcASA=');
If FindDTM(ArrowDTM, x, y, MIX1, MIY1, MIX2, MIY2) Then
begin
Mouse(x, y, 5, 5, True);
end;
FreeDTM(ArrowDTM)
end;

if not RightClickMethod then
begin
StatsGuise('Spamming Targets');
MarkTime(Timer);
repeat
if FindColorTolerance(x, y, 4310482, 230, 162, 296, 219, 11) then
MMouse(487, 42, 5, 5);
Wait(600);
if IsUpText('lose') then
ClickMouse2(True);

if FindObjEx(x, y, ['arget'], [5041405, 5238269], 7, 31, MSX1, MSY1, 375, 65) then
repeat
ClickMouse2(True);
Wait(RandomRange(15, 40));
if FindNPCChatText('orry', Nothing) then
RoundFin := True;
until(not IsUpText('-at') or RoundFin);
until(RoundFin or (TimeFromMark(Timer) > 40000));

if TimeFromMark(Timer) > 40000 then
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2554, 2927), Point(2542, 2935), Point(2534, 2947), Point(2524, 2955), Point(2515, 2963), Point(2515, 2982)];
SPS_WalkPath(myPath);
ClickNorth(1);
MakeCompass(35 + Random(5));
end;
end;

if RightClickMethod then
begin
StatsGuise('Shooting Targets');
for i := 1 to 10 do
begin
if FindObjEx(x, y, ['arget'], [5041405, 5238269], 7, 31, MSX1, MSY1, 375, 65) then
ClickMouse2(False);
Wait(200 + Random(150));
ChooseOptionEx('arget', 'object');
Wait(2400 + Random(150) + Laggy);
MMouse(487, 42, 3, 3);
Wait(550 + Random(150) + Laggy);
if IsUpText('lose') then
ClickMouse2(True);
end;
if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
Mouse(x, y, 5, 5, False);
WaitOption('to C', 500);
end;

CoursesDone := (CoursesDone + 1);
end;

procedure Proggy;
var
XPGained : Integer;
begin
ClearDebug;
TicketDTM := DTMFromString('mggAAAHicY2NgYFjBxMCwhAlCbwDi9UC8Fo hDgTgRiJOAOBKIY4A4HoiLu+OAupgwsAgDdsCIA0MAABRsB8s= ');
CurrentTickets := (ItemAmount('inv', 'dtm', TicketDTM, []));
FreeDTM(TicketDTM);

XPGained := GetXPBarTotal - StartXP;
WriteLn('[~~~~~~RangeGuilder by Riyyi - Version ' + Version + '~~~~~]')
WriteLn(' Time Running : ' + TimeRunning)
WriteLn(' XP Gained : ' + ToStr(XPGained))
WriteLn(' XP Per Hour : ' + FloatToStr((3600000 / GetTimeRunning) * XPGained))
WriteLn(' Courses Done : ' + ToStr(CoursesDone))
WriteLn(' Tickets Gained : ' + ToStr(CurrentTickets - StartTickets))
WriteLn(' Time Until Logout : ' + ToStr(MsToTime((CTLRandom - TimeFromMark(ClientTokenLogout)), Time_Formal)))
WriteLn('[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
end;

procedure GeneralCheck;
begin
if (not LoggedIn()) then
begin
LoginPlayer();
end;
Antiban;
end;

procedure SetupScript;
begin
Smart_Server := World;
Smart_Members:= True;
Smart_Signed := True;
Smart_SuperDetail := False;

SetupSRL;
DeclarePlayers;
GeneralCheck;

SPS_Areas := ['6_7'];
SPS_Setup(RUNESCAPE_SURFACE, ['6_7']);

ToggleXPPopUp(True);
ToggleXPBar(True);
StartXP := GetXPBarTotal;
MarkTime(ClientTokenLogout);
CTLRandom := (RandomRange(20400000, 21060000));
GameTab(Tab_Inv);
if not (StartTickets > 0) then
begin
TicketDTM := DTMFromString('mggAAAHicY2NgYFjBxMCwhAlCbwDi9UC8Fo hDgTgRiJOAOBKIY4A4HoiLu+OAupgwsAgDdsCIA0MAABRsB8s= ');
StartTickets := (ItemAmount('inv', 'dtm', TicketDTM, []));
FreeDTM(TicketDTM);
end;
ClearDebug();

end;

begin
repeat
SetupScript;
GetIntoPos;
ClickNorth(1);
MakeCompass(35 + Random(5));

repeat
GeneralCheck;
MainLoop;
Proggy;
until(TimeFromMark(ClientTokenLogout) < CTLRandom)

Logout;
Wait(RandomRange(600000,650000))
until(true)
end;

Etrnl Fear
08-07-2012, 12:30 AM
For starters, try to comment out {$i SRL/SRL/misc/SMART.simba}. After that, try to search around a little to debug the rest. It's actually pretty straight forward. :)

Benge
08-07-2012, 01:04 AM
program RangedGuilder;

{$DEFINE SMART}
{$DEFINE SPS}
//{$i SRL/SRL/misc/SMART.simba}
{$i SRL/SRL.simba}
{$i SPS/SPS.simba}

{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{User Config}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

const
World = 65; // World The Player Logs into.
RightClickMethod = False; // Use Right Click To Schoot The Target.
// (For Low End Computers.)
LaggyComputer = 0; // Choose 0 (Fast), 1 (Normal) or 2 (Slow)
// Depending On Your Computer Speed.

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Player Username.
Pass := ''; // Player Password.
Nick := ''; //Player nickname, 3-4 letters of Player username.
Pin := ''; // Bank PIN
Active := True;
end;
end;

{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{End of User Config}
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

const
Version = '1.23';

var
x, y, Laggy, StartXP, CoursesDone, ClientTokenLogout, CTLRandom,
ArrowDTM, TicketDTM, StartTickets, CurrentTickets : Integer;

{************************************************* ******************************
function InCords(x1, y1, x2, y2 : Integer) : Boolean;
by; putonajonny
Description: Checks if player is in certain SPS area, returns true if in area.
************************************************** *****************************}
function InCords(x1, y1, x2, y2 : Integer) : Boolean;
var
Location : TPoint; xL, yL : Integer;
begin
Location := SPS_GetMyPos;
xL := Location.x;
yL := Location.y;
if(xL < x1) then
exit;
if(xL > x2) then
exit;
if(yL < y1) then
exit;
if(yL > y2) then
exit;
Result := True;
end;

procedure LaggyComp;
begin
if LaggyComputer = 0 then
Laggy := 0;
if LaggyComputer = 1 then
Laggy := 500;
if LaggyComputer = 2 then
Laggy := 1000;
end;

procedure StatsGuise(wat:string);
begin
Status(wat);
Disguise(wat);
end;

procedure Antiban;
begin
case Random(225) of
0..15: begin StatsGuise('Antiban...') GameTab(Tab_Stats) HoverSkill('Ranged', False); Wait(500 + Random(300)); GameTab(Tab_Inv); end;
25..30: begin StatsGuise('Antiban...') SleepAndMoveMouse(3000 + Random(500)); end;
50..55: begin StatsGuise('Antiban...') GameTab(Tab_Inv) ExamineInv; GameTab(Tab_Inv); end;
70..75: begin StatsGuise('Antiban...') GameTab(Tab_Stats); Wait(2000 + Random(500)); GameTab(Tab_Inv); end;
90..95: begin StatsGuise('Antiban...') GameTab(Tab_Stats) HoverSkill('random', False); GameTab(Tab_Inv); end;
end;
end;

procedure GetIntoPos; // (2515, 2970) // (2530, 2985) // (2520, 2980)
var
myPath: TPointArray;
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2520, 2980)];
SPS_WalkPath(myPath);
end;

procedure MainLoop;
var
i, Timer : Integer;
Judge, Judge2, RoundFin : Boolean;
myPath: TPointArray;
begin
StatsGuise('MainLoop');

if FindNormalRandoms then
if not LoggedIn then
Exit;

StatsGuise('Finding Judge');
repeat
MarkTime(Timer);
repeat
if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
begin
Mouse(x, y, 5, 5, False);
Wait(200 + Random(150) + Laggy);

if OptionsExist(['mpete'], Nothing) then
begin
Judge := True;
ChooseOption('mpete');
end else
Judge2 := True;
end else
begin
Mouse(266, 136, 10, 30, False);
if WaitOption('mpete', 500) then
Judge := True;
end;
until((TimeFromMark(Timer) > 20000) or Judge or Judge2);

if TimeFromMark(Timer) > 20000 then
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2554, 2927), Point(2542, 2935), Point(2534, 2947), Point(2524, 2955), Point(2515, 2963), Point(2515, 2982)];
SPS_WalkPath(myPath);
ClickNorth(1);
MakeCompass(35 + Random(5));

if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
Mouse(x, y, 5, 5, False);
Wait(200 + Random(150) + Laggy);
if WaitOption('to C', 500) then
Judge2 := True;
end;
until (Judge or Judge2)

StatsGuise('MainLoop');
Wait(800 + Random(150));

if Judge then
begin
KeyDown(49);
Wait(20+random(20));
KeyUp(49);
Wait(1500);
KeyDown(49);
Wait(20+random(20));
KeyUp(49);

Wait(800 + Random(150) + (Laggy * 2));
If PinScreen Then
begin
StatsGuise('Enter pin...');
InPin(Players[CurrentPlayer].Pin);
end;

ArrowDTM := DTMFromString('mggAAAHicY2NgYOACYhEgFgBiXiDmYIAAZi gN4vMDsTCUdtEA6WDCwCIM2AEjDgwBAGIcASA=');
If FindDTM(ArrowDTM, x, y, MIX1, MIY1, MIX2, MIY2) Then
begin
Mouse(x, y, 5, 5, True);
end;
FreeDTM(ArrowDTM)
end;

if not RightClickMethod then
begin
StatsGuise('Spamming Targets');
MarkTime(Timer);
repeat
if FindColorTolerance(x, y, 4310482, 230, 162, 296, 219, 11) then
MMouse(487, 42, 5, 5);
Wait(600);
if IsUpText('lose') then
ClickMouse2(True);

if FindObjEx(x, y, ['arget'], [5041405, 5238269], 7, 31, MSX1, MSY1, 375, 65) then
repeat
ClickMouse2(True);
Wait(RandomRange(15, 40));
if FindNPCChatText('orry', Nothing) then
RoundFin := True;
until(not IsUpText('-at') or RoundFin);
until(RoundFin or (TimeFromMark(Timer) > 40000));

if TimeFromMark(Timer) > 40000 then
begin
if not InCords(2510, 2965, 2545, 2990) then
myPath := [Point(2554, 2927), Point(2542, 2935), Point(2534, 2947), Point(2524, 2955), Point(2515, 2963), Point(2515, 2982)];
SPS_WalkPath(myPath);
ClickNorth(1);
MakeCompass(35 + Random(5));
end;
end;

if RightClickMethod then
begin
StatsGuise('Shooting Targets');
for i := 1 to 10 do
begin
if FindObjEx(x, y, ['arget'], [5041405, 5238269], 7, 31, MSX1, MSY1, 375, 65) then
ClickMouse2(False);
Wait(200 + Random(150));
ChooseOptionEx('arget', 'object');
Wait(2400 + Random(150) + Laggy);
MMouse(487, 42, 3, 3);
Wait(550 + Random(150) + Laggy);
if IsUpText('lose') then
ClickMouse2(True);
end;
if FindObjTPA(x, y, 1845548, 11, 2, 15, 15, 50, ['ition']) or
FindObjTPA(x, y, 2702911, 13, 2, 15, 15, 50, ['ition']) then
Mouse(x, y, 5, 5, False);
WaitOption('to C', 500);
end;

CoursesDone := (CoursesDone) + 1;
end;

procedure Proggy;
var
XPGained : Integer;
begin
ClearDebug;
TicketDTM := DTMFromString('mggAAAHicY2NgYFjBxMCwhAlCbwDi9UC8Fo hDgTgRiJOAOBKIY4A4HoiLu+OAupgwsAgDdsCIA0MAABRsB8s= ');
CurrentTickets := (ItemAmount('inv', 'dtm', TicketDTM, []));
FreeDTM(TicketDTM);

XPGained := GetXPBarTotal - StartXP;
WriteLn('[~~~~~~RangeGuilder by Riyyi - Version ' + Version + '~~~~~]')
WriteLn(' Time Running : ' + TimeRunning)
WriteLn(' XP Gained : ' + ToStr(XPGained))
WriteLn(' XP Per Hour : ' + FloatToStr((3600000 / GetTimeRunning) * XPGained))
WriteLn(' Courses Done : ' + ToStr(CoursesDone))
WriteLn(' Tickets Gained : ' + ToStr(CurrentTickets - StartTickets))
WriteLn(' Time Until Logout : ' + ToStr(MsToTime((CTLRandom - TimeFromMark(ClientTokenLogout)), Time_Formal)))
WriteLn('[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]')
end;

procedure GeneralCheck;
begin
if (not LoggedIn()) then
begin
LoginPlayer();
end;
Antiban;
end;

procedure SetupScript;
begin
SetupSRL;
DeclarePlayers;
GeneralCheck;

SPS_Areas := ['6_7'];
SPS_Setup(RUNESCAPE_SURFACE, ['6_7']);

ToggleXPPopUp(True);
ToggleXPBar(True);
StartXP := GetXPBarTotal;
MarkTime(ClientTokenLogout);
CTLRandom := (RandomRange(20400000, 21060000));
GameTab(Tab_Inv);
if not (StartTickets > 0) then
begin
TicketDTM := DTMFromString('mggAAAHicY2NgYFjBxMCwhAlCbwDi9UC8Fo hDgTgRiJOAOBKIY4A4HoiLu+OAupgwsAgDdsCIA0MAABRsB8s= ');
StartTickets := (ItemAmount('inv', 'dtm', TicketDTM, []));
FreeDTM(TicketDTM);
end;
ClearDebug();

end;

begin
repeat
SetupScript;
GetIntoPos;
ClickNorth(1);
MakeCompass(35 + Random(5));

repeat
GeneralCheck;
MainLoop;
Proggy;
until(TimeFromMark(ClientTokenLogout) < CTLRandom)

Logout;
Wait(RandomRange(600000,650000))
until(true)
end.

keapor
08-07-2012, 01:16 AM
Thank you guys so much. I'm interested in learning so if anyone is willing to feel free to pm me.

Etrnl Fear
08-07-2012, 07:41 PM
Thank you guys so much. I'm interested in learning so if anyone is willing to feel free to pm me.

So did everything work out for you then?

furion_pwnage
08-08-2012, 02:49 AM
Etrnl Fear, you're awesome for helping, however this script was meant to be a script with anti-leech, created by Riyyi.
The thread is here: http://villavu.com/forum/showthread.php?t=76566
I'm not saying remove everything, but if a leecher like me can find this, after another leecher has questioned about it and received an answer, then more leeches will find it. Basically that defeats the purpose of anti leech. But thanks for the help!

Etrnl Fear
08-08-2012, 03:10 AM
Ahh. I see you're point.

I kind of saw it as my way of 'beginning' to teach them how to fix something on their own. :P

But, I'll definitely consider this next time I see low posters asking!

boonjian
10-18-2012, 01:03 AM
Guys can help me ? i having problem too.
(*
SPS ~ SRL Positioning System
============================

Concept and original work done by marpis @ SRL-Forums.

*)

{$loadlib sps}

const
// Path where all the SPS files are
SPS_IMG_PATH = IncludePath + 'SPS\img\';
SPS_IMG_FMT = '.png';

// Surfaces
RUNESCAPE_SURFACE = 0;
RUNESCAPE_SURFACE_FOLDER = 'runescape_surface\';

RUNESCAPE_OTHER = 1;
RUNESCAPE_OTHER_FOLDER = 'runescape_other\';

// SPS Global variables
var
SPS_Debug, SPS_MultiMouse: boolean;
SPS_Areas: TStringArray;
SPS_AreaMaps: T3DIntegerArray; // Grids of the combined SPS_Areas
SPS_Tolerance, SPS_MatchesPercent: extended;
SPS_Accuracy: integer; // Splits minimap/areas into squares of this side length; used for area recognition

// Returns an image of the minimap in a TMufasaBitmap
function SPS_GatherMinimap: TMufasaBitmap;
var
c: TClient;
begin
try
Result := TMufasaBitmap.Create;
Result.SetSize(150, 150);

c := getTClient;
Result.CopyClientToBitmap(
c.IOManager, false, 0, 0, MMCX-75, MMCY-75, MMCX+75, MMCY+75
);

except
Writeln('SPS_GatherMinimap ERROR: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
end;

// Gets the starting area coordinates depending on the area image
procedure SPS_GetAreaCoords(Area: string; var x, y: integer);
var
p: integer;
begin
// if it's a specific dungeon map (i.e. name isn't 0_0, 10_2, etc.)
if (length(getNumbers(Area)) < 2) then
begin
x := 0;
y := 0;
Exit;
end;

p := pos('_', Area);

x := StrToIntDef(copy(Area, 1, p - 1), -1);
y := StrToIntDef(copy(Area, p + 1, Length(Area) - p), -1);

//writeln('SPS_GetAreaCoords: '+toStr(point(x, y)));
end;

// Converts a point from a map piece to a point on the entire map
function SPS_LocalToGlobal(Area: string; x, y: integer): TPoint;
var
cx, cy: integer;
begin
SPS_GetAreaCoords(Area, cx, cy);
Result.x := (cx * 400) + x;
Result.y := (cy * 400) + y;
end;

// Converts a point from the entire map to a point on the main screen
function SPS_GlobalToLocal(x, y: integer): TPoint;
var
cx, cy: integer;
begin
cx := Floor(x / 400);
cy := Floor(y / 400);

Result.x := x - (cx * 400);
Result.y := y - (cy * 400);
end;

// Returns the coordinates (x, y) in the form of a string
function SPS_AreaCoordsToString(x, y: integer): string;
begin
Result := IntToStr(x)+'_'+IntToStr(y);
end;

// Author: Coh3n
// Returns a TPA of the areas' values
function SPS_TPAFromAreas(areas: TStringArray): TPointArray;
var
i: integer;
begin
setLength(result, length(areas));

for i := 0 to high(areas) do
SPS_GetAreaCoords(areas[i], result[i].x, result[i].y);
end;

// Author: Coh3n
// Sorts the areas by columns, and sorts each column by rows
// Example: ['1_5', '1_3', '0_5'] results ['0_5', '1_3', '1_5']
function SPS_SortAreas(areas: TStringArray): TStringArray;
var
i, j: integer;
tpa: TPointArray;
begin
setLength(tpa, length(areas));

tpa := SPS_TPAFromAreas(areas);
clearDoubleTPA(tpa);

sortTPAByX(tpa, true); // first sort by column number

// then sort the Y values for each column number
for i := 0 to high(tpa) do
for j := i to high(tpa) do
if (tpa[i].x = tpa[j].x) then
if (tpa[i].y > tpa[j].y) then
tSwap(tpa[i], tpa[j]);

setLength(result, length(tpa));

for i := 0 to high(tpa) do
result[i] := SPS_AreaCoordsToString(tpa[i].x, tpa[i].y);

//writeln('SPS_SortAreas: '+toStr(result));
end;

// Loads the "Area" image
function SPS_GetArea(Area: string; surface: integer): TMufasaBitmap;
var
x, y: integer;
S: string;
begin
SPS_GetAreaCoords(Area, x, y);

case surface of
RUNESCAPE_SURFACE: s := RUNESCAPE_SURFACE_FOLDER;
RUNESCAPE_OTHER: s := RUNESCAPE_OTHER_FOLDER;
end;

try
Result := TMufasaBitmap.Create;
Result.LoadFromFile(SPS_IMG_PATH + s + Area + SPS_IMG_FMT);
except
Writeln('SPS_GetArea ERROR: '+ExceptionToString(ExceptionType, ExceptionParam));
end;
end;

// Author: Coh3n
// Merges the SPS 'areas' into one bitmap (makes more more accurate GetMyPos)
function SPS_MergeAreas(areas: TStringArray): TMufasaBitmap;
var
t, i, l, x, y, diffX, diffY, newWidth, newHeight: integer;
startPoint: TPoint;
newAreas: TStringArray;
xVals, yVals: TIntegerArray;
bmpTemp: TMufasaBitmap;
tmpTPA: TPointArray;
begin
if (length(areas) <= 0) then
exit;

t := getSystemTime();

// sort the areas from by columns/rows; remove duplicates
newAreas := SPS_SortAreas(areas);
l := length(newAreas);

// if there's only one area in the array
if (l = 1) then
begin
result := SPS_GetArea(areas[0], RUNESCAPE_SURFACE);
exit;
end;

// get the x and y values for each area
setLength(xVals, l);
setLength(yVals, l);

for i := 0 to high(newAreas) do
SPS_GetAreaCoords(newAreas[i], xVals[i], yVals[i]);

// get the lowest Y value so we can calculate the starting point to draw the first image
tmpTPA := SPS_TPAFromAreas(newAreas);
sortTPAByY(tmpTPA, true);

try
result := TMufasaBitmap.create();

// calculate the starting point
// x is always 0 because of how the areas are sorted
// y is relative to the lowest y value in the areas
SPS_GetAreaCoords(newAreas[0], x, y);
startPoint.x := 0;
startPoint.y := ((y - tmpTPA[0].y) * 400);

// draw the first area to the starting point on the bitmap
bmpTemp := SPS_GetArea(newAreas[0], RUNESCAPE_SURFACE);
result.SetSize(bmpTemp.width, bmpTemp.height + startPoint.y);
bmpTemp.fastDrawTransparent(startPoint.x, startPoint.y, result);
bmpTemp.free();

// loop through each area, drawing them to the result bitmap
// coordinates are calculated relative to the first area drawn (areas[0])
for i := 0 to (l - 2) do
begin
diffX := (xVals[i + 1] - xVals[0]);
diffY := (yVals[i + 1] - yVals[0]);

newWidth := 500 + (round(abs(diffX)) * 400);
newHeight := 500 + (round(abs(diffY)) * 400);

// only set the size if the width or height is increasing
if (newWidth > result.width) then
result.setSize(newWidth, result.height);

if (newHeight > result.height) then
result.setSize(result.width, newHeight);

// copy the area image to the resulting bitmap
bmpTemp := SPS_GetArea(newAreas[i + 1], RUNESCAPE_SURFACE);
bmpTemp.fastDrawTransparent(startPoint.x + (diffX * 400 + 1),
startPoint.y + (diffY * 400 + 1), result);
bmpTemp.free();
end;

//result.saveToFile('C:/Simba/test.bmp');
except
Writeln('SPS_MergeAreas ERROR: '+ExceptionToString(ExceptionType, ExceptionParam));
end;

if (SPS_Debug) then
writeln('SPS_MergeAreas: Merged areas in '+toStr(getSystemTime - t)+' ms.');
end;

// Author: Coh3n
// Returns an SPS area of lowest x and y value. Used for calculating the
// player's correct position
function SPS_GetTopLeftCoords(areas: TStringArray): string;
var
tpa: TPointArray;
begin
tpa := SPS_TPAFromAreas(areas);

if (length(tpa) <= 0) then
begin
result := '0_0';
exit;
end;

sortTPAByX(tpa, true);
result := toStr(tpa[0].x);

sortTPAByY(tpa, true);
result := result + '_'+toStr(tpa[0].y);

//writeln('SPS_GetTopLeftCoords: '+result);
end;

// SPS2
function SPS_GetMyPos(): TPoint;
var
Minimap: TMufasaBitmap;
SmallMap: T3DIntegerArray;
t, FoundMatches: integer;
P: TPoint;
Searches: extended;
begin
Result := Point(-1, -1);

if (not LoggedIn) then
Exit;

if (SPS_Tolerance < 1.0) then
SPS_Tolerance := 600.0;

if (SPS_MatchesPercent = 0.0) then
SPS_MatchesPercent := 0.35;

if (inRange(round(rs_GetCompassAngleDegrees), 10, 350)) then
MakeCompass('N');

t := getSystemTime();

Minimap := SPS_GatherMinimap;
SPS_FilterMinimap(Minimap);
//DrawBitmapDebugImg(Minimap.Index);
//DisplayDebugImgWindow(150, 150);
SmallMap := [];
SmallMap := SPS_BitmapToMap(Minimap, SPS_Accuracy);

FoundMatches := SPS_FindMapInMap(P.x, P.y, SPS_AreaMaps, SmallMap, SPS_Tolerance);
Searches := ((Minimap.Width / SPS_Accuracy) * (Minimap.Height / SPS_Accuracy));
{
writeln('fx: '+toStr(p.x)+' ~ on area: '+toStr(P.X * SPS_Accuracy + (Minimap.Width / 2)));
writeln('fy: '+toStr(p.y)+' ~ on area: '+toStr(P.Y * SPS_Accuracy + (Minimap.Width / 2)));
writeln('matches: '+toStr(foundMatches));
writeln('searches: '+toStr(searches));
writeln('percent: '+toStr(FoundMatches / Searches));
}
if ((FoundMatches / Searches) > SPS_MatchesPercent) then
Result := SPS_LocalToGlobal(SPS_GetTopLeftCoords(SPS_Areas), // the top left of the total area
P.x * SPS_Accuracy + (Minimap.Width / 2),
P.y * SPS_Accuracy + (Minimap.Width / 2));

Minimap.Free;

t := (GetSystemTime - t);
if (SPS_Debug) then
Writeln('SPS_GetMyPos: Finished in '+ToStr(t)+' ms. Result = '+ToStr(Result));
end;

// Finds position P in minimap by checking your own location
function SPS_PosToMM(P: TPoint): TPoint;
var
MyPos: TPoint;
begin
if not LoggedIn then
Exit;

Result := Point(-1, -1);
MyPos := SPS_GetMyPos;

if (Distance(MyPos.X, MyPos.Y, P.X, P.Y) < 75) then
Result := Point(MMCX + P.X - MyPos.X, MMCY + P.Y - MyPos.Y);
end;

// Walks to position, P.
function SPS_WalkToPos(P: TPoint): boolean;
var
MM: TPoint;
begin
if not LoggedIn then
Exit;

MM := SPS_PosToMM(P);

if (MM.X > 0) then
begin
if (SPS_MultiMouse) then
MultiMouse(MM.X, MM.Y, 25, 3, false)
else
Mouse(MM.X, MM.Y, 0, 0, mouse_Left);

if WaitFunc(@IsMoving, 1, 3000 + random(500)) then
while IsMoving do
Flag;

Result := True;
end;
end;

// Returns true if the point "Pt" is on the minimap
function SPS_PosOnMM(Pt: TPoint): Boolean;
var
p: TPoint;
begin
p := SPS_PosToMM(Pt);
Result := rs_OnMinimap(p.x, p.y);
end;

// Walks the path "Path"; always walks to the furthest point possible
function SPS_WalkPath(Path: TPointArray): boolean;
var
I, H, T, D: integer;
P, MM: TPoint;
begin
H := High(Path);
T := GetSystemTime + 20000 + Random(5000);

while (not Result) and (GetSystemTime < T) do
begin
RunEnergy(20);

P := SPS_GetMyPos;
for I := H downto 0 do
begin
MM.X := MMCX + Path[I].X - P.X;
MM.Y := MMCY + Path[I].Y - P.Y;

D := Distance(MM.X, MM.Y, MMCX, MMCY);

if (D < 10) then
break
else
if (D < 70) then
begin
if (SPS_MultiMouse) then
MultiMouse(MM.X, MM.Y, 25, 3, false)
else
Mouse(MM.X, MM.Y, 5, 5, mouse_Left);

FFlag(Integer(I <> H) * 15);

T := getSystemTime + 20000 + Random(1000);
Break;
end;
end;

Result := (I = H);
end;
end;

// Walks blindly from the player's current position to the point T
function SPS_BlindWalk(P: TPoint): Boolean;
var
Tries: Integer;
M: TPoint;
ctrlPoints: TPointArray;
begin
repeat
M := SPS_GetMyPos;

if (Length(ctrlPoints) = 0) then
ctrlPoints := TPABetweenPoints(Point(M.X, M.Y), Point(P.X, P.Y), 20 + Random(15), 10);

Inc(Tries);
if (Tries > 20) then
Exit;

Result := SPS_WalkPath(ctrlPoints);
until(Result);
end;

// Sets up SPS; needs to be called if you want to switch RS surfaces
function SPS_Setup(surface: integer; areas: TStringArray): boolean;
var
t: integer;
tmp: TMufasaBitmap;
begin
t := getSystemTime;

SPS_MultiMouse := true;
SPS_Accuracy := 4;

if (length(areas) > 0) then
begin
if (surface = RUNESCAPE_SURFACE) then
tmp := SPS_MergeAreas(areas) // combine the SPS areas into 1; makes for a more accurate read
else
if (surface = RUNESCAPE_OTHER) then
if (length(areas) = 1) then
tmp := SPS_GetArea(areas[0], surface)
else begin
writeln('SPS_Setup(): Invalid dungeon areas. You can only select one!');
exit;
end;

result := true;
SPS_AreaMaps := SPS_BitmapToMap(tmp, SPS_Accuracy);
SPS_Areas := SPS_SortAreas(areas);
tmp.free();

end else
writeln('SPS_Setup(): ERROR: SPS areas are not set!');

t := (getSystemTime - t);

if (SPS_Debug) and (result) then
writeln('[SPS] SPS_Setup() took '+toStr(t)+' ms. Areas: '+toStr(SPS_Areas));
end;

magicxfuzion
03-02-2013, 10:31 PM
C:\SimbaNEWONE USE THIS JAKE KK\Includes\SRL/SRL/misc/SmartParams.Simba(281:149): Invalid number of parameters at line 280 shows this, what should i do? its doing this for numerous of scripts of mine, please help!

Ryley
05-01-2013, 11:46 PM
C:\SimbaNEWONE USE THIS JAKE KK\Includes\SRL/SRL/misc/SmartParams.Simba(281:149): Invalid number of parameters at line 280 shows this, what should i do? its doing this for numerous of scripts of mine, please help!

having exactly the same error message. any help?