PDA

View Full Version : function LogoutSleepLogin(SleepTimeInMin, RandSleepTimeInMin : integer): boolean;



footballjds
12-31-2007, 08:54 PM
function LogoutSleepLogin(SleepTimeInMin, RandSleepTimeInMin : integer): boolean;
begin
if (not(LoggedIn)) or (SleepTimeInMin <= 0) then
begin
Writeln('Error Occurred, Either You''re Already Logged Out Or');
Writeln('You Set TimeToSleepInMinutes To Zero Or Below.');
TerminateScript;
end;
if (RandSleepTimeInMin <= 0) then
begin
Writeln('WARNING RandSleepTimeInMin Shouldn''t Be Zero Or Less!');
RandSleepTimeInMin := 1;
Writeln('I Changed RandSleepTimeInMin To 1 For You.');
end;
Result := False;
if (Logout) then
begin
Writeln('Logged Out');
Writeln('Waiting ' + (IntToStr(SleepTimeInMin)) + 'Minutes Plus Random ' + (IntToStr(RandSleepTimeInMin)) + 'Minutes');
wait(60000 * SleepTimeInMin + random(RandSleepTimeInMin * 60000));
LogInPlayer;
Result := True;
end else
begin
Writeln('Error Occured While Logging Out, Script Terminated');
TerminateScript;
end;
end;

Tell me what you think, and BTW i made this All by Myself, for 1 of my scripts, although id love it it wer added to SRL rev 10 =p jk

footballjds
12-31-2007, 09:12 PM
if you want to test it but are lazzy use this ;)
program New;
{.include srl/srl.scar}
function LogoutSleepLogin(SleepTimeInMin, RandSleepTimeInMin : integer): boolean;
begin
if (not(LoggedIn)) or (SleepTimeInMin <= 0) then
begin
Writeln('Error Occurred, Either You''re Already Logged Out Or');
Writeln('You Set TimeToSleepInMinutes To Zero Or Below.');
TerminateScript;
end;
if (RandSleepTimeInMin <= 0) then
begin
Writeln('WARNING RandSleepTimeInMin Shouldn''t Be Zero Or Less!');
RandSleepTimeInMin := 1;
Writeln('I Changed RandSleepTimeInMin To 1 For You.');
end;
Result := False;
if (Logout) then
begin
Writeln('Logged Out');
Writeln('Waiting ' + (IntToStr(SleepTimeInMin)) + 'Minutes Plus Random ' + (IntToStr(RandSleepTimeInMin)) + 'Minutes');
wait(60000 * SleepTimeInMin + random(RandSleepTimeInMin * 60000));
LogInPlayer;
Result := True;
end else
begin
Writeln('Error Occured While Logging Out, Script Terminated');
TerminateScript;
end;
end;

begin
SetupSRL;
ActivateClient;
Wait(10000);
HowManyPlayers :=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';//Your Username
Players[0].Pass := '';//Your Password
Players[0].Nick := '';//3-4 Letters Of Your Username
Players[0].Active := True;//Are You Using This Player? True=Yes False=No.
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
if (LogoutSleepLogin(1, 0)) then
Writeln('True');
end.

EvilChicken!
12-31-2007, 10:31 PM
procedure Sleep(SleepTimeInMin, RandSleepTimeInMin : integer);
begin
if (not(LoggedIn)) or (SleepTimeInMin <= 0) then exit;
LogOut;
Wait(60000 * SleepTimeInMin + random(RandSleepTimeInMin * 60000));
LogInPlayer;
end;

{Changed name, took out all extra unneeded writeln's and shortened it generally.}


Not to be harsh or anything, but this is really simple.

I believe Hy's fightcavesrunner has one of theese in it, and it couldn't have taken him more than one minute to make it. Sorry if I'm being too harsh, but honesty is .. FTW.

footballjds
12-31-2007, 10:42 PM
i never said it was hard, it is simple, but itd be nice if there was an SRL funtion to do log out and wait certian time.. don't you think? then itd be even more simple =p ;)

EvilChicken!
12-31-2007, 10:46 PM
Look at all the functions and procedures inside the SRL folder. Do you see one simple function/proc that isn't complicated? A procedure that doesn't need several hours of work to create?

You know, thats the point of SRL.
Its just a bunch of complicated procs/functions for a program.

footballjds
12-31-2007, 10:58 PM
yes there is plenty, no need to get all upset about it?;)

{************************************************* ******************************
function setBoolean(T: String): Boolean;
By: Dankness
Description: Changes String to Boolean
************************************************** *****************************}

function setBoolean(T: string): Boolean;
begin
try
StrToBool(t);
except
Result := False;
end;
end;

how many seconds did that take to write?

or this\/
{************************************************* ******************************
function TradeScreen: Boolean;
By: masquerader
Description: Returns true if a trade interface is opened.
************************************************** *****************************}

function TradeScreen: Boolean;
begin
if (GetColor(264, 194) = 49152) then
Result := True;
end;

or this \/
{************************************************* ******************************
function LoggedIn: Boolean;
By: WT-Fakawi
Description: Returns True if Logged In.
************************************************** *****************************}

