SRL Archive - S.M.A.R.T.

'SRL_SixHourFix := True;' Isn't working.


P1nky

2012-08-16 03:44:00

Hello Mates, I know ScriptManager is a tad outdated (by reading the thread, people were complaining, if I am wrong about it being outdated… Please correct me :) ) Well than I heard there is a func called:
SRL_SixHourFix := True;
I had called it before SetupSRL, but for some odd reason it does not keep me going after 6 hours… i do not know if it even refreshes the SMART, but when I come home and check my laptop, the screen is at the Login… Maybe it does work but just doesn't login properly?


Can someone please help me here :).


Thanks Guys!

P1ng

2012-08-16 03:54:39

I had this problem, is there any chance your mainloop has until(not LoggedIn); or something similar, that's where my issue arose from.

This is how I call it in my setup procedure -
  ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}

SetupSRL;
DeclarePlayers;

masterBB

2012-08-16 03:55:37

It should be called before setupSmart(param:Boolean)

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;

P1nky

2012-08-16 03:59:40

From: P1ng
I had this problem, is there any chance your mainloop has until(not LoggedIn); or something similar, that's where my issue arose from.

All I have is this:
SRL_SixHourFix := True;
SetUpSRL;
DeclarePlayers;
lol
From: masterBB
It should be called before setupSmart(param:Boolean)

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;

Could you please paste a example Mate?

P1ng

2012-08-16 04:01:27

  ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}

SetupSRL;
DeclarePlayers;

masterBB

2012-08-16 04:10:59

I pasted that piece of code because that was the implementation of smartParams. Anyway as you can see, the only way it wouldn't work is if there isn't a procedure called DeclarePlayers.

You can also check if it is set correctly by running this after SetupSmart(p);

writeln(SRL_Procs[SRL_OnRSUpdate]);
writeln(@SixHourFix);

P1nky

2012-08-16 04:15:04

From: masterBB
I pasted that piece of code because that was the implementation of smartParams. Anyway as you can see, the only way it wouldn't work is if there isn't a procedure called DeclarePlayers.

You can also check if it is set correctly by running this after SetupSmart(p);

writeln(SRL_Procs[SRL_OnRSUpdate]);
writeln(@SixHourFix);


Ah that maybe the problem, my DeclarePlayers was called as DeclarePlayerz :p

and Thanks Ping for typing that I have added it in my script.

masterBB

2012-08-16 04:17:07

Also note that the srl fix is triggered by LoginPlayer or LoginPlayerToLobby. Make sure that when the player is logged out loginPlayer is called.

P1nky

2012-08-16 04:18:53


ClearDebug;
ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
SetUpSRL;
DeclarePlayers;
LoginPlayerToLob;
ActivateClient;
OpenWorldScreen;
SelectWorld('18');

Just like that Mate?

Jakkle

2012-08-16 07:48:25

From: P1nky

ClearDebug;
ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
SetUpSRL;
DeclarePlayers;
LoginPlayerToLob;
ActivateClient;
OpenWorldScreen;
SelectWorld('18');

Just like that Mate?


You would need to call it in your main loop like so,

. until(DoISwitchChar) or (not LoggedIn);
end;
if (not LoggedIn) then
LoginPlayer;
until(AllPlayersInActive);

NKN

2012-08-16 08:49:03

I made my own, this one was too difficult to get working properly. xD

It's basically the same thing, but if you log out, it restarts SMART.

CephaXz

2012-08-16 09:21:21

From: NKN
I made my own, this one was too difficult to get working properly. xD

It's basically the same thing, but if you log out, it restarts SMART.


How did you do this? Like this?

SRL_Procs[srl_OnLogout] := @Sixhourfix;

blinkblink

2012-08-16 10:40:26

It would never work for me before, even with help from brandon
On my own I found the solution was simply, in the if not logged in… instead of terminating the script or exit etc… simply call to login the player - that forces the script to try to login and the session ended screen should show up which causes smart to identify it which reloads smart to continue running the script.

-edit-
lol just realized someone posted it :P

masterBB

2012-08-16 10:43:49

