SRL Archive - FAQ

another error; hmm?


Jos3ph

2012-09-21 08:24:07

I havent ran a script in a few days and this is the error I have gotten; how can I stop this from happening, only last week I had this same problem, and again this happens…

Using smart 8.0


[Error] C:\Simba\Includes\SRL/SRL/misc/SmartParams.Simba(278:134): Invalid number of parameters at line 277
Compiling failed.

riwu

2012-09-21 08:25:36

You'll have to remove the -1 every time your SRL files are rewritten by new updates. SRL will probably only be updated to be compatible with SMART 8 when SMART 8 goes official.

Jos3ph

2012-09-21 09:45:35

From: riwu
You'll have to remove the -1 every time your SRL files are rewritten by new updates. SRL will probably only be updated to be compatible with SMART 8 when SMART 8 goes official.


Where do I delete the -1? I apologize I am not very tech savy with how scripting works so bare with me.

Justin

2012-09-21 09:56:02

In the file: C:\Simba\Includes\SRL/SRL/misc/SmartParams.Simba

Line 277

You will find the line number on the left hand side on the file that is in the main window.

Jos3ph

2012-09-21 09:58:14

From: [J]ustin
In the file: C:\Simba\Includes\SRL/SRL/misc/SmartParams.Simba

Line 277

You will find the line number on the left hand side on the file that is in the main window.


Just delete the line on 277? I really do apologize if I am not asking the right questions?

riwu

2012-09-21 10:00:06

The same error requires the same solution.
You posted the exact same error 1 week ago: http://villavu.com/forum/showthread.php?t=89825
What makes you think it will require a different solution this time?

Jos3ph

2012-09-21 10:08:34

From: riwu
The same error requires the same solution.
You posted the exact same error 1 week ago: http://villavu.com/forum/showthread.php?t=89825
What makes you think it will require a different solution this time?


Look man, I told you from the start—I dont know what I am doing.


Why would I assume I can do the same method; take a chill pill brother.

riwu

2012-09-21 10:14:46

From: Jos3ph
Look man, I told you from the start—I dont know what I am doing.


Why would I assume I can do the same method; take a chill pill brother.

Common sense is vital to thrive here ;)
If you can't be bothered to acquire new knowledge yourself, at least learn from your mistakes in which others have blatantly pointed out to you.

Also i'm not angry/anything at all, sometimes my choice of words may convey the wrong tone :p.

Jos3ph

2012-09-21 10:25:30

From: riwu
Common sense is vital to thrive here ;)
If you can't be bothered to acquire new knowledge yourself, at least learn from your mistakes in which others have blatantly pointed out to you.

Also i'm not angry/anything at all, sometimes my choice of words may convey the wrong tone :p.


I understand, I've done what I did last time & I get this..

SRL Compiled in 16 msec
Error: Out Of Range at line 278
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]


