ID:151217
 
Here's the code(You might want to jump to the bottom first)
/*************
Everything below is sample code -- you will need to change it to fit your own game.
*************/

mob/choosing_character/proc/CreateNewCharacter()
// 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 = prompt(src, prompt_title, default_value, help_text) as null|text

if (!char_name)
// Guess they don't want to create a new character after all, so return them to the character list.
src.ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = CharacterList()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateNewCharacter()
return

var/list/races = list("Kid", "Gramps")
help_text = "Which race would you like to be?"
default_value = "Kid"
var/char_race = prompt(src, prompt_title, default_value, help_text) in races

var/list/colors = list("Blue", "Brown", "Turquoise")
help_text = "What eye color do you want?"
default_value = "Brown"
var/eye_color = prompt(src, prompt_title, default_value, help_text) in colors

// Okay we have enough information, so it's time to create the character and switch the player to it.
var/mob/new_mob
switch(char_race)
if ("Gramps") new_mob = new /mob/Gramps()
if ("Kid") new_mob = new /mob/Kid()

// Set the attributes.
new_mob.name = char_name
new_mob.eye_color = eye_color

// Now switch the player client over to the new mob and delete myself since I'm no longer needed.
src.client.mob = new_mob
del(src)

mob
var
eye_color

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

proc
sample_report()
src << "

"
src << "\blue You are [name]."
src << "\blue Your class is [type]."
src << "\blue Your eye color is [eye_color]."

mob/Kid
icon='player.dmi'

mob/Gramps
icon='player.dmi'


///////////////////////////////////////////////////
But when I compile I get the error:
OS.dme:16:error:mob/:expected a constant expression

The problem is in the main code file, here's the part of the code that I need help on

world // default world parameters
mob = mob/
.........^
What do I put here?
Thanks,
Gilser

On 2/18/01 6:44 pm Gilser wrote:
///////////////////////////////////////////////////
But when I compile I get the error:
OS.dme:16:error:mob/:expected a constant expression

The problem is in the main code file, here's the part of the code that I need help on

world // default world parameters
mob = mob/
.........^
What do I put here?

mob = /mob/...

Need that / in front of the class type.