function LoggedIn: Boolean;
begin
Result := (GetColor(439, 491) = 16777215);
end;


although they are all usefull and are used plenty they are rather simple, no?:duh:

EvilChicken!
12-31-2007, 11:15 PM
Good point.

But those are used quite commonly, right?

Imagine putting those in every scrpt you make.

Happy new year, by the way. :D

footballjds
01-01-2008, 12:47 AM
Good point.

But those are used quite commonly, right?

Imagine putting those in EVERY scrpt you make.

Happy new year, by the way. :D

yeah it would be a pain to have to put all those in every script =p. saves time.

and im glad i FINALY got my point across, thanks!

And happy NEw you TO YOU!

Jackrawl
01-05-2008, 03:38 AM
Login is standard material, just like Typesend, Typebyte, etc. They aren't difficult and they aren't easy, but they're very important.
Two of the things I noticed is that you chose for it to terminate the script every time it didn't work as it should. What you should be doing is giving out 'Result:=False' or 'Result:=True' and then leaving it to the person writing the script to decide how to take action from there. Every time it returns False, you terminate the script XD
Besides that, good job.

gerauchert
01-05-2008, 04:33 AM
Heres an example of something I use for my private hobgoblin trainer...

It lets you know how many minutes have passed, so you know if its still running or sleeping :D

Procedure SleepIt;
begin
if(Multiplayer = True)then
Exit;
begin
Status('Sleeping');
MarkTime(STime);
z := 0;
repeat
Status('Sleeping... ' + IntToStr(z) + ' minutes have passed');
Wait(60000);
z := z + 1;
until(TimeFromMark(STime) >= (SleepTime*60000 + random(60000*15)));
Writeln('Sleept for ' + IntToStr(z) + ' minutes');
end;
end;

footballjds
01-05-2008, 05:12 AM
Login is standard material, just like Typesend, Typebyte, etc. They aren't difficult and they aren't easy, but they're very important.
Two of the things I noticed is that you chose for it to terminate the script every time it didn't work as it should. What you should be doing is giving out 'Result:=False' or 'Result:=True' and then leaving it to the person writing the script to decide how to take action from there. Every time it returns False, you terminate the script XD
Besides that, good job.

thanks, thats just the version i was using. ofcoures if somone else were to use this they would edit it.


Heres an example of something I use for my private hobgoblin trainer...

It lets you know how many minutes have passed, so you know if its still running or sleeping :D

Procedure SleepIt;
begin
if(Multiplayer = True)then
Exit;
begin
Status('Sleeping');
MarkTime(STime);
z := 0;
repeat
Status('Sleeping... ' + IntToStr(z) + ' minutes have passed');
Wait(60000);
z := z + 1;
until(TimeFromMark(STime) >= (SleepTime*60000 + random(60000*15)));
Writeln('Sleept for ' + IntToStr(z) + ' minutes');
end;
end;

yeah somthing like that'd be nice to add, thanks.

Hobbit
01-05-2008, 07:46 AM
I agree with both of you.

Here is my point of view, SRL is like the world of inventions, once something has been invented, only so much more can be invented after that. (Not including derivatives). For example we will take the slurpee (because I am drinking one). I believe it was 7-11 who first invented it, then everyone copied them after. They are all the exact same thing but with different names, because it had already been invented so you can't really invent it again.

Same with SRL, all the simpler things where created when SRL was first made, such as footballjds' example of

{************************************************* ******************************
function LoggedIn: Boolean;
By: WT-Fakawi
Description: Returns True if Logged In.
************************************************** *****************************}

function LoggedIn: Boolean;
begin
Result := (GetColor(439, 491) = 16777215);
end;


But thats not to say that all new SRL Functions must be complicated, take Lazer printers for example, how hard is it to melt a fine dust of plastic to a sheet of paper?(Lazer toner is very uber fine plastic pellets if you didn't know that) Surely its much simpler then getting the printer to go through all this junk about taking the ink from the cartridge, through the ink tube, to the print heads, onto the paper in dots. But yet ink printers were around long before 'lazer' printers.

Ok, my examples are the best but they are the best I can think of right now.


Edit: Sorry for those of you from other continents who may not know what a Slurpee is. Slurpee example (http://www.tradenote.net/images/users/000/253/886/products_images/319157.jpg). It's hard to explain but its basically frozen pop or stuff like that then its like ground up i guess into tiny little ice stuff, and its really, good. << VERY horrible explaination


MY POINT:
It doesn't matter how complicated or how simple it is, it still can be useful, like you said Hy had one in his cave runner. So there you go, it was already useful to him.

footballjds
01-09-2008, 02:36 PM
^^ thanks hobbit. and i agree/:D

Ciesson
01-25-2008, 05:02 AM
I think something like this would be useful if added to the SRL library. Many member only have one members account, and running scripts non stop is an easy ban for just one player. Masterkill's PC has sleep, XcanX has it in his smelter, Hy has it in his fight caves runner. All very popular scripts.