Today I am releasing an old quest that is still working
code_language.lua:
quest desired name begin
state start begin
when 40002. use begin
local bugfix_count = pc . count_item ( item . get_vnum ())
say_title " Custom Name Ticket - Introduction"
say "This ticket gives you the opportunity to use a"
say "name of your choice."
say "In order for you to change your name, you have to fulfill "
say "the following requirement."
say ""
say_reward "- You have to be guildless.""
say "For protection, certain special characters are not"
say "allowed, but you'll learn after sequel"
say "which are."
say ""
say_reward "Would you like to choose your desired name?" if select ( "Enter desired name" , "Exit" ) == 2 then return end if pc . hasguild () == true then
say_title "name change failed"
say ""
"You can put your name change because you"
say "are in a guild."
say "Complete the following requirement to change your name"
say "."
say ""
say_reward "- You have to be guildless." return end
say_title " Custom Name Ticket - Enter new name"
say "Please enter your new name." local inp = "" repeat
inp = input () if inp == ""
"Custom Name Ticket - Cancel process"
say "Do you want to cancel?"if select("Yes","No")==1thenreturnendenduntil inp ~=""for _,l in pairs{" "}do-- delete this characters
inp = string.gsub(inp,l,""=
signend)
"!§$%&/[]()=?{}+*~#><|.,-"
inp1 = inp
for i=1, string.len(character), 1 do
inp1 = string.gsub(inp1, "(%"..string.sub(character, i, i)..")", "")
end
if string.find(inp1, "(%W)")!=nil then
say_title "Name change failed"
say ""
say "You have an invalid character in the name, the"
say "characters that are not allowed, and you want to use"
say "are:"
say_reward ( string . gsub ( inp1 , "(% w ) " , " " ))) return end if string . len ( inp )> = 21 then
say_title "name change failed"
"You can not change your name, because this
say is too long."
say "Complete the following requirement to change your name"
say "."
say ""
say_reward "- Maximum of 20 characters." return end if string . len ( inp ) <= 2 then
say_title "Name change failed"
say ""
say "You can not change your name because this"
say "is too short."
say "
say "to change."
say ""
say_reward "- At least 3 characters." return end
say_title " Custom Name Ticket Confirmation"
say_reward "After confirming your new name,"
say_reward "will not be refundable."
say ""
say "You currently have the following name:"
say_title ( "" .. pc . get_name () .. "" )
say ""
( inp )
say ""
say_reward "Do you want to use this name?" if select ( "Confirm new name" , "Cancel" ) == 2 then return end local _ , _ , y = string . find ( inp , "^% [([^%]] *)%]" ) if y then local ly = string . upper ( y ) for _
,l in pairs{"SA","GM","GA","SGA","SGM","TGM","MOD", "DEV", "SL", "Team", "SMOD", "TMOD", "TA", "BA", "YT", "CoMa", "Youtube", "P2", "HA", "PvP"} do
if ly == l then
return say "You can not use that name!" end end end if bugfix_count ~ = pc . count_item ( item . get_vnum ()) then
notice "BUGUSER!" - As punishment remove ALL!
pc . remove_item ( item . get_vnum (), pc . count_item ( item . get_vnum ())) end local formatted_name = string . sub ( string
.format("%q",inp),2,-2) -- CHANGED
local change = pc.change_name(formatted_name)
if change == 4 then
item.remove()
-- Wenn stackbar:
-- pc.remove_item(item.get_vnum(),1)
end
say_title "Custom Name Ticket - Completion"
say (({
[ENTER] Name change failed! [ENTER] You have already changed your name within the last [ENTER] 14 days. [ENTER] Please perform a relog! " , "ERROR - Parameter error" , - << will never be displayed ingame "[ENTER] Name change failed! [ENTER] You entered an invalid name." , "[ENTER] Name change failed! [ENTER] Your chosen name already exists." , [ENTER] Congratulations! [ENTER] The name change was successful. [ENTER] Your new name is: [ENTER] " .. formatted_name .. " [ENTER] " ,
"Goodbye."
wait()
if change == 4 then
pc.warp(pc.get_x()*100, pc.get_y()*100)
end
end
end
end