Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: How to use SRL's Random Tool in a script

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default How to use SRL's Random Tool in a script

    SRL's Random Tool
    ____________________________




    What is SRL's Random Tool?
    It's a pretty neat tool. It notifies (optionally plays a sound) the user when SRL has detected a random event, and gives them the option to have SRL solve the random, or solve it manually.

    SRL's Random Tool source code can be found here, or in SRL/SRL/core/antirandoms/randomtool.simba.


    How to add SRL's Random Tool to a script:
    Very, very simple. Just call SetupRandomTool(timeOutWait, FKeyFinish: integer; soundPath: string); sometime after SetupSRL() and DeclarePlayers().
    • timeOutWait: How long to wait (in milliseconds) before closing the Random Tool form and having SRL solve the random.
    • FKeyFinish: The F key that is pressed when the user has finished manually solving the random.
    • soundPath: The path to the sound file to be played when a random event is detected.
    For example,
    Simba Code:
    setupRandomTool(10000, 5, 'C:/Simba/randomSound.wav');


    Additional options:
    Since not all users will want to take advantage of this feature, I recommend giving them the option. Using a simple constant or variable boolean statement will work nicely.

    Example (just copy/paste into Simba if you want to test):
    Simba Code:
    program test_RandomTool;
    {$i srl\srl.simba}

    procedure declarePlayers;
    begin
      howManyPlayers := 1;
      numberOfPlayers(howManyPlayers);
      currentPlayer := 0;

      with players[0] do
      begin
        name := 'Coh3n';
        pass := 'myPassword1234';
        active := true;
      end;
    end;

    begin
      clearDebug();
      activateClient();

      setupSRL();
      declarePlayers();
      setupRandomTool(25000, 5, '');

      RT_Execute();
    end.


    Conclusion:
    If you have any questions, suggestions, or comments, please post here.

    Cheers,
    Coh3n

  2. #2
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Ah good idea! Should prove to be a very useful tut.

  3. #3
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  4. #4
    Join Date
    Apr 2007
    Location
    Los Angeles
    Posts
    622
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Ahah, what a 'Cute' tool =P love it!

  5. #5
    Join Date
    Aug 2006
    Posts
    338
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    love it! what randoms will it be able to solve?

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    It's not the tool that solves the randoms, it's SRL. The status of each solver can be found here.

  7. #7
    Join Date
    Aug 2006
    Posts
    338
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i added to script, and it compiled and worked good, but i didnt see any popup like on the picture that ask me how i want to solve random. this is where it is:

    Code:
    begin
      Smart_Members := False;
      Smart_Server := 0;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      setupRandomTool(25000, 5, '');

  8. #8
    Join Date
    Oct 2011
    Posts
    434
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    :O Really useful, added it in the script im running atm and it works perfectly! I love it. Thank you very much Coh3n for this ^^
    Last edited by alexes; 03-22-2012 at 01:21 PM.

  9. #9
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by zamserv View Post
    i added to script, and it compiled and worked good, but i didnt see any popup like on the picture that ask me how i want to solve random. this is where it is:

    Code:
    begin
      Smart_Members := False;
      Smart_Server := 0;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      setupRandomTool(25000, 5, '');
    You still have to call FindNormalRandoms, otherwise it doesn't know when to pop up.

  10. #10
    Join Date
    Mar 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i find it dificult ^^

  11. #11
    Join Date
    Oct 2011
    Posts
    192
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Woah, awesome! I'll surely implement this in my future scripts. Thanks.

  12. #12
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by brit ftw View Post
    i find it dificult ^^
    To do what exactly? FindNormalRandoms?

    You simply write it in at the start of a function....

  13. #13
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great idea! I'll try and add this to my upcoming script

  14. #14
    Join Date
    Dec 2011
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is really nice..Using it right now in a script I just wrote, works beautifully and pops up to tell me, which is quite nice when running multiple scripts..

    Any plans to further the notification system? I'd really love to see this be able to send an email to a specified address.

  15. #15
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by fJX View Post
    This is really nice..Using it right now in a script I just wrote, works beautifully and pops up to tell me, which is quite nice when running multiple scripts..

    Any plans to further the notification system? I'd really love to see this be able to send an email to a specified address.
    If Simba ever gets a SendEmail method, I'd be happy to add it to this tool, but until then, don't count on it.

  16. #16
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Pretty nice, this what I was looking for!

  17. #17
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by fJX View Post
    Any plans to further the notification system? I'd really love to see this be able to send an email to a specified address.
    Why on earth would you want that?

    OT: Looks very nice, will definitely be using

  18. #18
    Join Date
    Nov 2011
    Location
    Louisiana
    Posts
    881
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Why on earth would you want that?

    OT: Looks very nice, will definitely be using
    What do you mean? So you would know if you got a random if you weren't babysitting your script. That's why.

  19. #19
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Does it use the random sound from Simba\Includes\MSI\MSI\RandomSound.wav ?

    or should I copy that (& potentially rename) and place it into an appropriate file?


    Edit: nevermind, just saw OP:
    Code:
    setupRandomTool(10000, 5, 'C:/Simba/randomSound.wav');
    Edit 2: Do I need to worry about RT_Execute(); as shown in your OP mainloop?
    Last edited by Le Jingle; 04-28-2012 at 08:31 PM.

  20. #20
    Join Date
    May 2012
    Location
    My house
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for posting

  21. #21
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Ok so basically this found a random and I decided to solve it myself.

    Went back to the script to see what 'f' key I had entered to resume scripting - I put 5.

    However, after pressing f5 multiple times, my script would not resume.

  22. #22
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Ok so basically this found a random and I decided to solve it myself.

    Went back to the script to see what 'f' key I had entered to resume scripting - I put 5.

    However, after pressing f5 multiple times, my script would not resume.
    The exact same thing happened to me just now. Had to restart script.

  23. #23
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by litoris View Post
    The exact same thing happened to me just now. Had to restart script.
    Happened again today. Any way to actually make the script resume?

  24. #24
    Join Date
    Nov 2011
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea got the same problem script didnt start and solve random with the exp book was spamming the cmd ...


    is there a simple to code that just plays a sound on random without the tool ?

  25. #25
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by lays View Post
    yea got the same problem script didnt start and solve random with the exp book was spamming the cmd ...


    is there a simple to code that just plays a sound on random without the tool ?
    You can do that yourself:
    Simba Code:
    if FindNormalRandoms then
      PlaySound('file path for sound');

Page 1 of 2 12 LastLast

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
  •