From: blinkblink
It would never work for me before, even with help from brandon
On my own I found the solution was simply, in the if not logged in… instead of terminating the script or exit etc… simply call to login the player - that forces the script to try to login and the session ended screen should show up which causes smart to identify it which reloads smart to continue running the script.

-edit-
lol just realized someone posted it :P


Yes, that is the normal way to activate it ^^.

To manually restart smart just run SixHourFix;

Jakkle

2012-08-16 11:13:32

It's all about the scripter and how they code their script.
With my main loop the way it is, it will always try to login a player if not logged in unless 'AllPlayersInActive'.
This is a proggy I have from a player that's still going :D
~ Running for: 12 Hours, 37 Minutes and 11 Seconds ~
~ Loads done: 810/1000 ~
~ Vials filled: 22680 ~
~ Current player is: ****~
I will be releasing this script soon after I have sexed it up a bit ;)

NKN

2012-08-16 12:32:00


procedure SixHourFixCustom;
var
Trash: TVariantArray;
Refresh: Integer;
begin
if(not(LoggedIn)) then
begin
FreeSRL;
Refresh := SmartGetRefresh;
SmartKillClient(SmartCurrentClient);
SetupSRL;
try
CallProc('DeclarePlayers', Trash);
except
Writeln('Could Not DeclarePlayers');
TerminateScript;
end;
SmartSetRefresh(Refresh);
wait(6000+random(2000))
if(not(LoginPlayer())) then
players[currentplayer].Active := False;
end;
end;

I call this a few times in my mainloop. :)

mormonman

2012-08-16 12:40:50

Please use this one….
Procedure SixHourFix;
var
Trash: TVariantArray;
Refresh: Integer;
begin
FreeSRL;
Refresh := SmartGetRefresh;
SmartKillClient(SmartCurrentClient);
SetupSRL;
SmartSetRefresh(Refresh);
try
CallProc('DeclarePlayers', Trash);
except
Writeln('Could Not DeclarePlayers');
TerminateScript;
end;

try
CallProc('SMART_FreeDebug', Trash);
CallProc('SMART_SetupDebug', Trash);
except
end;

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

CephaXz

2012-08-16 12:49:32

What does srl_OnRSUpdate do? And where can I find all the srl_Procs procedures/functions?

freezeyp

2012-08-17 20:58:39

can i change the following code
FreeSRL;
Refresh := SmartGetRefresh;
SmartKillClient(SmartCurrentClient);
SetupSRL;
into this one?
smartkillclient(Smart_CurrentClient);
SetupSmart(true);

Because i can't understand why you need to setupsrl again?

shstiger2009

2012-08-20 13:00:50

Time running: 25 Hours, 14 Minutes and 6 Seconds
Time until break: 8 Hours, 28 Minutes and 24 Seconds

Mine's working just nicely. :)

NCDS

2012-08-20 19:15:42

From: CephaXz
What does srl_OnRSUpdate do? And where can I find all the srl_Procs procedures/functions?


SRL/SRL/Core/Globals.Simba ;)

P1nky

2012-09-05 23:04:28

I have done random testing for passing up the 6 hour rule, but I just cannot figure out the problem :S It's quite frustrating lol, waiting 6 hours and end up with the stupid refresh message.

I have attempted most of what y'all advised me to do, I made a random autotalker/dancer script just to see if it will work, can someone please put those lines in for me that will keep refreshing smart and login after every 6 hours.



Program Dancer;

{$DEFINE SMART}
{$I SRL/SRL.SIMBA}

var
Done, d : integer;

const
DanceAmount = 9000000000000000000;
World = '2'; // '1' '2' '18' ARE THE ONLY VALID WORLDS

Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
With Players[0] Do
Begin
Name := '';
Pass := '';
Active := True;
End;
end;



Procedure Dance;
begin
d := d + 1;
case Random(4) of
1: DoEmote(13);
2: DoEmote(14);
3: DoEmote(15);
end;
end;


Procedure PinkyType(Text : String; PressEnter : Boolean);
var
p : Integer;
begin
for p:=1 to Length(text) do
SendKeys(Text[p],1 + Random(1),2);

If PressEnter then
TypeByte(VK_Return);
end;


function talk : boolean;
begin
//case random(1) of
{0: }PinkyType('i love runescape!',true);
//end;
end;



