/* Multi-name teach --------------------- Created by Okuajub --------------------- These events are intended to be used to allow the user to have multiple names, delete specific names, or start fresh with a new name. This bit of code uses an array as the usernames list and a function to randomize them. Please remember to check the current username functions of your Ghost to replace them properly. Remember to change the dialogue, if wanted. It will default to the Sakura, with the standard balloon size. --------------------- */ /* OnSakuraMenu : all { //Add this to the menu you wish to allow name changing from. "\![*]\q[Change Name,OnChangeNameMenu]" } */ username { ANY(usernameArray) } OnChangeNameMenu : all { _nameTotal = ARRAYSIZE(usernameArray) _names = "" if _nameTotal > 1; _names = "Names" else; _names = "Name" "\t\*\![enter,nouserbreakmode]" "So, %(username), you want to change your name?\n\n[half]" "\f[italic,true]Current %(_names): \n" foreach usernameArray; _printName { "%(_printName)\n" } "\f[italic,default]\n[half]" "\![*]\q[Replace Current %(_names),OnChangeName,replace,1]\n" "\![*]\q[Add New Name,OnChangeName,add,1]\n" if _nameTotal > 1; "\![*]\q[Delete A Name,OnChangeName,delete,1]\n" "\n[half]\![*]\q[Quit Menu,dummy]" } OnChangeName : all { _changeType = reference0 //Keeps track of how far along we are. _step = reference1 _newName = reference2 if _step == 1 { if _changeType == "add" || _changeType == "replace" { "\t\*\![enter,nouserbreakmode]\![open,inputbox,OnChangeNameInput,--timeout=-1,--reference=%(_changeType),--reference=2]" "What name would you like me to call you?" "\n\n[half]\![*]\q[Quit Menu,OnQuit,0]" } else { "Which name would you like to delete?\n\n[half]" foreach usernameArray; _printName { "\![*]\q[%(_printName),OnChangeName,delete,2,%(_printName)]\n" } "\n[half]\![*]\q[Quit Menu,OnQuit,0]" } } elseif _step == 2 { if _changeType == "add" { usernameArray ,= _newName "Got it. I'll call you %(_newName), too." } elseif _changeType == "replace" { usernameArray = _newName "Got it. I'll call you %(_newName) from now on." } else { foreach usernameArray; _name { if _name == _newName { usernameArray[ASEARCH(_newName,usernameArray)] = IARRAY } } "Got it. I won't call you that one anymore." } } } OnChangeNameInput : all { _newName = reference0 _changeType = reference2 _step = reference3 //Add words to the blacklist to block them from being used. _blacklist = ("slurs","cusswords","whateveryouwanttoblock") // Cleans up name to prep it for the blacklist _nameCheck = _newName _nameCheck = TOLOWER(_nameCheck) //Makes it lowercase. _nameCheck = REPLACE(_nameCheck," ", "") // Removes spaces _nameCheck = REPLACE(_nameCheck,"_", "") // Removes underscores _nameCheck = REPLACE(_nameCheck,"-", "") // Removes dashes _nameCheck = REPLACE(_nameCheck,".", "") // Removes periods _nameCheck = REPLACE(_nameCheck,",", "") // Removes commas _nameCheck = REPLACE(_nameCheck,"'", "") // Removes apostrophes _nameCheck = REPLACE(_nameCheck,'"', "") // Removes quotes if ASEARCH(_nameCheck,_blacklist) != -1 //Fails blacklist check { "Try something else." "\t\*\![enter,nouserbreakmode]\![open,inputbox,OnChangeNameInput,--timeout=-1,--reference=%(_changeType),--reference=2]" "\n\n[half]\![*]\q[Quit Menu,OnQuit,0]" } elseif _nameCheck == "turgle" // You can also add custom responses to certain words, too. { "Who turgled?" "\t\*\![enter,nouserbreakmode]\![open,inputbox,OnChangeNameInput,--timeout=-1,--reference=%(_changeType),--reference=2]" "\n\n[half]\![*]\q[Quit Menu,OnQuit,0]" } elseif _nameCheck == "" { "Nothing to change then, huh?" } elseif ASEARCH(_newName,usernameArray) != -1 && _changeType == "add" // If the name is already present (alternate capitalizations/spellings allowed) { "Nothing to change then, huh?" } else //Passes { "\![raise,OnChangeName,%(_changeType),%(_step),%(_newName)]" } }