SRL Archive - SRL Archives

Procedure SetUserNicks(Active: Boolean);


Macrosoft

2007-10-14 01:40:51

This procedure sets all the user nicks for you. "Active" is what you want the status of the player to be if a nickname can not be created (ex: la la la). If true, the player will remain active.

I just finished working on this, so let me know if there are any bugs.

{*******************************************************************************
Procedure SetUserNicks(Active: Boolean);
By: Macrosoft
Description: Will set the nickname for all the players in your script. If Active is set as false,
then if a player's username cannot be used to make a nickname, the player will become not active.
*******************************************************************************}

Procedure SetUserNicks(Active: Boolean);

var
counter: integer;
n, a, x, NameLength: integer;
cName: array of char;
nName: array[0..2] of char;
begin
a:=GetArrayLength(Players);
for n:= 0 to a-1 do
begin
Counter:=2;
x:=0
NameLength:=Length(Players[n].Name);
SetArrayLength(cName, NameLength + 1);
repeat
begin
cName[Counter-1]:=StrGet(Players[n].Name, Counter);
if(cName[Counter-1] = ' ')then
begin
x:=0;
Counter:=Counter+1;
end else
begin
nName[x]:=cName[Counter-1];
x:=x+1;
end;
Counter:=Counter+1;
end;
until(Counter=NameLength + 2) or (x=3);
if(Counter=NameLength + 2)then
begin
writeln('Nickname can not be made from the username: ' + Players[n].Name);
if(Active=False) then
begin
writeln(Players[n].Name + ' is no longer active');
Players[n].Active:=False;
end;
end else
begin
Players[n].Nick:= nName[0] + nName[1] + nName[2];
writeln(Players[n].Name + +#39+ 's nickname has been set to: ' + Players[n].Nick);
end;
end;
end;


Feel free to use this but remember to Credit Me!

Macrosoft

2007-10-18 19:15:30

Reserved for current scripts using this procedure

R0b0t1

2007-10-18 21:16:25

Nice…ish? I figure I could just use a for loop, as calling a procedure has lots of overhead :).

Macrosoft

2007-10-18 23:51:47

From: R0b0t1
Nice…ish? I figure I could just use a for loop, as calling a procedure has lots of overhead :).


for loop for what?

R0b0t1

2007-10-20 12:53:52


for I:= 0 to GetArrayLength(Players) do
Players[I].Active:= True;

Macrosoft

2007-10-26 23:01:46

sry man, you got me lost

where exactly would i need this?

R0b0t1

2007-11-12 18:24:25

Heh? Sorry… It got like buried.


I though you meant that it set the Active attribute on a player XD?

Macrosoft

2007-11-12 21:25:10

if active is true, the player will remain active even if the nick can not be set

Narcle

2007-11-18 04:36:04

Setting up nicks automatically would be nice. However as I found out some peoples names are actually censored in RS. 3 cheers to Jagex for their brilliant censor system.

Macrosoft

2007-11-18 13:33:01

dang, that can be a problem

maybe we can figure out what is sensored and then add that to the procedure?

just a thought, i guess its too much work

Simple solution: Dont have bad usernames

Macrosoft

2007-11-28 22:54:46

dont worry, posting on this thread is not a grave dig

(sorry about double post)

mickaliscious

2007-12-12 17:11:06

So why isn't this in SRL? Afraid it'll increase leechers?

Macrosoft

2007-12-15 10:00:02

lol, i dont know