Author Topic: randomly generated names  (Read 788 times)

if you ever played bushidos super murder mystery server you would recognize what im asking: when the player spawns they are assigned a *randomly generated name* such as mr grimsy or mrs lawflower, when that player dies and respawns then the same process takes place (they could still be mr grimsy or mrs lawflower from the dead!!1)-thats what im asking for + the message to that player- "you are known as..." or "your name is..." preferably the 1st. that along with host commands to change their name at will either randomly ( /generate /rgn /whatever ) or by typing it in ( /name mr headblock), and thats a wrap!!!1

%name[0] = "Bob";
%name[1] = "Guy";
%name[2] = "Chicky";
%name[3] = "Caket";
%nameCount = 4;

%client.roleName = %name[getRandom(0,%nameCount)];

Not a real client variable to set the real name, just an example.
« Last Edit: November 19, 2013, 03:49:55 PM by Advanced Bot »

it would be better to store all the names in a text file and then put them into global variables/a script object on startup, for retrieving later
that way it is easier to add names to the list

   $NameCounts = 0;
   %file = new FileObject();
   %file.openForRead("config/server/Name Generator/names.txt");
   while(!%file.isEOF())
   {
      %line = %file.readLine();
         if(%line !$= "")
            $Names[$NameCounts++] = %line;
   }
      %file.close();
      %file.delete();

   function serverCmdName(%this,%a,%b,%c,%d,%e,%f,%g)
   {
      %name = %a SPC %b SPC %c SPC %d SPC %e SPC %f SPC %g;
      if(%this.getBLID() == getNumKeyID())
         AddNewName(%name);
   }
   function AddNewName(%name)
   {
      %name = StripMLControlChars(%name);
      if(%name $= "")
         return echo("Missing Var! (Adding a name)");
       
      for(%i=0;%i<$NameCounts;%i++)
         if($Names[%i] $= %name)
            %error = 1;
      if(%error) return;
      $Names[$NameCounts++] = %name;
      %file = new FileObject();
      %file.openForAppend("config/server/Name Generator/names.txt");
      %file.writeLine(%name);
      %file.close();
      %file.delete();
   }


Isn't there already an add-on for this? I believe there is.

EDIT: No idea where it is, but I've seen it on other servers before and it annoys me so much when I have to ask the host to assign me a name.
« Last Edit: November 24, 2013, 08:34:00 AM by Blockhead8306 »

Isn't there already an add-on for this? I believe there is.

EDIT: No idea where it is, but I've seen it on other servers before and it annoys me so much when I have to ask the host to assign me a name.
I don't think it's been released, if there is one.

bump, I would really like to see this in game.