Results 1 to 13 of 13

Thread: Help Creating Script

  1. #1
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help Creating Script

    I would like some help making a script. I am going to define certain parts in a script and I would like some help making these parts. Whoever makes it is going to get credit. This is for my personal use and my friends. Not related to RS or becoming a member.

    1. I need... A random username maker... I have a random creator that creates character a-z and 1-9 randomly but that's too random. Also needs to be able to log that name in a .INI with the WriteINI function.

    2.Then I need a way to have constants to have a part that is random like...

    Code:
    website1 = somefunonline.com/Red_VS_Blue_Episode_ Random Number Between 1-53 .html;
    Lastly this is just a question not a request but is there a way to get scar to open a browser with a function? Universally on every computers not just mine. Preferably firefox.

    Thanks,
    Death

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

    Default

    Quote Originally Posted by death12652 View Post
    I would like some help making a script. I am going to define certain parts in a script and I would like some help making these parts. Whoever makes it is going to get credit. This is for my personal use and my friends. Not related to RS or becoming a member.

    1. I need... A random username maker... I have a random creator that creates character a-z and 1-9 randomly but that's too random. Also needs to be able to log that name in a .INI with the WriteINI function.

    2.Then I need a way to have constants to have a part that is random like...

    Code:
    website1 = somefunonline.com/Red_VS_Blue_Episode_ Random Number Between 1-53 .html;
    Lastly this is just a question not a request but is there a way to get scar to open a browser with a function? Universally on every computers not just mine. Preferably firefox.

    Thanks,
    Death
    Last question: Search for APPA by nielsie95

    2. 'somefunonline.com/Red_VS_Blue_Episode_' + IntToStr(RandomRange(1, 53));

    1. well.. You'll need some creativity here. try making word blocks and adding them up randomly together.

    ~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
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    OpenWebPage('http://www.google.com/'); for the last qestion

  4. #4
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay thanks Rasta Magician that is what I asked for but now I have this

    Code:
    OpenWebPage(website + (IntToStr(RandomRange(1, 105))));
    there are constants website1 - website105 and I want it to open one randomly? Is it possible?
    Last edited by Death12652; 05-13-2010 at 12:02 AM. Reason: Need Help

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

    Default

    Quote Originally Posted by death12652 View Post
    Okay thanks Rasta Magician that is what I asked for but now I have this

    Code:
    OpenWebPage(website + (IntToStr(RandomRange(1, 105))));
    there are constants website1 - website105 and I want it to open one randomly? Is it possible?
    Well I don't know about constants, but you could have an array of websites, then randomly choose from the array.
    SCAR Code:
    function chooseWebsite: String;
    var
      websites: TStringArray;
    begin
      websites := [ 'www.google.ca', 'www.villavu.com' ];
      Result := websites[Random(Length(websites)) - 1];
    end;

  6. #6
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay That might work thanks... I will try it tomorrow. I'm going to give you credit at the top before the instructions. Though this is only going to a select few I think you deserve some credit... along with Nava2 for the RandStr Function. Thanks Guys.

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

    Default

    For question 1:

    Username generator: (The one I am using)
    SCAR Code:
    // Made by Zyt3x
    const
      HowMany   = 50;     // How many accounts do you want? Min 1. Max 50.
      AddNumb   = False; // True = Asdf1, Asdf2. False = Asdf, Qwer.
        First   = False;  // True = 1Asdf, 2Asdf. False = Asdf1, Asdf2.
        NumC    = 5;     // How many numbers after the name?
      LongNames = True;  // True = ~9 chars. False = ~5 chars.
      Consonant = False; // Consonant heavy names? (Wekthlor, Zhaphg...)
      Vowel     = False; // Vowel heavy names? (Elaythu, Amoseiti...)
      Randomize = False; // Randomizes the name, none of the booleans above count
     
    var
      Usernames : TStringArray;
      f, S : String;
      I, J, P, H : Integer;
     
    begin
      if HowMany > 50 then
        H := 50
      else
        if HowMany < 2 then
          H := 2
        else
          H := HowMany;
      f := '2';
      if LongNames then f := '3';
      if Consonant then f := '4';
      if Vowel then     f := '5';
      if Randomize then f := '6';
      S := GetPage('http://www.rinkworks.com/namegen/fnames.cgi?id=checked&f=' + f);
      Usernames := Explode('<li>', Between('<table><tr><td><ul></ul></td><td><ul><li>', '</ul></td></tr></table></center>', S));
      SetArrayLength(Usernames, H);
      for I := 0 to H-1 do
      begin
        P := Pos('<', Usernames[I]);
        if P > 0 then
          Delete(Usernames[I], P, 18);
        if Length(Usernames[I]) < 5 then
          Usernames[I] := Usernames[I] + Copy(Lowercase(Usernames[Random(H-1)]), 0, 12);
        if AddNumb then
          Delete(Usernames[I], 11, 20)
        else
          Delete(Usernames[I], 12, 20);
      end;
      ClearDebug;
      for I := 0 to H-1 do
      begin
        if AddNumb then
        begin
          for J := 1 to NumC do
            if First then
              WriteLn(IntToStr(J) + Usernames[I])
            else
              WriteLn(Usernames[I] + IntToStr(J));
            I := I + NumC
        end else
          WriteLn(Usernames[I]);
      end;
    end.

    Write to INI: (Taken from my include)
    SCAR Code:
    // Made by Zyt3x
    function WritePlayer(Player, Password, Nick, Pin : String): Boolean;
    var
      F : String;
    begin
      if Player = '' then Exit;
      F := ScriptPath + Capitalize(Player) + '.ini';
      if Player <> 'nil' then
        WriteINI('Information', 'Username', Player, F);
      if Password <> 'nil' then
        if Password <> '' then
          WriteINI('Information', 'Password', Password, F);
      if (Nick <> '') then
        if (Nick <> Player) then
          if Nick <> 'nil' then
            WriteINI('Information', 'Nick', Nick, F);
      if Pin <> 'nil' then
        WriteINI('Information', 'Pin', Pin, F);
      Result := True;
    end;

    EDIT: This isn't for runescape? If so then you'd have to edit the WritePlayer procedure...
    Last edited by Zyt3x; 05-13-2010 at 09:37 AM.

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

    Default

    Quote Originally Posted by death12652 View Post
    Okay That might work thanks... I will try it tomorrow. I'm going to give you credit at the top before the instructions. Though this is only going to a select few I think you deserve some credit... along with Nava2 for the RandStr Function. Thanks Guys.
    You're welcome.

  9. #9
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    zy3tx I need help modifying it. I like it so far. Can you help make it choose one of those names or make it a function to I can go like

    Code:
    function ChooseName(A : integer);//A is how many names
    that way I can call it anywhere in the script and have it choose one and type it. Also The WritePlayer I just need it to write the username like how Coh3n had it

    Originally made by Coh3n
    Code:
    function RandStr(Len: Integer): string;
    var
      I, cLen: Integer;
      Chars: string;
    begin
      Chars := 'abcdefghijklmnopqrstuvwxyz0123456789';
      cLen := length(chars);
      for i := 1 to Len do
        if (Random(2) = 1) then
          Result := Result + uppercase(Chars[Random(cLen) + 1])
        else
          Result := Result + Chars[Random(cLen) + 1];
    end;
    
    procedure saveToFile(str: String);
    var
      theFile: Integer;
      tempStr: String;
    begin
      if (FileExists(appPath + 'fileName.txt')) then
      begin
        theFile := OpenFile(appPath + 'fileName.txt', false); //will open the file if it exists
        ReadFileString(theFile, tempStr, FileSize(theFile)); //copies the text that's already there
        CloseFile(theFile);
      end;
    
      theFile := RewriteFile(appPath + 'fileName.txt', false) //will create a new file if it doesn't already exist
      WriteFileString(theFile, tempStr + str + #13); //writes what was already there + str to file ~ the #13 will go to the next line
      CloseFile(theFile);
    end;
    
    begin
      saveToFile(RandStr(8));
    end.
    It would be a great help.
    Last edited by Death12652; 05-13-2010 at 01:09 PM. Reason: Help

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

    Default

    As the script is right now, it saves every username to a TStringArray. You can then do WriteLn(Usernames[0]); WriteLn(Usernames[1]); to write 2 usernames to the debug box. It wont be to hard to edit it to fit your script, just read some basic tutorials

  11. #11
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay I got this and it works the way I wanted thank you by the way...
    Code:
    begin
         Name_Generator;
         A := RandomRange(0, 50);
         Typekeys(Usernames[A]);//A is an integer.
    end.

    So how do I get it to save that in the .INI file?

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

  13. #13
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Got It. Thanks.

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
  •