SRL Archive - OSR Help

Help Creating Script


Death12652

2010-05-11 17:10:46

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…

website1 = somefunonline.com/Red_VS_Blue_Episode_ [B]Random Number Between 1-53[/B] .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

Sir R. M8gic1an

2010-05-11 17:39:35

From: death12652
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…

website1 = somefunonline.com/Red_VS_Blue_Episode_ [B]Random Number Between 1-53[/B] .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

MylesMadness

2010-05-11 18:20:49

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

Death12652

2010-05-11 23:47:57

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

OpenWebPage(website + (IntToStr(RandomRange(1, 105))));

there are constants website1 - website105 and I want it to open one randomly? Is it possible?

Coh3n

2010-05-12 23:26:29

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

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.

function chooseWebsite: String;
var
websites: TStringArray;
begin
websites := [ 'www.google.ca', 'www.villavu.com' ];
Result := websites[Random(Length(websites)) - 1];
end;

Death12652

2010-05-13 00:48:00

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.

Gu3st...

2010-05-13 05:34:33

For question 1:

Username generator: (The one I am using)
// 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)
// 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…

Coh3n

2010-05-13 08:21:51

From: death12652
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. :)

Death12652

2010-05-13 08:54:59

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


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

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.

Gu3st...

2010-05-13 09:17:26

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 :)

Death12652

2010-05-13 09:44:48

Okay I got this and it works the way I wanted thank you by the way…

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?

Coh3n

2010-05-13 09:47:07

http://villavu.com/forum/showthread.php?t=44955&highlight=WriteINI :)

Death12652

2010-05-13 18:06:39

Got It. Thanks.