ID:179551
 
I don't see why my login doesn't work, it always asks the questions for creating new character, even if you select an old character.


#include

world
mob = /mob/creating_character


client
base_num_characters_allowed = 5


mob/creating_character


Login()

spawn()
src.CreateCharacter()

proc/CreateCharacter()

var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)

client.base_ChooseCharacter()
return


var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return
var/race = input("What do you want to be?","Class") in list ("Thief","Warrior","Sorceror","Wizard")
switch(race)
if("Thief")
icon='mobs.dmi'
icon_state="Thief"

if("Warrior")
icon='mobs.dmi'
icon_state="Warrior"

if("Wizard")
icon='mobs.dmi'
icon_state="Wizard"

if("Sorceror")
icon='mobs.dmi'
icon_state="Sorceror"
src.Move(locate(29,22,1))

..()




Whats wrong with the code?
Is it that no one knows or im being ignored?
In response to Switch
Don't bump posts.
In response to Nadrew
Whats that?
Nadrew instead of explaing just givehim your link to the forum rules.
In response to Switch
I normally leave problems with Deadron's libraries to Deadron, but it's possible he missed this one since your subject line doesn't describe the problem at all. I hope Nadrew's posting guielines includes a section about meaningful subject lines. I expected a graphics problem from the subject line you gave. Something like "Having trouble with Deadron's Character Handling library" would have been much better, and Deadron would probably have already answered you.

At any rate, the problem is that you are leaving the player as a /mob/creating_character and only changing the icon and icon state. Every time you log in to a creating_character mob, you get the character menu. Any time you change mobs, the Login() proc for that mob is called, so loading a creating_character logs you into it and you get the menu all over again.

Deadron's library is designed for you to assign a new mob of a different type for the newly designed character. Look at the original implimentation.dm that comes with Deadron's library and look closely at how new_mob is used to create a new mob and log the client into that one. If you don't want to have a separate mob type for each class, you can simply change new_mob.icon and new_mob.icon_state just like you changed the creating_character's icon in your current code.
In response to Shadowdarke
Shadowdarke wrote:
I hope Nadrew's posting guielines includes a section about meaningful subject lines.


You bet it does!


-Nadrew