ID:261842
 
I was maing some new verbs for my GMs, and as I worked on rename() it messes up. I dont have any errors or anything, but when you rename a person and type in what u want to rename them, it renemaes them to "T" instead of the actualy text the person typed. I know one other way to accomplish what I want but it involves everything being switched. This means, the user types a namein first and then selects which character to change the name into. Ive supplied both versions of the code. The first is the no-errored, "T" code, and the second is the backwards code that works. Thanks for any help in advance.

mob/GM/verb/Rename()
set category = "Game Options"
var/list/players=list()
for(var/mob/M in world)
players += M
players += "Cancel"
var/mob/A = input("Who's name would you like to change?")in players
input("What would you like to change there name to?",text)
A.name = "[text]"




mob/GM/verb/Rename(t as text)
set category = "Game Options"
var/list/players=list()
for(var/mob/M in world)
players += M
players += "Cancel"
var/mob/A = input("Who's name would you like to change?")in players
if(ismob(A))
A.name = "[t]"
else
..()
The Conjuror wrote:
I was maing some new verbs for my GMs, and as I worked on rename() it messes up. I dont have any errors or anything, but when you rename a person and type in what u want to rename them, it renemaes them to "T" instead of the actualy text the person typed. I know one other way to accomplish what I want but it involves everything being switched. This means, the user types a namein first and then selects which character to change the name into. Ive supplied both versions of the code. The first is the no-errored, "T" code, and the second is the backwards code that works. Thanks for any help in advance.

You didn't have any compiler errors, you mean. Anything that functions incorrectly is still an error.

mob/GM/verb/Rename()
set category = "Game Options"
var/list/players=list()
for(var/mob/M in world)
players += M
players += "Cancel"
var/mob/A = input("Who's name would you like to change?")in players
input("What would you like to change there name to?",text)
A.name = "[text]"

Problems:

  • "Who's" should be spelled "Whose".
  • "there" should be "their".
  • Unless all mobs are players, you should check if M.client or M.key is null. (Use M.key if mobs stick around after logout and you want to be able to change them.)
  • Instead of adding "Cancel" to players, use "as null|anything in players" after your first input().
  • You never bothered in this version to check if A is equal to "Cancel"--or, if you change this, to null.
  • Your second input() proc is wrong; it's using src.text as a title for the box. src.text does not receive the value you type in.
  • You need to assign to output from input() to a var.
  • Set A.name to that var, not to text.

    mob/GM/verb/Rename(t as text)
    set category = "Game Options"
    var/list/players=list()
    for(var/mob/M in world)
    players += M
    players += "Cancel"
    var/mob/A = input("Who's name would you like to change?")in players
    if(ismob(A))
    A.name = "[t]"
    else
    ..()

    Problems:
  • "Who's" should be spelled "Whose".
  • Instead of adding "Cancel" to players, use "as null|anything in players" after your first input().
  • ..() does absolutely nothing here, because this is a new verb.

    Lummox JR
In response to Lummox JR
hmm, lol, once again lummox jr spots the gramatical errors, lol. Well, I think I've got it bugged out, some of the stuff you explained I admit was a little confusing to me, a moderate coder with a minimum vocablulary for a 13 year old, but you did succeed to help none the less. Thanks, and by the way, the grammer didnt really matter as the verb was only for me. But thanks lummox.