mob/other/choosing_character/Login()
..()
if(src.created == 0)
src.CreateNewCharacter()
src.loc = locate(1,1,1)
world << "[src] has joined the world"
world
proc
ReSpawn()
world << "Repop!"
Repop()
spawn(60000)
ReSpawn()
New()
..()
ReSpawn()
mob/Logout()
usr.login = 0
world << "[src.name] logs out..."
del(src)
client/proc/SaveMob()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
var/char_ckey = cKey(src.mob.name)
F["/[ckey]/[char_ckey]"]<<src.mob
client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob
client/Del()
if (istype(src.mob, /mob/other/choosing_character))
return ..()
src.SaveMob()
return ..()
mob/other/choosing_character/proc/CreateNewCharacter()
var/prompt_title = "Character Creation"
var/help_text = "What is your name? REMEMBER: Please use appropriate, RP names."
var/default_value = "[src.key]"
var/char_name = input(src, help_text, prompt_title, default_value) as text
var/list/avatars = list("Lan","Mayl","Dex","Yai","Chaud")
var/avatar = input(src,"Which avatar would you like?","Character Creation") in list(avatars)
var/mob/new_mob
switch(avatar)
if("Lan")
new_mob = new /mob/avatar/Lan()
if("Mayl")
new_mob = new /mob/avatar/Mayl()
if("Yai")
new_mob = new /mob/avatar/Yai()
if("Dex")
new_mob = new /mob/avatar/Dex
if("Chaud")
new_mob = new /mob/avatar/Chaud
new_mob.oicon = new_mob.icon
new_mob.exp = 0
new_mob.name = char_name
src.client.mob = new_mob
var/turf/first_location = locate(1,1,1)
new_mob.loc = first_location
src.created = 1
del(src)
mob
Login()
..()
if (!istype(src, /mob/other/choosing_character))
sample_report()
Write(savefile/F)
..()
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z
Read(savefile/F)
..()
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x, last_y, last_z)
proc
sample_report()
Here's my runtime error
runtime error: Cannot read null.icon
proc name: CreateNewCharacter (/mob/other/choosing_character/proc/CreateNewCharacter)
usr: Delita12345 (/mob/other/choosing_character)
src: Delita12345 (/mob/other/choosing_character)
call stack:
Delita12345 (/mob/other/choosing_character): CreateNewCharacter()
Delita12345 (/mob/other/choosing_character): Login()
I would really appreciate any and all help. Thanks in advance! Also could you tell me how to process information from HTML popups? like you click on a character and your avatar is that character you clicked.
(PS) sorry about such a huge post
"avatars" is already a list, so you don't want to say again that it's a list. What it's doing is making a list of a list. Envision placing the avatar names in a box, and then putting the box in another, larger box. Then pick one object out of the larger box. But there's only one object in there; the smaller box. So input() is detecting that there's only one option. Because of that, it automatically selects that option without asking the player. So the "avatar" var ends up equalling the same as the "avatars" list!
As I said before, the "avatar" var is actually a list; not a text string. So it won't equal any of those names, and thus new_mob is never actually created! Which means that this line:
...causes an error, because new_mob is null.
Look up client/Topic() in the reference. If you want a more complicated interface than just clicking a single image or link, then use the Dantom.htmllib library to use HTML forms in the popups. (By forms, I mean like this posting system, with multiple text boxes and buttons.)