Results 1 to 14 of 14

Thread: function LogoutSleepLogin(SleepTimeInMin, RandSleepTimeInMin : integer): boolean;

  1. #1
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    function LogoutSleepLogin(SleepTimeInMin, RandSleepTimeInMin : integer): boolean;

    SCAR Code:
    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

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    if you want to test it but are lazzy use this
    SCAR Code:
    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.

  3. #3
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    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.

  4. #4
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    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

  5. #5
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    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.

  6. #6
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)
    yes there is plenty, no need to get all upset about it?

    SCAR Code:
    {*******************************************************************************
    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\/
    SCAR Code:
    {*******************************************************************************
    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 \/
    SCAR Code:
    {*******************************************************************************
    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?

  7. #7
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Good point.

    But those are used quite commonly, right?

    Imagine putting those in every scrpt you make.

    Happy new year, by the way.

  8. #8
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)
    Quote Originally Posted by EvilChicken View Post
    Good point.

    But those are used quite commonly, right?

    Imagine putting those in EVERY scrpt you make.

    Happy new year, by the way.
    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!

  9. #9
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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.
    Active only during the Summer...

  10. #10
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    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

    SCAR Code:
    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;
    METAL HEAD FOR LIFE!!!

  11. #11
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)
    Quote Originally Posted by JackLKrawl View Post
    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.

    Quote Originally Posted by gerauchert View Post
    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

    SCAR Code:
    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.

  12. #12
    Join Date
    Mar 2006
    Posts
    13,241
    Mentioned
    228 Post(s)
    Quoted
    267 Post(s)

    Default

    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
    SCAR Code:
    {*******************************************************************************
    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. 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.
    STOP PM'ING ME

  13. #13
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    ^^ thanks hobbit. and i agree/

  14. #14
    Join Date
    Dec 2006
    Posts
    93
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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.
    If I see you autoing with level 3/default clothes /crap name (0038248) I WILL NOT HESITATE to report you
    and pray that you get BANNED). If you Auto Incorrectly... I hope you DIE - put this in your sig!!!
    Words from a long experienced user:

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •