ID:267777
 
The whole login code.

#include
client/base_num_characters_allowed = 3
mob/Login()
usr.name = input("Choose a name for your character.",
"Your Name",
usr.name)

usr.gender = input("Select a gender for your character.",
"Your Gender",
usr.gender) in list("male","female")

usr.clan = input("Choose a clan for your character.",
"Your Clan",
usr.clan) in list("Badger","Brotherhood of Shinsei","Centipede","Crab","Crane","Dragon","Dragonfly","Fa lcon","Fox","Hare","Lion","Mantis","Monkey","Naga","Nezumi (Ratling)","Ninja","Ox","Phoenix","Scorpion","Shadowlands Horde","Sparrow","Spirit","Tortoise","Toturi's Army","Unaligned Ronin","Unicorn","Wasp","Yoritomo's Alliance")

usr.class = input("Choose a class for your character.",
"Your Class",
usr.gender) in list("Samurai","Shugenja")

I wanted to keep it simple yet use Char. Handling and Base Camp. When you log in the normal window comes up, create, delete, for create character, if you already have a character, it still re-routes you to the normal login procedures, also for deleting a character, it frrexes once attempted.

I appreciate you're help.

-Shiba Arai
You can't use the regular mob/Login() for character handling routines and expect to avoid trouble. What you need to do is set world.mob to some subtype like /mob/creating_character, and then move all your character handling stuff over to mob/creating_character/Login() instead.

Note: When you use character handling, the regular mob/Login() is not usr-safe. You'll have to use src exclusively there, which is better anyway.

Lummox JR
In response to Lummox JR
So it is possible to keep my code shorter and cleaner while implementing character handling?

Ah, yes, switching mob/Login() with mob/creating_character/Login() did work, thank you.

Hmm...when you log in if you already have a character you may go to the game, but if you wsih to create a new one, you are sent right to the game skipping all of the creation.
In response to Shiba Arai
I am working on a text MUD engine, and here is the location code:

area
var/area
north_exit
south_exit
east_exit
west_exit

Entered()
usr << name
return ..()

Castle
Main_Gate
north_exit = .Castle_Entryway
south_exit = .Moat_Bridge
Castle_Entryway
south_exit = .Main_Gate
Moat_Bridge
north_exit = .Main_Gate
south_exit = .Village/Guard_Post
Village
Guard_Post
north_exit = .Castle/Moat_Bridge
south_exit = .Square
Square
north_exit = .Guard_Post

//handle movement
client/Move(Dest,Dir)
var/area/room = usr.loc
if(istype(room)) //in a room
switch(Dir)
if(NORTH) Dest = room.north_exit
if(SOUTH) Dest = room.south_exit
if(EAST) Dest = room.east_exit
if(WEST) Dest = room.west_exit
return ..()

//set the starting position for new logins
mob/Login()
if(!loc) Move(locate(/area/Castle/Main_Gate))
return ..()

But, when you log in it says that you're at the main gate, but when you try to go any other direction, it gets a runtime error similar to this one:

runtime error: Cannot execute null.Enter().
proc name: Move (/client/Move)
source file: Engine.dm,37
usr: Shiba Arai (/mob)
src: Shiba Arai (/client)
call stack:
Shiba Arai (/client): Move(/area/Castle/Castle_Entryway (/area/Castle/Castle_Entryway), 1)
runtime error: Cannot execute null.Enter().
proc name: Move (/client/Move)
source file: Engine.dm,37
usr: Shiba Arai (/mob)
src: Shiba Arai (/client)
call stack:
In response to Shiba Arai
I might be wrong but I don't think the move directions are specified right. Try north=/area/castle/entry instead of with the .

In response to Shiba Arai
No put usr in Entered(). Ungh.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
No put usr in Entered()

...that used to be proc

oh well, any way null.entered means (lets say theres a guy called bob) bob walks onto the turf, but he gets deleted....there for instead of calling bob.entered()
its called null.entered() (altho inthis case he isnt getting deleted, but that means it isnt being defined correctly)
In response to Wanabe
That's not how entered works. It works atom.Entered(atom/movable) //atom = turf, atom/movable = bob.