i need help fixing this.it shows "Saiyin has logged in!" which it suppose to show the character's name.
here's the character name input part. as you can see, my character name variable is CHARNAME and mob will be /mob/M
------------------------------------------------------------
mob/proc/CreateChar()
var/mob/M
var/CHARNAME = input("Please use appropriate names or I will ban you. You can put in any names but don't put in any names that may offend ones race, gender, or in any other way.", "Create A Character")
if("Saiyin")
M = new /mob/Saiyin()
....bunch of other working codes
....bunch of other working codes
....bunch of other working codes
....bunch of other working codes
....bunch of other working codes
....bunch of other working codes
....bunch of other working codes
src.client.mob = M
M.CHARNAME = CHARNAME
M.loc = locate(5,5,2)
del(src)
-----------------------------------------------------------
here's the load character turf and proc
------------------------------------------------------------
mob
proc
LoadChar()
var/savefile/F = new("players/[src.ckey].sav")
var/X
var/Y
var/Z
var/mob/NewCharMOB = new()
F["name"] >> name
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> NewCharMOB
NewCharMOB.loc = locate(X,Y,Z)
src.client.mob = NewCharMOB
del(src)
turf/LoadChar
Click()
if(fexists("players/[usr.ckey].sav"))
usr.LoadChar()
world << "\[[world.name]]--> [usr] has logged in!"
usr << "Welcome back to the game!"
return ..()
else
alert("You don't HAVE an old character here, or it isn't found in our databases!")
return ..()
..()
-----------------------------------------------------------
ID:147922
![]() Sep 27 2003, 10:12 pm
|
|
here's what i would do:
mob/proc/CreateChar() var/mob/M var/CHARNAME = input("Please use appropriate names or I will ban you. You can put in any names but don't put in any names that may offend ones race, gender, or in any other way.", "Create A Character") if("Saiyin") M = new /mob/Saiyin() M.nameproc() mob/proc/namechar(var/mob/player/m) set background = 1 m.name = input("What is your name?","Choose your name",m.name)as text if(m.name == "") call(/proc/namechar)(m) if(m.name == "Goku") call(/proc/namechar)(m) if(m.name == "Vegeta") call(/proc/namechar)(m) etc. |
Just set M.name = CHARNAME (as shown above) in your CreateChar() proc, and it should work fine.
The problem is that just referencing "usr" in a text string like that will output usr.name; but you haven't changed usr.name from the default (which for /mob/Saiyin, is "Saiyin"; for a /mob/blah/whatever/stuff, it would be "stuff").