Results 1 to 15 of 15

Thread: declareplayers "Player[∞]" unlimited

  1. #1
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Exclamation declareplayers "Player[∞]" unlimited

    This is the declareplayers procedure :
    SCAR Code:
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := Username;
      Players[0].Pass := Password;
      Players[0].Nick := '';
      Players[0].Active := True;
    end;

    This is how my form gets the username\password
    SCAR Code:
    Username := UserEdit.Text;
      Password := PassEdit.Text;

    (heres my whole form, if it helps)
    SCAR Code:
    var
      frmDesign : TForm;
      UserLable : TLabel;
      PassLable : TLabel;
      Bevel1 : TBevel;
      Label1 : TLabel;
      Label2 : TLabel;
      Label3 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      EditButton : TButton;
      Username, Password : String;

    procedure StartClick(sender: TObject);
    begin
      Username := UserEdit.Text;
      Password := PassEdit.Text;
      frmDesign.ModalResult:= mrOk;
    end;

    procedure InitForm;
    begin
      frmDesign := CreateForm;
      frmDesign.Position := poScreenCenter;
      frmDesign.Width := 267;
      frmDesign.Height := 141;
      frmDesign.Caption := 'GUI';
      frmDesign.Color := clBtnFace;
      frmDesign.Font.Color := clWindowText;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.PixelsPerInch := 96;
      UserLable := TLabel.Create(frmDesign);
      UserLable.Parent := frmDesign;
      UserLable.Left := 16;
      UserLable.Top := 40;
      UserLable.Width := 51;
      UserLable.Height := 13;
      UserLable.Caption := 'Username:';
      PassLable := TLabel.Create(frmDesign);
      PassLable.Parent := frmDesign;
      PassLable.Left := 16;
      PassLable.Top := 64;
      PassLable.Width := 49;
      PassLable.Height := 13;
      PassLable.Caption := 'Password:';
      Bevel1 := TBevel.Create(frmDesign);
      Bevel1.Parent := frmDesign;
      Bevel1.Left := 8;
      Bevel1.Top := 32;
      Bevel1.Width := 176;
      Bevel1.Height := 57;
      Label1 := TLabel.Create(frmDesign);
      Label1.Parent := frmDesign;
      Label1.Left := 192;
      Label1.Top := 48;
      Label1.Width := 62;
      Label1.Height := 13;
      Label1.Caption := 'UNCfan1119';
      Label2 := TLabel.Create(frmDesign);
      Label2.Parent := frmDesign;
      Label2.Left := 8;
      Label2.Top := 8;
      Label2.Width := 240;
      Label2.Height := 16;
      Label2.Caption := 'Account Creation + Tutorial Island Solver';
      Label2.Font.Color := clWindowText;
      Label2.Font.Height := -15;
      Label2.Font.Name := 'MS Sans Serif';
      Label2.Font.Style := [];
      Label3 := TLabel.Create(frmDesign);
      Label3.Parent := frmDesign;
      Label3.Left := 200;
      Label3.Top := 32;
      Label3.Width := 14;
      Label3.Height := 13;
      Label3.Caption := 'by:';
      UserEdit := TEdit.Create(frmDesign);
      UserEdit.Parent := frmDesign;
      UserEdit.Left := 72;
      UserEdit.Top := 40;
      UserEdit.Width := 105;
      UserEdit.Height := 21;
      UserEdit.Hint := 'Type the username to be created here.';
      UserEdit.ParentShowHint := False;
      UserEdit.ShowHint := True;
      UserEdit.TabOrder := 8;
      PassEdit := TEdit.Create(frmDesign);
      PassEdit.Parent := frmDesign;
      PassEdit.Left := 72;
      PassEdit.Top := 64;
      PassEdit.Width := 105;
      PassEdit.Height := 21;
      PassEdit.Hint := 'Type the password to be created here.';
      PassEdit.ParentShowHint := False;
      PassEdit.ShowHint := True;
      PassEdit.TabOrder := 9;
      EditButton := TButton.Create(frmDesign);
      EditButton.Parent := frmDesign;
      EditButton.Left := 192;
      EditButton.Top := 64;
      EditButton.Width := 49;
      EditButton.Height := 17;
      EditButton.Caption := 'Start';
      EditButton.TabOrder := 10;
      EditButton.OnClick := @StartClick;
    end;

    procedure SafeInitForm;
    var
      v : TVariantArray;
    begin
      SetArrayLength(v, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowInitFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowInitFormModal;
    var
      v : TVariantArray;
    begin
      SetArrayLength(v, 0);
      ThreadSafeCall('ShowInitFormModal', v);
    end;

    procedure MainInitForm;
    begin
      SafeInitForm;
      SafeShowInitFormModal;
      FreeForm(frmDesign);
    end;

    My login (I can't use login.scar, because it tries to create a ttsomething of my username, and it can't because it logs in at tutorial island.)
    SCAR Code:
    procedure Login;
    begin
      ActivateClient;
      Wait(1000+random(200));
      TypeByte(vk_Escape);
      TypeSend('');
      Wait(50+random(50));
      Wait(100+random(200));
      TypeSend(Players[CurrentPlayer].Name);
      TypeSend(Players[CurrentPlayer].Pass);
      Wait(7000 + Random(300));
    end;



    So now we have everything needed, let me start my question. How can I make my form & script support as many accounts as the user wants to make? You don't have to tell me how to implement it into the script.

  2. #2
    Join Date
    Oct 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think that the SRL PlayerForm would help you out immensely.
    http://www.villavu.com/forum/showthread.php?t=17966

  3. #3
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Nope

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    In the form, have an option for how many players, then your DeclarePlayers as:

    SCAR Code:
    procedure DeclarePlayers;
    var
      I : Integer;

    begin
      HowManyPlayers:= StrToInt(WhatEverTheHowManyPlayersInFormIsCalled);
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer:= 0;
      for I:= 1 to StrToInt(WhatEverTheHowManyPlayersInFormIsCalled) do
      begin
        Players[I].Name := Username[I];
        Players[I].Pass := Password[I];
        Players[I].Nick := NickN[I];
        Players[I].Active := True;  
      end;
    end;

    To do that, you would also need to make Username, Pass and NickN an array.

    Richard.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by uncfan1119 View Post
    Nope
    It would kinda do all the work for you.

    You could look up the SRL playerform and see what kind of code it uses. I recall there being a few tuts on how to add tabs to your forms too.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  6. #6
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    I know how to add tabs, but I don't want tabs. I want to create my own form, + I can't even find the srlplayerform. If it's hidden in srl.scar includes, there is so many I would just give up.

  7. #7
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    srl/srl/misc/playerform.scar?

    Just a guess, could be wrong (I don't even know if that path exists).
    I made a new script, check it out!.

  8. #8
    Join Date
    Oct 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by uncfan1119 View Post
    I know how to add tabs, but I don't want tabs. I want to create my own form, + I can't even find the srlplayerform. If it's hidden in srl.scar includes, there is so many I would just give up.
    Could you describe how you do want to do it? (Like how you want the form to look)?
    My Scripts : AlchAll

  9. #9
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default



    edit: I know it kind of looks similar to the one in master's tutorial, but I don't think so. :/ Maybe I'm just stupid today...
    edit2: I just realized I'll have to create another new form, so disregard the one that's posted in the first post.
    Last edited by uncfan1119; 10-13-2009 at 08:43 PM.

  10. #10
    Join Date
    Oct 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The best way to do it that I see would be to create a "master form" (excuse my terminology ) that would be the one storing all the user's data, e.g. the one on the right in your example. At the bottom of that, there would be your "Add/Delete" buttons, which the add one would bring up the form on the left of your drawing, and when that is submitted, it adds the values to an array.

    I think that makes sense...if not, tell me and I'll clarify
    My Scripts : AlchAll

  11. #11
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    Search in the Big Form tutorial by Masterkill.

  12. #12
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Wewt that makes sence, but isn't logical imo, and would just be "plan C". Plan b would be just have like 10 add player slots, active=false on 9 of them, and let the user chose if they need that many.

    Although now thinking about this, I wouldn't need a unlimited player amount, because you can only create a certain # of accounts at a time anyway. Thanks to all who tryed to help, I'm still interested if anyone has any ideas. I could add a wait after it finds the error message that will not let you create an account.

  13. #13
    Join Date
    Oct 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I believe the limit is five at a time (like every 30 minutes), in case you didn't know.
    My Scripts : AlchAll

  14. #14
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    have an add button, and when clicked clear the edit boxes, and add the info into an array, and use that array to put it into Declare players, like r1ch suggested

    or just use SRLPlayerForm instead, 1000X easier
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  15. #15
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do the accounts individually, that way it will run forever (presumably it's a tutorial runner).

    Create account one.
    Run through tutorial.
    Create account two.
    Run through tutorial.
    Create account three.
    Run through tutorial.
    Etc.

    Because the average tutorial run takes 10-20 minutes, you, in theory, never have to stop the script.

    Have a random name option, that generates a name of random length and characters (perhaps use a random name generator?), and create it with a set password.

    ~Sandstorm

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
  •