ID:176340
 
Ok, here is the code:

mob/proc
CreateNewCharacter()
var/char_name = input("What is the character's name?", "New character", null) as text
SaveCharacter(char_name)
usr.loc = locate(1,1,1)
return char_name


The parts in bold are my problem. How it is now after it puts me in the location the name goes blank. If I swap the two lines after it shows my name it wont put me in the location. How should I fix this? Is there a way to do two things at once or should I make some kind of proc to handle this? Any help would be appreciated.
mob/proc
CreateNewCharacter()
var/char_name = input("What is the character's name?", "New character", null) as text
SaveCharacter(char_name)
usr.loc = locate(1,1,1)
return char_name

Perhaps it would be simpler if instead of returning the character's name (which doesn't make a lot of sense in this kind of proc, unless you're doing something with the returned value in some other proc), you could just do this:

<code>src.name = char_name</code>

Second of all, you shouldn't be using <code>usr</code> in a proc like this. You always want to be using <code>src</code> to refer to the mob at hand. Using src instead of usr is a very good habit to get into.

<code>mob/proc/CreateNewCharacter() var/char_name = input("What is your name to be?", "New Character", src.name) as text SaveCharacter(char_name) src.loc = locate(1,1,1) src.name = char_name</code>

In response to Triste
Thanks.

p.s. I will try to stay away from usr. :)
In response to Jnco904
hmm that doesn't seem to work either.
In response to Triste
If you're changing usr to src, then you want to also change input("whatever","whatever") to input(src,"whatever","whatever").