ID:142534
 
Code:
world/mob = /mob/creating_character


mob/creating_character
base_save_allowed = 0

Login()
spawn()
src.CreateCharacter()

proc/CreateCharacter()
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.

// Get the character information from them. (You would probably want to do with this a browser page.)
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/list/classes = list("Male", "Female","Neuter","Spitfire")
help_text = "Which Gender would you like to be? OR who would you like to be"
// default_value = "Male"
var/char_class = input(src, help_text, prompt_title, default_value) in classes
var/mob/new_mob
switch(char_class)
if ("Male") new_mob = new /mob/Male()
if ("Female") new_mob = new /mob/Female()
if ("Neuter") new_mob = new /mob/Neuter()
if ("Spitfire") new_mob = new /mob/Spitfire()
new_mob.name = char_name
src.client.mob = new_mob
var/turf/first_location = locate(14,31,1)
new_mob.Move(first_location)
del(src)
mob
var
M = 0
F = 0
N = 0
S = 0
client
North()
step(usr,NORTH)
South()
step(usr,SOUTH)
East()
step(usr,EAST)
West()
step(usr,WEST)
mob
Login()
..()

// This is just here for this sample, to make it clear which mob you've logged into.
sample_report()


verb
Save()
// This demonstrates verb saving and how to manually save the mob whenever you want..
// This proc gets added and saved as a verb only if add_verb is called by the player.
src.client.base_SaveMob()
src << "\red You have saved your game."

proc
sample_report()
src << "<BR><BR>"
src << "Your name is: [name]."
src << "Your gender is:[type]."


mob
Male
icon = 'Base.dmi'
Female
icon = 'BaseF.dmi'
Neuter
icon = 'BaseN.dmi'
Spitfire
icon = '1221.dmi'


Problem description:
i can only create a Male icon... idk why...
and when i login i get this:
Warning: type read from file (/mob/verb/rest) is not defined.
runtime error: wrong type of value for list
proc name: base LoadMob (/client/proc/base_LoadMob)
usr: ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter)
src: RanEsu (/client)
call stack:
RanEsu (/client): base LoadMob("RanEsu")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("RanEsu")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterMenu(/list (/list))
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterMenu(/list (/list))
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacter()
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Login()
runtime error: Cannot execute null.base CharacterNames().
proc name: ChooseCharacter (/mob/BaseCamp/ChoosingCharacter/proc/ChooseCharacter)
usr: ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter)
src: ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter)
call stack:
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacter()
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterResult("RanEsu")
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterMenu(/list (/list))
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacterMenu(/list (/list))
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): ChooseCharacter()
ChoosingCharacter (/mob/BaseCamp/ChoosingCharacter): Login()






and it sais somthing about a rest their too, so heres my rest code :(
mob
var
resting = 0
verb
Rest()
if(usr.resting)
sleep(100)
usr.resting=0
usr<<"You stop resting..."
usr.Frozen = 0
usr.icon_state = ""
return
else
if(usr.HP == usr.maxHP)
usr<<"You donīt need to Rest..."
return
usr<<"You begin to Rest..."
usr.resting=1
usr.Frozen = 1
usr.icon = 'rest.dmi'
usr.icon_state = gender
sleep(5)
usr.rest()
return

mob
proc
rest()
rest
if(usr.resting)
if(usr.HP < usr.maxHP)
usr.HP += usr.maxHP/10
if(usr.HP>usr.maxHP)
usr.HP=usr.maxHP
if(usr.HP==usr.maxHP)
usr.resting = 0
usr.Frozen = 0
usr.icon_state = ""
usr<<"You have finish resting..."
return
usr.Frozen = 1
sleep(15)
goto rest
else
sleep(20)
usr.resting = 0
usr.Frozen = 0
usr.icon_state = ""
usr<<"You have finish resting..."
if(usr.HP>usr.maxHP)
usr.HP=usr.maxHP
can anyone see whats wrong with this??? or to describe the runtime errors?
In response to RanEsu
I can see about a dozen things wrong with that. It would take me forever to thoroughly explain them all. Here's a list of bullet points, I guess:

1) Don't use usr in procs.
2) Don't use goto.
3) The client/North() / South() / etc. crap you did was worse than pointless and should be deleted.
4) Don't copy-and-paste demos, that's not what they're for. You're supposed to read them and learn from them.

Ugh, and the rest of the problems I can't really distill into bullet points. I guess I can suggest you remove that sleep(100) from the rest verb, because it just doesn't belong, and will cause an error that you may or may not find.

Oh, and those runtime errors are caused by the type paths saved in a savefile not matching the type paths that actually exist. You saved mob/verb/Rest(), but removed that verb, and so the program chokes when you try to add the nonexistent Rest verb.
In response to Garthor
ok, ty but what should i use instead of the
goto rest
line?
In response to RanEsu
A while() loop.