Results 1 to 7 of 7

Thread: RandomWorld Function!

  1. #1
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default RandomWorld Function!

    This can be used in a multitude of ways.

    The primary use it so open a random world in SMART. Simply put it in the SetupSMARTEx and run the script.

    ANOTHER way to use it is when you are running SRL's World Switcher. Include it the same way as the smart and it works

    Here is the code, short simple, and to the point .

    SCAR Code:
    (*=====================================================================)
     |  function RandomWorld(Free: Boolean): Integer;                     |
     |  By: Nava2                                                         |
     |  Instructions: Set 'Free' parameter to which ever type of world    |
     |        that you would like. Simple!                                |
    (=====================================================================*)


    function RandomWorld(Free: Boolean): integer;

    var

      s, w: string;
      i: integer;
     
    begin
      i := Random(163) + 1;
      if Free then
        w := 'Free'
      else
        w := 'Members';
      repeat
        Inc(i);
        if i = 164 then
          i := 1;
      until (ReadINI('World' + IntToStr(i), 'Type', AppPath + 'Includes\SRL\SCSS\Worlds.INI') = w);
      s := GetNumbers(ReadINI('World' + IntToStr(i), 'Prefix', AppPath + 'Includes\SRL\SCSS\Worlds.INI'));
      Result := StrToInt(s);
      Writeln('Your Randomly chosen ' + w + ' world is ' + s + '.');
    end;

    Also here are the examples I was talking about.

    SMART:

    SCAR Code:
    procedure SetupSmart;
    begin
      if not UseSMART then EXIT;
      Writeln('Setting up SMART');
      SmartSetupEx(RandomWorld(False), true, True, false);
      wait(5000);
      SetTargetDC(SmartGetDC);
      repeat
        wait(100);
      until(SmartGetColor(253, 233)<>1118604);
    end;

    In a world changing procedure:

    SCAR Code:
    procedure ChangeWorld;
    begin
      LogOut;
      Wait(10000+random(5000));
      SelectWorld(RandomWorld(True));
      Wait(5000+random(2500));
      LoginPlayer;
    end;

    Rate, Hate, Masturbate?

    Post comments and suggestions please!

    If you are using CREDIT!

    ~Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  2. #2
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I just did one like 3 weeks ago...
    Looks nice

    Edit, Yours is Random numbers before Smart loads xD Mine is after smart loads

    Still nice

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by N1ke! View Post
    I just did one like 3 weeks ago...
    Looks nice

    Edit, Yours is Random numbers before Smart loads xD Mine is after smart loads

    Still nice
    That confused me.

    So yours changes worlds once smart loads?

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    May 2008
    Posts
    203
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    You can change words at the login screen, remember? I have a function that changes the world randomly via the login screen for my script.

  5. #5
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    This function just chooses a random free or members world. It returns an integer, you use it in a world switching function.

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  6. #6
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    I always preferred mine which chose a random one of the top 10 least populated worlds (it fell through the cracks in here), but otherwise not to bad.
    Also, you can shorten it by setting a string variable to free or members based on the boolean then just have it check against that rather than have 2 loops that do the same thing only with a different check.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by mixster View Post
    I always preferred mine which chose a random one of the top 10 least populated worlds (it fell through the cracks in here), but otherwise not to bad.
    Also, you can shorten it by setting a string variable to free or members based on the boolean then just have it check against that rather than have 2 loops that do the same thing only with a different check.
    I knew there was a way to shorten it!!

    Thanks!

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 02-27-2008, 05:20 PM
  2. Replies: 2
    Last Post: 02-26-2008, 08:26 PM
  3. [FUNCTION] FindDoorColour: integer; By ZephyrsFury [FUNCTION]
    By ZephyrsFury in forum Research & Development Lounge
    Replies: 10
    Last Post: 07-27-2007, 08: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
  •