mob/BaseCamp/ChoosingCharacter
ChooseCharacterMenu(list/menu)
var/menu_rows = ""
for (var/item in menu)
menu_rows += {"<tr><td align="center" color="red"><a href="?menu=choosing_character;choice=[item];src=\ref[src]">\[[item]]</a></td></tr>"}
var/page = {"
<body bgcolor=black scroll=no>
<center>
<h2><font color="red">Welcome [world.name]!</font></h2>
<b><i>Choose a character</i></b><br><br>
<table border=1 cellpadding=3>
[menu_rows]
</table>
</center>
"}
// Send them the page.
src << browse(page, "window=CharacterMenu;titlebar=0;can_close=0;can_minimize=0;size=600x400")
DeleteCharacterMenu(list/menu)
var/menu_rows = ""
for (var/item in menu)
menu_rows += {"<tr><td align="center" color="red"><a href="?menu=deleting_character;choice=[item];src=\ref[src]">\[[item]]</a></td></tr>"}
var/page = {"
<body bgcolor=black scroll=no>
<center>
<h2><font color="red">Deleting character!</font></h2>
<b><i>Choose who want to delete</i></b><br><br>
<table border=1 cellpadding=3>
[menu_rows]
</table>
</center>
"}
src << browse(page, "window=CharacterMenu;titlebar=0;can_close=0;can_minimize=0;size=250x300")
Topic(href, href_list[])
var/menu = href_list["menu"]
switch(menu)
if ("choosing_character")
// Close the menu window.
src << browse(null, "window=CharacterMenu")
var/choice = href_list["choice"]
ChooseCharacterResult(choice)
return
if ("deleting_character")
// Close the menu window.
src << browse(null, "window=CharacterMenu")
var/choice = href_list["choice"]
DeleteCharacterResult(choice)
return
// If we got this far, this didn't come from one of our links, so let superclass handle.
return ..()
world/mob = /mob/creating_character
mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.
var
Form/NewCharacter/char_form = new()
error_text = "" // For error text if they fill out the form wrong.
Login()
// Spawn here to avoid problems with calling prompts during login.
spawn()
src.char_form.DisplayForm()
// Don't want any verbs accessible.
RemoveVerbs()
return
Stat()
// No statpanels.
return
proc/RemoveVerbs()
for (var/item in verbs)
verbs -= item
return
Form/NewCharacter
form_window = "window=NewCharacter;titlebar=0;can_close=0;can_minimize=0;size=250x300"
var
name
Class
gender
gender_1 = "Male"
gender_2 = "Female"
Initialize()
if (!name) name = usr.key
if (!gender) gender = "Male"
if (!Class) Class = "Human"
HtmlLayout()
var/mob/creating_character/player = usr
var/page = {"<body bgcolor=black>
<font color=red><b>[player.error_text]</b><br>
<table>
<tr><td><b><font color=red>Name:</b></td><td>[name]</td></tr>
<tr><td> </td><td> </td></tr>
<tr><td><b><font color=red>Gender:</b></td>
<td>
[gender_1] <font color=red>Male<br>
[gender_2] <font color=red>Female
</td>
<tr><td> </td><td> </td></tr>
<tr><td><b><font color=red>Class:</b></td><td>[Class]</td>
<tr><td> </td><td> </td></tr>
<tr><td> </td><td>[submit][reset]</td></tr>
</table>
"}
return page
ProcessForm()
var/mob/creating_character/player = usr
var/ckey_name = ckey(name)
if (!ckey_name || ckey_name == "")
player.error_text = "Your name must have alpha-numeric characters in it!"
DisplayForm()
return
var/mob/new_mob
new_mob.Class= Class
new_mob.name = name
switch(gender)
if ("Male") new_mob.gender = MALE
if ("Female") new_mob.gender = FEMALE
// Log their client into the new mob.
usr.client.mob = new_mob
new_mob << browse(null, "window=NewCharacter")
return
Problem description:for some unknown reason when i click the submit form on this it doesnt call ProcessForm() what can i do to fix this?
Lummox JR