Page 2 of 2 FirstFirst 12
Results 26 to 36 of 36

Thread: [Discussion]Coding efficiency?

  1. #26
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nauman I think youre wrong on that one...

    Continue's are used in loops (yours is not in the actual loop)

    What continue does is skips the rest of the loop and moves back to the top:

    SCAR Code:
    var
      i:integer;
    for i:=0 to 5 do
      begin
        if (i = 4) then
          continue;
        WriteLn(i);
      end;
    that will print 0 , 1 , 2, 3 , 5 and skip the 4
    Check out my SVC - here - It got me a scipters cup

  2. #27
    Join Date
    Jan 2008
    Posts
    46
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

  3. #28
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ekamjit View Post
    i dont understand what ur saying
    congrads on spamming...
    “Ignorance, the root and the stem of every evil.”

  4. #29
    Join Date
    May 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is getting weird.. Lol

  5. #30
    Join Date
    May 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post

    Continue
    will keep on running through the loop until a result is true or it is told to break.

    Its used lots in TPA finding.

    SCAR Code:
    If FindColorsTolerance(Blah, Blah) Then
      Atpa := TPAtoATPA(TPA, 9);

      For i := 0 to High(ATPA) Do
        C := MiddleTPA(ATPA[I]);
         Begin
           MMouse(c.x, c.y, 1, 1);
           Result := True;
         end else
           Continue //until it finds the object or is told to break;
    end;

    I thought this topic concerned advanced scripting?

  6. #31
    Join Date
    Nov 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    like it! keep it up

  7. #32
    Join Date
    Jan 2007
    Location
    Nomming bits in your RAM
    Posts
    385
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry for the gravedig. >.<

    I don't know a ton about SCAR, but when you initialize arrays in some other languages, space is allocated for every index at that point. So, assuming that SCAR works the same way, would the following procedure in \SRL\Core\Players.Scar be slowing the programs down a small amount, or just using a bit [not the binary kind. :P] of extra RAM?
    SCAR Code:
    procedure NumberOfPlayers(Number: Integer);
    var
       I: Integer;
    begin
      SetLength(Players, Number);
      HowManyPlayers := Number;
      for I := 0 to HowManyPlayers - 1 do
      begin
        SetLength(Players[i].Strings, 100);
        SetLength(Players[i].Integers, 100);
        SetLength(Players[i].Booleans, 100);
        SetLength(Players[i].Extendeds, 100);
      end;
    end;

    And a possible fix would be to manually shrink the size of each array for every player to the size you use?

    Of course, this is all [probably incoherent] speculation based on what I know from other languages. XD

    ~Macro_FTW
    Current Project: Catching up. XD. Potentially back for the summer, depending on how things go.

  8. #33
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Macro_FTW View Post
    Sorry for the gravedig. >.<
    Can't gravedig a tutorial

    I just have to say that now im amazed of what computers can do.

    SCAR Code:
    program New;
    const
      a = 987893126548795462164918163723191846461918743673191845421610891543272456484154234948454324856177159987987987987987977987977987987987987987987987987987987987987987987987198719187178919871879879;
    var
      i, t, b: integer;
    begin
      wait(1000);
      t := GetSystemTime;
      for i := 0 to 1000000 do
        b := a shl 946481619784614919817136516651465165116516541564154415415316494981619581654165416541654165413431261948736431915243246191451452914261429142914291429142941921429142941924192419241929219241924192;
      writeln('Done in '+inttostr(GetSystemTime - t)+' ms');
    end.
    this is calculated in the same time as

    SCAR Code:
    program New;
    const
      a = 5;
      i, t, b: integer;
    begin
      wait(1000);
      t := GetSystemTime;
      for i := 0 to 1000000 do
        b := a shl 3;
      writeln('Done in '+inttostr(GetSystemTime - t)+' ms');
    end.
    (both took around 1600ms)

    i also noticed that (a shl 2) and (a*4) are done in the same time, which means that shifting is not actually necessary in simple scripts.

  9. #34
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Yeah, I am impressed too! Think about when we are like 70 years old we will be telling our grandchildren about our 3.20 GHz dual cores witch were amazingly fast

  10. #35
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That's if you have grandchildren, or live with your mom your whole life

    SCAR Code:
    a = 987893126548795462164918163723191846461918743673191845421610891543272456484154234948454324856177159987987987987987977987977987987987987987987987987987987987987987987987198719187178919871879879;

    How is that the same as a := 10?
    Last edited by Smarter Child; 07-20-2009 at 03:29 AM.

  11. #36
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Smarter Child View Post
    That's if you have grandchildren, or live with your mom your whole life

    SCAR Code:
    a = 987893126548795462164918163723191846461918743673191845421610891543272456484154234948454324856177159987987987987987977987977987987987987987987987987987987987987987987987198719187178919871879879;

    How is that the same as a := 10?
    i meant that the calculations were made in the same time with a=987blahblah and a=5. Calculation with the big numbers and the small number both took around 1600ms.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Function coding help please :)
    By Kosaki in forum OSR Help
    Replies: 3
    Last Post: 01-04-2008, 04:00 PM
  2. Logic and Efficiency
    By munk in forum OSR Outdated Tutorials
    Replies: 6
    Last Post: 11-17-2007, 12:32 AM
  3. Need some help with coding
    By pomme in forum OSR Help
    Replies: 2
    Last Post: 10-09-2007, 01:17 PM

Posting Permissions

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