ID:145782
 
Code:
mob/spectator
icon = null

Move()

New()
..()
loc = locate(893,895,1)

Logout()
..()
del(src)

world
mob = /mob/spectator

turf/newgame3
icon = 'newgame3.png'

Click()
if(istype(usr,/mob/spectator))
usr.client.mob = new/mob/create/

mob/create
Login()
var/mob/pc/newmob
var/n = input(src,"What will your name be?")as text
newmob:name = n
newmob:loc = locate(136,63,1)
src.client.mob = newmob
del(src)

mob/pc


Problem description: This is the Runtime error i get.

runtime error: Cannot modify null.name.
proc name: Login (/mob/create/Login)
source file: testworld.dm,28
usr: the create (/mob/create)
src: the create (/mob/create)
call stack:
the create (/mob/create): Login()

. I am very new to this. Please help. I have a title screen and I can click the new game button. Then it asks for name. After you hit enter it recieves a runtime error. If I haven't supplied enough info please tell me.

Because newmob was never initialized.
In response to Dever
how do i initialize it?
In response to ShobuReiki
ShobuReiki wrote:
how do i initialize it?

With new.
In response to Dever
thx but im kinda lost, can you show me an example?
In response to ShobuReiki
ShobuReiki wrote:
thx but im kinda lost, can you show me an example?


    Click()
if(istype(usr,/mob/spectator))
usr.client.mob = new/mob/create/
Like how new was used here..
In response to Dever
Dever, thanks for your patience, but you are being too vague.
Your answers are too short to help. I realize new is to be used like the line above. But i don't know where to put it. Below what? and in what order?

thx
In response to ShobuReiki
Initialize it when you create the mob.

By the way, you might prefer the "." operator here.