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

Thread: [Outdated]DeclarePlayers with SRL's Playerform

  1. #1
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default [Outdated]DeclarePlayers with SRL's Playerform

    One of the many new functions that SRL 4 has to offer is SRLPlayerForm();

    It sets, loads, saves your players all in a form. Using it is a piece of cake.

    First a list of possibilities :
    • Right click menu on tabs
    • Ability to use Armies
    • Can switch Players by holding Ctrl and drag the tab
    • Can add a variable amount of extra options and give the options unique names.


    Then the picture :



    Thats all i can think of at the moment.

    Basically all you need to run it is this :

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    begin
      SetupSRL;
      SRLPlayerForm(True, [], [], [], []);
    end.

    Running that will give you the default player form with no extra settings.

    Extra settings :

    The '[]' parameters in the function stand for extra settings. '[]' in scar means an array, in this case we are using an array of strings (TStringArray).

    In order of appearance this is what the TStringArray's stand for :

    • Booleans
    • Integers
    • Strings
    • Extendeds


    So lets say we want to add an Integer, the function would then be called like this :

    SCAR Code:
    SRLPlayerForm(True, [], [''], [], []);

    Lets say we want to add 3 booleans, 1 integer, 4 strings and 2 extendeds :

    SCAR Code:
    SRLPlayerForm(True, ['', '', ''], [''], ['', '', '', ''], ['', '']);

    When you leave the name of an extra settings blanc ( '' ) it will name it ie. Integer[0]. When you use 'IntTest' it will ask IntTest.

    SCAR Code:
    SRLPlayerForm(True, [''], ['', ''], [], []);

    will ask :

    • Boolean[0]
    • Integer[0]
    • Integer[1]


    SCAR Code:
    SRLPlayerForm(True, ['BoolTest'], ['IntTest', 'IntTest2'], [], []);

    will ask :

    • Booltest
    • IntTest
    • IntTest2


    However note that even though the form might ask Booltest the script will know it as Boolean[0]. Same thing goes for the other settings.

    It could be used like this for example :

    SCAR Code:
    SRLPlayerForm(True, ['Pick Equip?', 'Withdraw New Picks?'], ['Nr of Trips'], ['Rock Name to Mine', 'Bank to bank at'], []);

    The parameter where i used True is if you want it to show the form or just load the players. True obviously mean show, false means just load nothing else.

    Another great feature of the player form is the ability to import and export players from and to the "DeclarePlayers" Procedure, found in the "File" drop down menu

    Basically, if you open a script with the procedure "DeclarePlayers" in it all properly filled out, it will parse them into the form for you, and saves you the trouble of having to do it yourself.

    Furthermore, if you fill in all of your players in the form and want to put them into the DeclarePlayers format, select your army, and hit the export button. The full DeclarePlayers procedure will be automatically generated for you.

    Please note: Importing player data may not always work as the script has to scripted with perfect standards for it to work, I.E:

    PHP Code:
    Players[0].name := 'Starblaster100'
    Space between 'name' and ':=' and ':=' and the String / Number / Bool / Extended

    Anything i missed ?
    Administrator's Warning:


  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice thanks to hear
    ~Hermen

  3. #3
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Woah sweet! I'm gonna check this out!

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks,

    i stickied it, if any mod / admin thinks it shouldn't be, be my guest to unsticky it but in my opinion its pretty usefull to read through.
    Administrator's Warning:


  5. #5
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sumilion View Post
    Thanks,

    i stickied it, if any mod / admin thinks it shouldn't be, be my guest to unsticky it but in my opinion its pretty usefull to read through.
    Thats a lot of coding, well done!
    Verrekte Koekwous

  6. #6
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    I gotta say, Sum as done an amazing job with the new player form: so easy to use with such flexibility is rarely ever seen.

    I encourage lots of people to use this; it would be a shame to see it go to waste

    To Sumilion: You missed importing and exporting players, here is the code you can add:

    Another great feature of the player form is the ability to import and export players from and to the "DeclarePlayers" Procedure, found in the "File" drop down menu

    Basically, if you open a script with the procedure "DeclarePlayers" in it all properly filled out, it will parse them into the form for you, and saves you the trouble of having to do it yourself.

    Furthermore, if you fill in all of your players in the form and want to put them into the DeclarePlayers format, select your army, and hit the export button. The full DeclarePlayers procedure will be automatically generated for you.

    Please note: Importing player data may not always work as the script has to scripted with perfect standards for it to work, I.E:

    PHP Code:
    Players[0].name := 'Starblaster100'
    Space between 'name' and ':=' and ':=' and the String / Number / Bool / Extended
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  7. #7
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Starblaster100 View Post
    I gotta say, Sum as done an amazing job with the new player form: so easy to use with such flexibility is rarely ever seen.

    I encourage lots of people to use this; it would be a shame to see it go to waste
    Thanks a lot star and i added your part now.
    Administrator's Warning:


  8. #8
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    [Runtime Error] : Out Of Range in line 536 in script C:\Program Files\SCAR 3.11\includes\SRL\SRL\Core\Users.scar
    Help is greatly appreciated.

  9. #9
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Erhm...
    Code:
    536 = {*******************************************************************************
    for me...

    What were you doing ?
    Administrator's Warning:


  10. #10
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Line 536 for me:
    SCAR Code:
    PlayerPages[TabNumber] := TTabSheet.Create(srl_PlayerForm);

    I was just copying and pasting the parameters and such that you used in the above tutorial, wanting to see how it worked. I have called SetupSRL also, is there anything else i need to call?

  11. #11
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe you don't have latest SRL perhaps? Or devs have different version of SRL?

  12. #12
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nevermind guys, got it.

  13. #13
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Were you perhaps using SRL 4 beta ?
    Administrator's Warning:


  14. #14
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No, i think i was using rev #3 of SRL 4..

  15. #15
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    This is truly a great piece of scripting, I'm going to use it in all of my scripts now most likely. Good work sumilion. Where are the settings for your players and army details stored though?

  16. #16
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Scar > Chars.ini
    Administrator's Warning:


  17. #17
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Thank you!!

    Since 4 Beta I was always wondering how do I set it up, even though I maybe could've read through the code, but very good tut 5/5!

  18. #18
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    Few suggestions:

    - Add Players.Loc to the default form
    - A few buttons along the side to press instead of going to Exit > Save or whatever
    - Maybe the possibility to have default options in the boxes - so we could go ['Location - Bank'] and it would add it to Location, with the default as Bank.


  19. #19
    Join Date
    May 2008
    Location
    Australia
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks very much, Sum! I'm going to use this a lot.

    @The Claw: That 3rd one is an awesome idea! (Chants at Devs "WE WANT DEFAULTS IN THE SRL PLAYERFORM!")

    EDIT: Sorry for the bump but I give thanks where thanks are due!
    Freedom is the freedom to say two plus two equals four. If that is granted, all else follows.
    - George Orwell, Nineteen Eighty-Four

  20. #20
    Join Date
    Dec 2006
    Location
    UK
    Posts
    118
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I would like to point out the in SRL 4 Rev 20 the SRLPlayerForm(); functions is in the /misc/user.scar file which need to be added in the includes.

    ScarScript:By Drunkenoldma
    {.include SRL/SRL/Misc/users.scar}

  21. #21
    Join Date
    Jul 2008
    Posts
    907
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah i always use this because its a lot easier than making people set up their players and somebody whos never used scar before who just wants to hack people wouldn't be able to run it so it adds a tad more security


  22. #22
    Join Date
    Dec 2007
    Location
    Los Angeles, California
    Posts
    606
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by the nerd View Post
    I would like to point out the in SRL 4 Rev 20 the SRLPlayerForm(); functions is in the /misc/user.scar file which need to be added in the includes.

    ScarScript:By Drunkenoldma
    {.include SRL/SRL/Misc/users.scar}

    Thanks i was wondering what was going on, once i'm done adding it to my script i'll say how it went or if i need help.

    EDIT:

    How do i know the difference between booleans, integers, strings, and extendeds?

  23. #23
    Join Date
    Jul 2007
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesome. I'm going to use this in every script i make :P

  24. #24
    Join Date
    May 2008
    Location
    Oregon, USA
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    kinda understand...

  25. #25
    Join Date
    Oct 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice gonna use this in every script from now on

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)

Similar Threads

  1. DeclarePlayers
    By HairyDuncan2 in forum OSR Help
    Replies: 5
    Last Post: 09-03-2007, 03:17 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
  •