ID:145555
 
Code:
//client/Topic()
if("New")
if(list["process"]=="y")
var/mob/new_mob
var/ntype=text2path("/mob/[list["race"]]")
new_mob=new ntype
new_mob.name=list["user"]
new_mob.gender=list["gender"]
usr<<"Your name is now [list["user"]]."
usr<<" Your race is now [list["race"]]."
usr<<" Your gender is now [uppertext(copytext(new_mob.gender,1,2))+copytext(new_mob.gender,2)]."
usr<<browse(null,"window=LoginWindow")
names+=lowertext(list["user"])
mob=new_mob
del usr
if(list["process"]=="n") {usr.client.Topic("action=New",list("action"="New"));return}
if(list["confirm"])
var/user=NameProcess(list["user"])
if(lowertext(user)in names) {usr<<"Your name is already in use by another player.";return}
if(lentext(user)<3) {usr<<"Your name must be larger than 2 characters.";return}
if(!user) {usr<<"You must select a name that can only contain letters, and optionally the following characters- <b>' . - `</b>";return}
var/done
for(var/A in alphabet)if(findtext(user,A)){done=1;break}
if(!done){usr<<"Your name must contain a letter.";return}
usr.mainpage+={"
Are you happy with these settings?
<br><br>
<form action="?" method="get">
<input type="hidden" name="action" value="New">
<input type="hidden" value="
[user]" name="user">
[(list["gender"]=="female")?"<input type='hidden' name='gender' value='female'>":"<input type='hidden' name='gender' value='male'>"]
<input type="hidden" value="
[list["race"]]" name="race">
<br><br><b>Name</b>:
[user]
<br><b>Race</b>:
[list["race"]]
<br><b>Gender</b>:
[uppertext(copytext(list["gender"],1,2))+copytext(list["gender"],2)]
<center><br>Yes <input type="radio" value="y" name="process" checked> No <input name="process" type="radio" value="n">
<br><input type="submit" value="Submit"></center>
</form>
</td>
</tr>
<tr><td colspan="2">FOOTER</td></tr>
</table>
</body>
</html>
"}

usr<<browse(usr.mainpage,"window=LoginWindow,size=550x320,can_close=0")
usr.mainpage=initial(usr.mainpage)
return
usr.mainpage+={"
<form name="input" action="?" method="get">
<input type="hidden" name="action" value="New">
<input type="hidden" name="confirm" value="1">
<b>Name: </b><input type="text" name="user" value="
[(usr.key)?"[usr.key]":]">
<br><br>
<b>Gender:</b>
<input type="radio" name="gender" value="male" checked><b>Male</b>
<input type="radio" name="gender" value="female"><b>Female</b>
<br><br>
<b>Race:</b> <select name="race">
<option value="Human">Human
<option value="Elf">Elf
</select>
<br><br><center><input type="submit" value="Submit"></center>
</form>
</td>
</tr>
<tr><td colspan="2">FOOTER</td></tr>
</table>
</body>
</html>
"}

usr<<browse(usr.mainpage,"window=LoginWindow,size=550x320,can_close=0")
usr.mainpage=initial(usr.mainpage)


Problem description: For some reason, when I accept that I like my statistics and log in, it gives me a runtime error stating "Cannot read null.mainpage", if I removed the ternary statement and just used usr.key, then it says "Cannot read null.key". Line 203 is '"}'.

runtime error: Cannot read null.key
proc name: Topic (/client/Topic)
source file: Rise of Power.dm,203
usr: null
src: Artemio (/client)
call stack:
Artemio (/client): Topic("action=New&user=Artemiower&gen...", /list (/list))


you must have taken away the key of sumthing...try not to manipulate the key because that could cause problems
In response to Budboinker
That was a bit useless, I need to use the key obviously.

edit: Oh, just reread it. I didn't take the key away from anything, the only thing relevant to that would be setting mob to a typecasted mob variable containing the new information for the mob.
Woops! I forgot to return on that first if() statement after deleting usr.