Results 1 to 12 of 12

Thread: procedure SetPlayer

  1. #1
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default procedure SetPlayer

    SCAR Code:
    procedure SetPlayer(name, pass, nick : string; active : boolean; bools : array of boolean; integers : array of integer; strings : array of string; Extendeds : array of extended);
    var
      i : integer;
    begin
      HowManyPlayers := GetArrayLength(Players) + 1;
      NumberOfPlayers(HowManyPlayers);
      Players[GetArrayLength(Players) - 1].Name := name;
      Players[GetArrayLength(Players) - 1].Pass := pass;
      Players[GetArrayLength(Players) - 1].Nick := nick;
      Players[GetArrayLength(Players) - 1].Active := active;
      for i := 0 to GetArrayLength(bools) - 1 do Players[GetArrayLength(Players) - 1].Booleans[i] := bools[i];
      i := 0;
      for i := 0 to GetArrayLength(integers) - 1 do Players[GetArrayLength(Players) - 1].Integers[i] := integers[i];
      i := 0;
      for i := 0 to GetArrayLength(strings) - 1 do Players[GetArrayLength(Players) - 1].Strings[i] := Strings[i];
      i := 0;
      for i := 0 to GetArrayLength(Extendeds) - 1 do Players[GetArrayLength(Players) - 1].Extendeds[i] := Extendeds[i];
      i := 0;
    end;

    Sets a player with one procedure.

    Used like so
    SCAR Code:
    SetPlayer('username', 'password', 'ser', true, [true, false], [1, 2, 3], ['a', 'b', 'c'], [0.1, 0.2, 0.3]);

    You don't need to call NumberOfPlayers anymore either. It does that automatically.
    However, you do need to call CurrentPlayer := whatever.

    Enjoy .

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    i don't actually see the use to this? it's nice coding and all, but calling it the way you did actually makes it harder cus you're not really sure where u're setting bools, strings, ints, extendeds... etc.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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

    Default

    I think the normal declare players procedure is quite a bit more user-friendly

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    DeclarePlayers is not a procedure that is already in SRL. It is just a common name most scripters give their procedure that sets up the players. And yea true it is more user friendly to people that are leechers or don't know how to script well.

    It's like the SRL Player Form RM except without the form and armies and stuff like that .

    It's basically easier for me because it's one line. When I use it in my script there will be an explanation on how to set it up using this procedure. When scripters are writing up their script(s') declare player procedure(s) then they can just put this procedure there and tell people to set the players up using that. It's so you don't have to type all the lines like Players[0].Name... and stuff like that.

  5. #5
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    DeclarePlayers is not a procedure that is already in SRL. It is just a common name most scripters give their procedure that sets up the players. And yea true it is more user friendly to people that are leechers or don't know how to script well.

    It's like the SRL Player Form RM except without the form and armies and stuff like that .

    It's basically easier for me because it's one line. When I use it in my script there will be an explanation on how to set it up using this procedure. When scripters are writing up their script(s') declare player procedure(s) then they can just put this procedure there and tell people to set the players up using that. It's so you don't have to type all the lines like Players[0].Name... and stuff like that.
    I'm pretty sure that all scripters use DeclarePlayers(If they don't use a form) but that doesn't mean they don't know how to script well. What if you have multiple integers for a script, how will you set which one to look for? It's just an array, it will look for all of those in the array. Also, there is no good way to do CurrentPlayer. DeclarePlayers is better than your function. It's nice, but not needed.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, of course it's not needed. And I didn't say they don't know how to script well? If you have multiple integers in a script you do if Players[0].Integers[?] = 5 (or w/e) then ...

    It dosen't act any different.

  7. #7
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    But how do you do it with yours? Because if you have a 5 for a certain integer and a 6 for another, that will confuse it and your script will not work.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  8. #8
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

    procedure SetPlayer(name, pass, nick : string; active : boolean; bools : array of boolean; integers : array of integer; strings : array of string; Extendeds : array of extended);
    var
      i : integer;
    begin
      HowManyPlayers := GetArrayLength(Players) + 1;
      NumberOfPlayers(HowManyPlayers);
      Players[GetArrayLength(Players) - 1].Name := name;
      Players[GetArrayLength(Players) - 1].Pass := pass;
      Players[GetArrayLength(Players) - 1].Nick := nick;
      Players[GetArrayLength(Players) - 1].Active := active;
      for i := 0 to GetArrayLength(bools) - 1 do Players[GetArrayLength(Players) - 1].Booleans[i] := bools[i];
      i := 0;
      for i := 0 to GetArrayLength(integers) - 1 do Players[GetArrayLength(Players) - 1].Integers[i] := integers[i];
      i := 0;
      for i := 0 to GetArrayLength(strings) - 1 do Players[GetArrayLength(Players) - 1].Strings[i] := Strings[i];
      i := 0;
      for i := 0 to GetArrayLength(Extendeds) - 1 do Players[GetArrayLength(Players) - 1].Extendeds[i] := Extendeds[i];
      i := 0;
     
      Writeln('Player "' + name + '" added.');
    end;

    procedure DeclarePlayers;
    begin
      SetPlayer('player1', 'password1', 'lay', true, [true], [5, 6], [], []);
      SetPlayer('player2', 'password2', 'lay', true, [false], [1, 2], [], []);
      CurrentPlayer := 0;
    end;

    procedure WritePlayers;
    var
      i, ii : integer;
    begin
      ClearDebug;
      for i := 0 to High(Players) do
      begin
        Writeln('Player ' + IntToStr(i) + ' name: ' + Players[i].Name);
        Writeln('Player ' + IntToStr(i) + ' pass: ' + Players[i].Pass);
        Writeln('Player ' + IntToStr(i) + ' nick: ' + Players[i].Nick);
        Writeln('Player ' + IntToStr(i) + ' active: ' + BoolToStr(Players[i].Active));
        Writeln('Player ' + IntToStr(i) + ' integers[0]: ' + IntToStr(Players[i].Integers[0]));
        Writeln('Player ' + IntToStr(i) + ' integers[1]: ' + IntToStr(Players[i].Integers[1]));
    end;
     
     
    end;

    begin
    DeclarePlayers;
    WritePlayers;
    end.

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

    Default

    Quote Originally Posted by Da 0wner View Post
    DeclarePlayers is not a procedure that is already in SRL. It is just a common name most scripters give their procedure that sets up the players. And yea true it is more user friendly to people that are leechers or don't know how to script well.

    It's like the SRL Player Form RM except without the form and armies and stuff like that .

    It's basically easier for me because it's one line. When I use it in my script there will be an explanation on how to set it up using this procedure. When scripters are writing up their script(s') declare player procedure(s) then they can just put this procedure there and tell people to set the players up using that. It's so you don't have to type all the lines like Players[0].Name... and stuff like that.
    Dude, i know what declareplayers is -.-
    Everyone use it because the normal method is understandable.
    That's like i'd say "people use Inc(x) cause they dont know how to use
    x:=x+exp(logn(e, 1))"

  10. #10
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I know this is just shorter for the scripter. It may not be more understandable but it is easier for the scripter.

  11. #11
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    SCAR Code:
    procedure DeclarePlayers;
    begin
      SetPlayer('player1', 'password1', 'lay', true, [true], [5, 6], [], []);
      SetPlayer('player2', 'password2', 'lay', true, [false], [1, 2], [], []);
      CurrentPlayer := 0;
    end;
    Which one is 0? Wouldn't it have to be 0 := SetPlayer(blah)? You haven't declared which player is which.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  12. #12
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It does that automatically.
    Player 1 would be Players[0] and Player 2 would be Players[1].

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Procedure Help...
    By impiwimpi in forum OSR Help
    Replies: 16
    Last Post: 01-08-2009, 06:20 PM
  2. Procedure TypeSendRandom & Procedure AutoResponder!
    By Ultra in forum Research & Development Lounge
    Replies: 12
    Last Post: 01-08-2008, 07:04 PM
  3. Replies: 8
    Last Post: 05-24-2007, 11:57 PM
  4. Procedure that calls random procedure?
    By Secet in forum OSR Help
    Replies: 2
    Last Post: 03-03-2007, 03:56 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
  •