ID:149539
 
Ok, this is probably an easily answered question, but I'm tired so give me a break. I have my login working and all that, when you login you're asked your name and all, but when ever somewhere it's supposed to say [usr] it still puts your key and not the name you chose. How do I solve this?
it obviously has something to do with a part of your code which we cannot see. show the part that gives the probs.
I don't think you're actually setting the name when you have the computer ask... asking for information isn't enough, you have to tell the computer what to do with it. Show the line of code where it asks for a name, then we can show you what you're doing wrong.
In response to Lesbian Assassin
Yea, forgot about the code, guess that would help.

mob
Login()
..()
if(usr.saved<1)
input("What is your name?","Name") as text
switch(input("What race would you like to be?")in list("Human","Elf","Arlian","Dwarf"))



The rest is just with the races and all, so I didn't quite think that's necessary. If you need more though just tell me.
In response to Daemon5532
Daemon5532 wrote:
mob
Login()
..()
if(usr.saved<1)
input("What is your name?","Name") as text
switch(input("What race would you like to be?")in list("Human","Elf","Arlian","Dwarf"))

Yep, it's exactly what Lexy said: You're not actually setting the name var to anything. You're asking for a name and then never doing anything with it:
input("What is your name?","Name") as text

Calling input() is useless unless you use the return value:
name=input("What is your name?","Name") as text

As an aside, you should be very wary about using usr anywhere but a verb. I believe it works in Login(), but it's not safe enough that I'd trust it; src works here, so use that.

Lummox JR
In response to Lummox JR
Thanks, it worked out just like I wanted it to. But since I'm on the subject, could you please tell me what I would do to stop people from making duplicate keys? Like so no one will have the same name.
In response to Daemon5532
Daemon5532 wrote:
Thanks, it worked out just like I wanted it to. But since I'm on the subject, could you please tell me what I would do to stop people from making duplicate keys? Like so no one will have the same name.

I'd try something like this:
var/list/charnames   // this is a global var
// make sure it's saved with your save files

mob
Login()
do
name=input(...)
if(charnames && (ckey(name) in charnames))
src << "You can't choose [name] because it's already taken."
name=null
while(!name) // end of do...while loop
if(!charnames) charnames=list() // create the list
charnames[ckey(name)]=name

There is one huge problem with this system: Anyone can choose a name that matches an existing key in BYOND. (And, if that person ever logs in, they won't be able to use their own key as a name.) That's something you're going to have to figure out separately.

Lummox JR
In response to Lummox JR
Hmm...I feel stupid, but I tried arranging this in my code like 10-15 times allready, and I just can't figure out where to put it. Think you could help me there?


Oh, and I know what you mean with the key thing, but in my game you have to pick a name that goes with midievil times.
In response to Lummox JR
Er, if that posted when I hit enter and only had 1 line, sorry. If it didn't, then im working with Daemon on this. I tried the code, and I got no errors, but I just want to make sure this is how it was supposed to be fitted in because it didn't work.

mob
Login()
..()


if(usr.saved<1)

do
name=input("What is your name?","Name") as text
if(charnames && (ckey(name) in charnames))
src << "You can't choose [name] because it's already taken."
name=null
while(!name) // end of do...while loop
if(!charnames) charnames=list() // create the list
In response to Switch
That's what the delete button is for.