| Blockland Forums > Suggestions & Requests |
| randomly generated names |
| (1/2) > >> |
| Im_AFK:
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 |
| Advanced Bot:
%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. |
| Swollow:
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 |
| Advanced Bot:
$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(); } |
| Kølt:
--- Quote from: Advanced Bot on November 22, 2013, 09:01:26 AM ----code- --- End quote --- So how would one integrate this into Blockland? |
| Navigation |
| Message Index |
| Next page |