begin
ClearDebug;
ClearDebug;
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
SetUpSRL;
DeclarePlayers;
LoginPlayerToLob;
ActivateClient;
//OpenWorldScreen;
repeat
SelectWorld(2);
//case world of
{ '2' :
MouseBox(227,160,299,160,1); // w2
'1' :
MouseBox(227,138,299,138,1); // w1
'18' :
Selectworld(18); // w18
end; }
until(LoginPlayer);
ClearDebug;
begin
repeat
GameTab(34);
Talk; wait(500 + random(500)); Dance;
if d = DanceAmount then
writeln('Dancing Amount has been reached, time to Terminate Script ~ P1nky');
Until(d = DanceAmount);
end;
end.

Thank you, and I will surely rep the person who helps!

riwu

2012-09-05 23:27:57

If the problem is that it won't log back in after 6hr, just add log in failsafe in ur mainloop:
 repeat
if not LoggedIn then LoginPlayer; //u must ensure that the rest of the procedures exit (which is usually the case) instead of terminating upon failure though
GameTab(34);
Talk; wait(500 + random(500)); Dance;
if d = DanceAmount then
writeln('Dancing Amount has been reached, time to Terminate Script ~ P1nky');
Until(d = DanceAmount);
Add more of 'if not LoggedIn then LoginPlayer;' throughout ur script if it gets stuck in a particular part.

CephaXz

2012-09-06 01:41:46

I actually made myself a NotLoggedIn, and custom sixhourfix. Because with the normal sixhourfix, it won't do the setup like your script does in the beginning, something like clicknorth and high angle.

P1nky

2012-09-07 03:55:52

Mates how can I prevent memory loss? I am experiencing overload of SmartRemote's in my Process(Task Manager),

Olly

2012-09-07 09:15:01

From: P1nky
Mates how can I prevent memory loss? I am experiencing overload of SmartRemote's in my Process(Task Manager),


Hmm do they just sit there taking up memory but no cpu? because that's what i get ;P

P1nky

2012-09-07 12:23:30

From: Ollybest
Hmm do they just sit there taking up memory but no cpu? because that's what i get ;P


No like every time it reloads the smart, the memory never gets freed.

CephaXz

2012-09-07 12:26:10

From: P1nky
No like every time it reloads the smart, the memory never gets freed.


I used to have that problem in Smart 7.2. Its gone after I upgraded to 8.0.

print

2012-09-07 12:34:55

Some of the scripts i use run over 8 hours 0.0

riwu

2012-10-23 05:07:21

I'm getting confused now as to why DeclarePlayers must be called again after Smart restarts? FreeSRL and SetupSRL is recalled but the user record shouldn't be affected? If DeclarePlayers is called again doesn't that mean all previously Inactive players will be set to active again?

Olly

2012-10-23 05:52:22

That is true.. but no one uses multiplayer anymore haha :P but yeah surely it should be loginplayer.

riwu

2012-10-23 06:00:37

From: Ollybest
That is true.. but no one uses multiplayer anymore haha :P but yeah surely it should be loginplayer.

I'm a big fan of multi-player :garfield:
LoginPlayer is already called below so that's not what's intended. Guess we'll have to wait for Brandon for an answer.

Brandon

2012-10-23 11:17:26

From: riwu
I'm a big fan of multi-player :garfield:
LoginPlayer is already called below so that's not what's intended. Guess we'll have to wait for Brandon for an answer.



When I first wrote it, I was storing a variable in DeclarePlayers or something. I actually can't remember why (I think it's something to do with SmartPID I was testing). There was a good reason behind it; though I'm not so sure it's needed now.

I remember that I needed it for some reason before I implemented. SRL_Procs[srl_OnRSUpdate]. You can try removing and it and testing to make sure it's not needed before getting an update pushed.

EDIT:

I remember why now. Here is the reasoning behind it. At the time, there was no way for me to check if a procedure/function "Exists" within a script. I don't believe there is a way atm other than reading the script through File I/O. Can always have a global boolean that gets set when DeclaredPlayers get called or do Length(Players[0]) or something.

Anyway, some players would start their script while already logged in WITHOUT the DeclaredPlayers function.

