Results 1 to 21 of 21

Thread: How to not leave you pass in a script/Srl Player Form tut

  1. #1
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to not leave you pass in a script/Srl Player Form tut

    In this Tutorial I will teach you how to use SrlPlayerForm,
    but first I am going to tell you about multi player and teach
    you the advantages to SrlPlayerForm.

    The types of Multi Player
    1. Normal Array Type

    SCAR Code:
    HowManyPlayers := 4;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name :='d4nger r4nga';
      Players[0].Pass :='sunny';
      Players[0].Nick :='d4n'; //3-4 letters from name
      Players[0].Active:= True;
      Players[0].Booleans[1]:= True; // True if new rocks. False if old. (new rocks have veins)
      Players[0].Booleans[2]:= true; // Pick equipped?
      Players[0].Strings[1]:= 'iron'; // type of ore
      Players[0].Integers[1]:=1000; // # of loads

      Players[1].Name :='d4nger r4nga';
      Players[1].Pass :='sunny';
      Players[1].Nick :='d4n'; //3-4 letters from name
      Players[1].Active:= True;
      Players[1].Booleans[1]:= True; // True if new rocks. False if old.
      Players[1].Booleans[2]:= true; // Pick equipped?
      Players[1].Strings[1]:= 'iron'; // type of ore
      Players[1].Integers[1]:=100; // # of loads

      Players[2].Name :='';
      Players[2].Pass :='';
      Players[2].Nick :='pc'; //3-4 letters from name
      Players[2].Active:= false;
      Players[2].Booleans[1]:= True; // True if new rocks. False if old.
      Players[2].Booleans[2]:= true; // Pick equipped?
      Players[2].Strings[1]:= 'tin'; // type of ore
      Players[2].Integers[1]:=100; // # of loads

      Players[3].Name :='';
      Players[3].Pass :='';
      Players[3].Nick :='d4n'; //3-4 letters from name
      Players[3].Active:= false;
      Players[3].Booleans[1]:= True; // True if new rocks. False if old.
      Players[3].Booleans[2]:= true; // Pick equipped?
      Players[3].Strings[1]:= 'coal'; // type of ore
      Players[3].Integers[1]:=100; // # of loads

    Advantages

    Allows Muliplayer


    Disadvatages


    Security When posting scripts you leave your pass in the Script.(I have done on purpose it is a banned account)

    Fidgety is rather hard to setup a you have to type a lot.

    Messy there is a lot of code and if not all of the slot are used it has to be commented out.

    Next SrlPlayerForm

    Disadvantages

    None

    Adantages

    Neat only one line of code

    Easy once you know how to use it take seconds to setup

    Speed if you are using you can save you players details so you dont have to type in again

    Security you canot upload a script that contains you pass

    and more

    Now to the fun bits


    SrlPlayerForm and how to use.

    First you must declare Srl using,
    SCAR Code:
    {.include srl/srl.scar}

    To use SrlPlayerForm you must first declare its include.
    This is declared with,
    SCAR Code:
    {.include srl/srl/misc/users.scar}

    Next you must call SrlPlayerForm using,
    SCAR Code:
    SRLPlayerForm(True, [], [], [], []);

    If you are following in scar you should now have a script that looks like this.

    SCAR Code:
    program New;
    {.include srl/srl.scar}
    {.include srl/srl/misc/users.scar}
    begin
      SRLPlayerForm(True, [], [], [], []);
    end.

    Thats it done for creating a the form if you run it you have fields in which you can enter your username, password, nickname and whether the char is active.

    So if thats it done what are the brackets

    The brackets are where you can enter your own custom fields
    there is a simple rule to entering your own fields and that is,
    BISE
    BISE stands for BOOLEAN, INTEGER, STRING, EXTENDED.

    Say you want to allow the user to input his bank pin as a string you would use
    SCAR Code:
    SRLPlayerForm(True, [B], [I], [S], [E]);
    as the bank pin is a string it would be
    SCAR Code:
    SRLPlayerForm(True, [], [], ['Bank Pin'], []);
    What you put inside the square brackets is the label that will be given to the field
    as they are entered as an array you can enter more than one field and seperate them with a comma, eg
    SCAR Code:
    SRLPlayerForm(True, [], [], ['Bank Pin', 'Ore Type'], []);

    The same rule applies whether your using booleans integers strings or extended variable types.

    How to use.
    To use custom fields you call them using:
    SCAR Code:
    Players[Player].Data type[position in array]
    where [Player] is the player you want to find which is an integer to lookup a specific players details, or you can use [CurrentPlayer] to lookup the currently active players details

    Datatype is the data type of the field you want to look up (BISE) eg Integer

    [Position in array] The position of the field you want to read.

    Example.

    If we used
    SCAR Code:
    SRLPlayerForm(True, [], ['Loads'], ['Ore Type'], []);
    to use how many loads you want the active player to mine, you would use
    SCAR Code:
    players[currentplayer].Integers[0];
    when you set the type you use integerS booleanS etc. You add an S to the end.
    Remember that it is an array so the first place is 0
    If you had
    SCAR Code:
    SRLPlayerForm(True, [], ['wait time','Loads'], ['Ore Type'], []);
    then [0] would be Wait time and [1] would be loads.




    To simplify

    3 steps

    1. Call the includes

    SCAR Code:
    {.include srl/srl.scar}
    {.include srl/srl/misc/users.scar}

    2. Set up the form
    SCAR Code:
    SRLPlayerForm(True, ['bank','multiplayer'], ['Loads', 'Time Between Clicks','minutes to sleep'], ['Ore Type', 'srl ID', 'srl pass'], []);


    3. Call/Use the Data

    SCAR Code:
    paws:=(players[currentplayer].Integers[1]*1000);

      if(invents = Players[CurrentPlayer].Integers[0]) then
    Last edited by BraK; 12-06-2010 at 06:49 PM. Reason: Correcting Grammar

  2. #2
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    reserved for sumit duno what yet tho =] but you never know.

    Edit:If any of you admins or mods notice any speling mistakes or grammar mistakes could you corect them if you have nothing better to do ty.
    Blank!

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

    Default

    There is already a tutorial on this, yours is still good though

    Sumillion did one.

    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
    Nov 2007
    Location
    The Netherlands
    Posts
    1,490
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea there is one already.
    But this one is easier to understand IMO
    great tut waddo
    rep++

  5. #5
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ty i made it so it was easy to understand and also so it would attract more attention to the newcomers hense it is in beginner tut's as we dont want newcomers losing their acounts and us getting a bad rep =]
    Blank!

  6. #6
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    wouldnt it be easiest to save your usernames and passwords to an ini file and get it from that? Then you'll always have it. Just save it in your scripts folder, make yourself a neat little function for getting all of the info(saved into srl, or the script its in) and add it into the main proc of the scripts you use. Easy-peasy
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  7. #7
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    2 b honest that sounds 10000000 times more complicated

    lol
    especially if you want variables =] this also teaches SrlPF
    Blank!

  8. #8
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    this is a pretty good tut, I already understood it, except for one thing, which I never saw covered yet, not only by you but nay tut, extended. What is extended used for and does it hold numbers, words, or true/false also? or something else different? probably something different because you could just you integers, strings, or booleans for what I said, I don't see why they would make extended to be the same as one of them. So what does this "extended" do exactly?

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

    Default

    Extendeds are any number with a decimal. Example:

    2 <- Integer.

    2.0 <- Extended.

    Hope that clarifies!

    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

  10. #10
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    oooohhh, thanks so much Nava2, now that you said it I think I saw it once or twice before, guess I just didn't see it enough to stick in my head. Because Integers are whole numbers, so if you need any other number (not whole) you would have to use extended, yea I get it, unless what I just sai is wrong lol. But thanks, rep+.

  11. #11
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yer an extended or in pascal a real data type is a number which is not whole

    the word integer means whole number
    Blank!

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

    Default

    Good Tut, I'll add multiplayer to my up and coming first power chopper. ^.^

  13. #13
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    no problem
    Blank!

  14. #14
    Join Date
    Aug 2007
    Posts
    0
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    VERY NICE! I didn't even know about this until now!

  15. #15
    Join Date
    Jun 2007
    Location
    south park
    Posts
    1,160
    Mentioned
    0 Post(s)
    Quoted
    62 Post(s)

    Default

    i left my password in the other day and my account got stolen..
    http://www.youtube.com/user/YoHoJoSRL
    Good scripting guides on youtube
    Formerly known as (djcheater)

  16. #16
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i know but atleast you got account back did you lose anything

    well now you know this so you can use this in future
    Blank!

  17. #17
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Nicely Writen Tutorial if a little old. Still hold relevance hope some of you inspiring Script Writers get something from this. Thanks Waddo for writing it. Edited to fixed some of the Grammar mistakes.

    ~BraK
    Last edited by BraK; 12-06-2010 at 06:50 PM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

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

    Default

    It's broken now, and has been for a long time

  19. #19
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Maybe this will inspire someone to fix it.

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

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

    Default

    Hopefully

  21. #21
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Hopefully
    I might even take a stab at it when I go fly home to my family tomorrow. It'll give me something to do on the 9+ hour flight and my layover. My wife also told my not to worry about finishing this section to fast as we have a good internet connection there now. So I won't be completely gone from the forums.

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Player Form Help
    By steth1010 in forum OSR Help
    Replies: 4
    Last Post: 04-20-2007, 11:42 PM
  2. Help with Player Form
    By antknee3 in forum OSR Help
    Replies: 2
    Last Post: 04-03-2007, 05:18 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
  •