Results 1 to 8 of 8

Thread: LoginPlayer

  1. #1
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    LoginPlayer

    In a fair amount of scripts I've looked through, I'm constantly confronted with this bit of evil code:

    Code:
    if (not (LoggedIn)) then LoginPlayer;
    and all its variations. It's redundant and only serves to waste time and cpu cycles. It can be cut down to this:

    Code:
    LoginPlayer;
    Comments? Thoughts? Objections?

  2. #2
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I don't really see the harm in it. LoggedIn is just a GetColor, which is faster (by a surprising amount) than writeln.

    Run this:
    SCAR Code:
    program New;
    var
      I, T: Integer;
    begin
      T:= GetSystemTime;
      for I:= 1 to 1000 do
        GetColor(0, 0);
      writeln(inttostr(GetSystemTime - T));
    end.
    It'll write how long it took for it to use GetColor 1000 times.

  3. #3
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    True, less than .1 ms. But in terms of clean code, why bother including it? I see absolutely no benefit.

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I usually just do it out of habit. I even find myself typing "if(not(Loggedin))then exit;" on procedures/functions that aren't used with RS sometimes

  5. #5
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Haha, nice. I love using SCAR for mundane tasks and cheap flash games. :P

  6. #6
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Yes. Also a lot of people don't realize that Gametab() checks if you are already there, and they put a needless failsafe. There are a few other examples, which basically means, print out SRL and read through it whenever you're waiting for something.

  7. #7
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Boreas View Post
    Yes. Also a lot of people don't realize that Gametab() checks if you are already there, and they put a needless failsafe. There are a few other examples, which basically means, print out SRL and read through it whenever you're waiting for something.
    Yea, I see that a lot. People also click the magic tab, then use SRL's Cast when SRL should click it for them, as well as a host of other similar things.

    People put small random waits after Mouse or MMouse, when it already has a 100 + Random(100) wait by default. You think we should make a topic listing all the common redundancies found in scripts?

  8. #8
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Be my guest.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. LoginPlayer? wtf
    By ducels in forum OSR Help
    Replies: 5
    Last Post: 01-01-2008, 03:55 AM
  2. Can't use LoginPlayer.........
    By syther fox in forum OSR Help
    Replies: 8
    Last Post: 07-19-2007, 01:45 AM

Posting Permissions

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