ID:145907
 
Code:
mob/spectator
icon= null
Move()
Login()
..()
world<< "[usr.key] has logged in!"
New()
..()
loc= locate(7,7,1)


Logout()
..()
del(src)
world<< "[usr.key] has logged out!"

world/mob= /mob/spectator

mob/creating_character
icon= null
Move()
Login()
..()
world<< "[usr.key] is creating a character!"
sleep(10)
alert("You stand now on the Plains of Creation, wherein which your character will be born.")
usr.client.mob= new /mob/creating_character2()



New()
..()
loc= locate(7,92,1)


Logout()
..()
del(src)

mob/creating_character2
var/mob/player
Login()
..()
loc=locate(7,92,1)
var/playername= input("What name will you choose for your character?","Character Name")
switch(input("What gender will your character take after?","Choose Gender") in list("Male", "Female"))
if("Male")
player= new /mob/White_Male()
player.loc= locate(100,100,1)
player.name= playername

if("Female")
player= new/mob/White_Female()
player.loc= locate(100,100,1)
player.name= playername

src.client.mob= player






turf
Plains_of_Creation
icon= 'plainsofcreation.bmp'

Title_Screen
icon= 'Titlescreen.bmp'

Start_Button
icon= 'Startbutton.bmp'

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



mob/White_Male
var/mob/player
icon= 'malewhite.dmi'
Login()
..()
world<< "[player.name] has joined Armeli!"

mob/White_Female
var/mob/player
icon= 'femalewhite.dmi'
Login()
..()
world<< "[player.name] has joined Armeli!"


Problem description: Above is the coding for logging into my game and it appears to have no errors but obviously there are some because when you log in and after you have chosen your gender a runtime pops up saying:

runtime error: Cannot read null.name
proc name: Login (/mob/White_Male/Login)
usr: the buster (/mob/White_Male)
src: the buster (/mob/White_Male)
call stack:
the buster (/mob/White_Male): Login()
the creating character2 (/mob/creating_character2): Login()

Or if you choose female:

runtime error: Cannot read null.name
proc name: Login (/mob/White_Female/Login)
usr: the buster (/mob/White_Female)
src: the buster (/mob/White_Female)
call stack:
the buster (/mob/White_Female): Login()
the creating character2 (/mob/creating_character2): Login()

What is wrong with this code?

1. You want to put ..() below everything else

2. Login is only when you join the server, and it wouldn't work after create a character...
In response to Bobthehobo
Bobthehobo wrote:
2. Login is only when you join the server, and it wouldn't work after create a character...

Login() is called when you connect to a mob, not just the server. So if you create a new mob and transfer your client's control to that mob, Login() is called again.

Hiead
In response to Bobthehobo
mob/spectator
icon= null
Move()
Login()
world<< "[usr.key] has logged in!"
..()
New()
loc= locate(7,7,1)
..()


Logout()
del(src)
world<< "[usr.key] has logged out!"
..()

world/mob= /mob/spectator

mob/creating_character
icon= null
Move()
Login()
world<< "[usr.key] is creating a character!"
sleep(10)
alert("You stand now on the Plains of Creation, wherein which your character will be born.")
usr.client.mob= new /mob/creating_character2()
..()



New()
loc= locate(7,92,1)
..()


Logout()
del(src)
..()

mob/creating_character2
var/mob/player
Login()
loc=locate(7,92,1)
var/playername= input("What name will you choose for your character?","Character Name")
switch(input("What gender will your character take after?","Choose Gender") in list("Male", "Female"))
if("Male")
player= new /mob/White_Male()
player.loc= locate(100,100,1)
player.name= playername

if("Female")
player= new/mob/White_Female()
player.loc= locate(100,100,1)
player.name= playername

src.client.mob= player
..()






turf
Plains_of_Creation
icon= 'plainsofcreation.bmp'

Title_Screen
icon= 'Titlescreen.bmp'

Start_Button
icon= 'Startbutton.bmp'

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

mob/White_Male
var/mob/player
icon= 'malewhite.dmi'
Login()
world<< "[player.name] has joined Armeli!"
..()

mob/White_Female
var/mob/player
icon= 'femalewhite.dmi'
Login()
world<< "[player.name] has joined Armeli!"
..()


So your saying the code should look like this? I've never seen it like this before. But I still get the runtime errors, regardless.
In response to Kireis
No put usr in proc, ungh

( <3 )