Example, some scripts didn't have that function and when they tried to use the 6-hour fix, there were a stupid amount of threads saying it didn't work and blah blah. Noobs would PM me like mad. So what I did was I implemented the CallProc to see if the function exists and setup players. If it doesn't exist, then the script cannot log you in and it should just terminate with a message telling you that. Also the first idea of the SixHourFix was to actually restart the script itself but that was later removed for smart 7.2 or something.

Bad idea I guess.

Bixby Sayz

2012-10-23 12:10:42

Wow. This poses some severe problems for me, as I use multiplayer in all my scripts. I'll have to completely rethink how to handle this: requiring the user to modify their includes to workaround a limitation is never a good solution.

riwu

2012-10-23 21:23:26

From: Brandon
When I first wrote it, I was storing a variable in DeclarePlayers or something. I actually can't remember why (I think it's something to do with SmartPID I was testing). There was a good reason behind it; though I'm not so sure it's needed now.

I remember that I needed it for some reason before I implemented. SRL_Procs[srl_OnRSUpdate]. You can try removing and it and testing to make sure it's not needed before getting an update pushed.

EDIT:

I remember why now. Here is the reasoning behind it. At the time, there was no way for me to check if a procedure/function "Exists" within a script. I don't believe there is a way atm other than reading the script through File I/O. Can always have a global boolean that gets set when DeclaredPlayers get called or do Length(Players[0]) or something.

Anyway, some players would start their script while already logged in WITHOUT the DeclaredPlayers function.

Example, some scripts didn't have that function and when they tried to use the 6-hour fix, there were a stupid amount of threads saying it didn't work and blah blah. Noobs would PM me like mad. So what I did was I implemented the CallProc to see if the function exists and setup players. If it doesn't exist, then the script cannot log you in and it should just terminate with a message telling you that. Also the first idea of the SixHourFix was to actually restart the script itself but that was later removed for smart 7.2 or something.

Bad idea I guess.

Hmm, but there is already a failsafe at the end:
  If (Not LoginPlayer) then
begin
Writeln('~SixHourFix~ Could Not Login Player');
TerminateScript;
end;
Wouldn't that suffice? I've glanced through the code, LoginPlayer seems to return true only if LoggedIn is true.

The limitation of doing CallProc is that the procedure declaring player may not necessarily be named DeclarePlayers (i'm surprised at the unity of SRL scripts when it comes to this, seems like just because some tutorials used them everyone just copy and paste them), resulting in false positive?


From: Bixby Sayz
Wow. This poses some severe problems for me, as I use multiplayer in all my scripts. I'll have to completely rethink how to handle this: requiring the user to modify their includes to workaround a limitation is never a good solution.

If you really want to go around it (before we come out with a perm solution) you could store the .Active Boolean to an array everytime before you call 'LoginPlayer' and then transferring it back. (could be done with a few lines using a loop)

Bixby Sayz

2012-10-23 21:33:42

From: riwu
If you really want to go around it (before we come out with a perm solution) you could store the .Active Boolean to an array everytime before you call 'LoginPlayer' and then transferring it back. (could be done with a few lines using a loop)
Would have to store the entire player array since any thing that has been changed by the script (stats among other things) has the potential to be wiped out.

riwu

2012-10-23 21:38:38

From: Bixby Sayz
Would have to store the entire player array since any thing that has been changed by the script (stats among other things) has the potential to be wiped out.

Huh why is stats stored in player record? Personally for me only .Active is changed during run time. But even if you want to store the entire record you can just store them as the same TUser record easily. And use a loop to loop through all the players if you have multiple players.

Brandon

2012-10-23 21:58:54

From: riwu
Hmm, but there is already a failsafe at the end:
  If (Not LoginPlayer) then
begin
Writeln('~SixHourFix~ Could Not Login Player');
TerminateScript;
end;
Wouldn't that suffice? I've glanced through the code, LoginPlayer seems to return true only if LoggedIn is true.


Not sure how much the procedure has changed or if it is the same at all. I haven't actually ran a Simba script in over 2 months. Well with the exception of Asha's Phoenix feathers script.

That would indeed work though. If you tested it, you can try asking for it to be pushed as long as it works.