This is high lighted in orange

 Result:= SmartSpawnClient(ReplaceWrap(PluginPath, '\', '/', [rfReplaceAll]), Params[0], ',' + Params[1], 765, 553, 's', '', '');   

Justin

2012-09-21 10:38:12

From: Jos3ph
I understand, I've done what I did last time & I get this..

SRL Compiled in 16 msec
Error: Out Of Range at line 278
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]


This is high lighted in orange

 Result:= SmartSpawnClient(ReplaceWrap(PluginPath, '\', '/', [rfReplaceAll]), Params[0], ',' + Params[1], 765, 553, 's', '', '');   


Make sure you have saved the file.

Jos3ph

2012-09-21 10:40:58

Let me double check my steps lets see what I did wrong.

@Justin, hey I checked the codes and I just figured I'd search for

 Result:= SmartSpawnClient(ReplaceWrap(PluginPath, '\', '/', [rfReplaceAll]), Params[0], ',' + Params[1], 765, 553, 's', '', '');  


which is suppose to be the new updated one and

Result:= SmartSpawnClient(ReplaceWrap(PluginPath, '\', '/', [rfReplaceAll]), Params[0], ',' + Params[1], 765, 553, 's', '', '', -1);

being the out dated one….When I go to look for ^^ the one above It doesn't come up, but when I look for the first code it pops up in green which means it saved right, but doesnt solve my problem.

Jakkle

2012-09-21 11:27:46

Edited: Did you delete Params := GetSmartParams; on line 277 by any chance ?

Edit:2 If you can't find the problem all I can say is copy all of the below code and paste it over the code in SmartParams.simba
{$DEFINE SRL_SMART}
{$DEFINE SMART}
{$loadlib libsmartremote}

(*
GetSmartParams
~~~~~~~~~~~~~~

.. code-block:: pascal

Function GetSmartParams: TStringArray;

Grabs The Correct Parameters For passing to the SmartClient.

.. note::

By: Brandon.
Modified By: Mormanman, Benland100.

Example:

.. code-block:: pascal

*)
Function GetSmartParams: TStringArray;
var
Params: TStringArray;
Page: String;
begin
Page := Between('<iframe id="game" src="', '"', GetPage('http://www.runescape.com/game.ws?j=1'));
Params := Explode(',', Page);
Result := Params;
end;

(*
FixSmartSpeed
~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure FixSmartSpeed;

Fixes Smart's Loading Speed.
Moves the Mouse & Adjusting the Canvas Refresh rate.

.. note::

By: Brandon.

Example:

.. code-block:: pascal

*)
Procedure FixSmartSpeed;
var
T: Integer;
begin
T:= GetSystemTime + 2000;
While (Not SmartEnabled) Do
begin
if (GetSystemTime >= T) Then
Break;
Wait(500);
end;

While (GetColor(382, 252) = 0) Do
begin
If RSReady then
Break;
SmartSetRefresh(SmartGetRefresh + 1);
MMouse(4, 4, 0, 0);
SmartSetRefresh(SmartGetRefresh - 1);
if (GetSystemTime >= T) Then
Break;
Wait(500);
end;
end;

(*
SmartGetClientIDs
~~~~~~~~~~~~~~

.. code-block:: pascal

Function SmartGetClientIDs: TIntegerArray;

Grabs All Client ID's of the current remote.

.. note::

By: Mormanman.

Example:

.. code-block:: pascal

*)
Function SmartGetClientIDs: TIntegerArray;
var
I, Count: Integer;
begin
Count := SmartGetClients(True);
SetLength(Result, Count);
If (Count > 0) then
For I:= 0 to (Count - 1) do
Result[I] := SmartClientID(I);
end;

(*
SmartKillClients
~~~~~~~~~~~~~~

.. code-block:: pascal

procedure SmartKillClients;

Kills All Smart Clients.

.. note::

By: Mormanman.

Example:

.. code-block:: pascal

*)
procedure SmartKillClients;
var
IDs: TIntegerArray;
I: Integer;
begin
IDs := SmartGetClientIDs;
For I := High(IDs) DownTo 0 Do
If SmartKillClient(IDs[I]) Then
Writeln('Killed Client: ' + ToStr(IDs[I]))
else
Writeln('Failed To Kill Client: ' + ToStr(IDs[I]));
end;

(*
SixHourFix
~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure SixHourFix;

Kills The Current Smart Client and Restarts it.
Fixes the 6 hour login.

.. note::

By: Brandon.

Example:

.. code-block:: pascal

*)
Procedure FreeSRL; Forward;
Procedure SetupSRL; Forward;
Procedure SixHourFix;
var
Trash: TVariantArray;
Refresh: Integer;
begin
FreeSRL;
Refresh := SmartGetRefresh;
SmartKillClient(SmartCurrentClient);
SetupSRL;
try
CallProc('DeclarePlayers', Trash);
except
Writeln('Could Not DeclarePlayers');
TerminateScript;
end;

{$IFDEF SMART_GRAPHICS}
SMART_FreeDebug;
SMART_SetupDebug;
{$ENDIF}
SmartSetRefresh(Refresh);

If (Not LoginPlayer) then
begin
Writeln('~SixHourFix~ Could Not Login Player');
TerminateScript;
end;
end;


(*
PairSmart
~~~~~~~~~~~~~~

.. code-block:: pascal

Function PairSmart(ID: Integer): Boolean;

Pairs A Client To The Current Controller.

.. note::

By: Benland100, Brandon.

Example:

.. code-block:: pascal

*)
Function PairSmart(ID: Integer): Boolean;
var
I, Count: Integer;
IDs: TIntegerArray;
begin
IDs := SmartGetClientIDs;
Count := Length(IDs);
If (Count > 0) then
For I:= 0 To (Count - 1) Do
If (IDs[I] = ID) and SmartPairClient(ID) then
begin
SetEIOSTarget('libsmartremote', ToStr(ID));
Writeln('Paired with SMART[' + ToStr(ID) + ']');
Result := True;
Exit;
end;
Writeln('** Failed To Pair Client: ' + ToStr(ID) + '; Client Does Not exist **');
end;

(*
InitSmart
~~~~~~~~~~~~~~

.. code-block:: pascal

Function InitSmart(ForceNew: Boolean): Integer;

Initializes A Smart Remote Client.
Terminates the current script upon failure.
Terminates all clients of the current remote upon failure.
ForceNew Creates a new client.

.. note::

By: Benland100, Mormanman, Brandon.

Example:

.. code-block:: pascal

*)
Function InitSmart(ForceNew: Boolean): Integer;
var
I, Count: Integer;
IDs: TIntegerArray;
Params: TStringArray;
begin
If (Not ForceNew) then
begin
Ids := SmartGetClientIDs;
Count := Length(IDs);
If (Count > 0) then
For I:= 0 To (Count - 1) Do
begin
If SmartPairClient(IDs[I]) then
begin
Result := IDs[I];
SetEIOSTarget('libsmartremote', ToStr(Result));
Writeln('Paired with SMART[' + ToStr(Result) + ']');
Exit;
end;
end;
end;

Params := GetSmartParams;
If (Length(Params) > 2) then
begin
Writeln('** Failed To Grab Smart Parameters **');
TerminateScript;
Exit;
end;

Result:= SmartSpawnClient(ReplaceWrap(PluginPath, '\', '/', [rfReplaceAll]), Params[0], ',' + Params[1], 765, 553, 's', '', '', '');
If (Result > 0) Then
begin
try
SetEIOSTarget('libsmartremote', ToStr(Result));
Writeln('Loading SMART: ' + Params[0] + Params[1]);
except
WriteLn('** Fatal Error: Pairing Clients; Terminating Script **');
TerminateScript;
end;
end else
begin
Writeln('** Smart Cannot Spawn Clients **');
TerminateScript;
end;
end;

(*
SetupSmart
~~~~~~~~~~~~~~

.. code-block:: pascal

Procedure SetupSmart(ForceNewClient: Boolean);

Sets Up a new Smart Client and waits until it's on screen.
Terminates The current script upon failure.

.. note::

By: Mormanman.
Modified By: Brandon.

Example:

.. code-block:: pascal

*)
Procedure SetupSmart(ForceNewClient: Boolean);
var
T: Integer;
begin
T:= GetSystemTime + 120000;
Smart_CurrentClient:= InitSmart(ForceNewClient);
if (Smart_CurrentClient <= 0) then
begin
writeln('*** Smart Failed To Load ***');
TerminateScript;
end;

if (SRL_SixHourFix) then
SRL_Procs[SRL_OnRSUpdate]:= @SixHourFix;

While (GetColor(382, 252) <> 0) Do
begin
if RSReady then
break;

Wait(100);
if (GetTimeRunning >= 120000) then
begin
Writeln('*** Failed To Detect Clients ***');
TerminateScript;
end;
end;
end;





{* Functions Below Here are From the Original Smart.Simba *}


{*
By: Unknown Author.
Finds a Windows by partial title and Sets it as the target.
*}
function FindAndSetTarget(TitlePrefix: String; SetAsTarget: Boolean): Boolean;
var
T : TSysProcArr;
I : Integer;
begin
T := GetProcesses;
for I := High(T) downto 0 do
if Pos(TitlePrefix, T[I].Title) <> 0 then
begin
Result := True;
if SetAsTarget then SetTarget(T[I]);
Exit;
end;
end;

{*
By: Unknown Author.
Gets the position of the actual mouse (Not Smart's Mouse).
*}
procedure GetRealMousePos(var X, Y : Integer);
var
KMTarget, ITarget: Integer;
begin
{$IFDEF LAPE}
writeln('GetRealMousePos not implemented yet in SRL-5 Lape!');
TerminateScript;
{$ELSE}
KMTarget := GetKeyMouseTarget;
ITarget := GetImageTarget;
FindAndSetTarget('SMART', True);
GetTClient.IOManager.GetMousePos(X, Y);
FreeTarget(GetImageTarget);
SetKeyMouseTarget(KMTarget);
SetImageTarget(ITarget);

// These are not universial offsets, but works somewhat for some Windows themes.
X := X - 8;
Y := Y - 25;
{$ENDIF}
end;

{*
By: Unknown Author.
Returns if the "Real Mouse" (Not Smart's Mouse) Is Within a given Box.
*}
function IsRealMouseInBox(B : TBox): Boolean;
var
P : TPoint;
begin
GetRealMousePos(P.X, P.Y);
Result := PointInBox(P, B);
end;

Jos3ph

2012-09-21 12:10:23

thanks guys, and Jackkie your PM solved my problem! Great effort to fix my probs.

footballjds

2012-09-21 12:34:10

From: Jos3ph
^ I pasted it over but the entire code pasted onto line 1;

& I am now getting this…

Exception in Script: Define not close


you my friend are like a comic book, stupid but so f%#2ing hilarious! :P

Dgby714

2012-09-21 12:35:43

Can't we just add a IFDEF in there?


Edit: Ok, Now when this is pulled and syncs with the updater, You just have to add {$DEFINE SMART8} to your script. https://github.com/SRL/SRL-5/pull/82/files

Jos3ph

2012-09-21 12:45:10

From: footballjds
you my friend are like a comic book, stupid but so f%#2ing hilarious! :P


You keep posting, you must think your better then everyone right? Guess thatsn why your high light of your day is smoking, your are such a joke.

footballjds

2012-09-21 14:17:52

From: Jos3ph
You keep posting, you must think your better then everyone right? Guess thatsn why your high light of your day is smoking, your are such a joke.


[offtopic]
I'm not better then anyone but you, and that's your choice.
I'm on probation, haven't been getting high :redface: [/offtopic]