So I have a script that creates randomly generated usernames. Then uses that username to sign up. Is there a way to log those usernames into some type of file like another scar or the debug or something like that?
So I have a script that creates randomly generated usernames. Then uses that username to sign up. Is there a way to log those usernames into some type of file like another scar or the debug or something like that?
ctrl+space, Writeini![]()
<TViYH> i had a dream about you again awkwardsaw
Malachi 2:3
This is what I have. Made by Nava2.
Where do I put the WriteINI in for it to save the random characters it generates. If not then do I have to modify it?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;
Last edited by Death12652; 05-11-2010 at 08:36 PM. Reason: Help
I would create a new procedure.
This should work like you want it to.SCAR Code: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 + #10); //writes what was already there + str to file ~ the #10 will go to the next line
CloseFile(theFile);
end;
var
i: Integer;
begin
for i := 1 to 10 do
saveToFile(intToStr(i));
end.
E: What this does is just write the str to a text file. An INI file works a little differently ~ check out this tutorial if you're interested in the INI functions.
Last edited by Coh3n; 05-11-2010 at 10:59 PM.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
Thanks so much you helped a lot.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
Sorry I don't get how this works. It just keeps putting a FileNme.txt Which I get but All it does is put 1-10 on the first line and then does that over and over. I wanted it to put in there what my random name function put. Also it doesn't put it on a new line? just keeps putting it on the same line no spaces.
here I will show you what it looks like?
over and over and over again.Code:123456789101234567891012345678910
I just used the 1-10 as an example. I don't think it's going on a separate line because I was using linux and I'm assuming you're using Windows. Try this:
SCAR 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.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
Nevermind Its Working Perfectly!
Last edited by Death12652; 05-13-2010 at 04:13 AM.
SRL's F.A.Q. (Error fixes) | How to Convert SRL-5 Scripts to SRL-6 | Draynor Chop N' Bank (RS3)| AIO Superheater (RS3)
T - E - A - MTogether Everyone Achieves More
thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)