ID:1826454
 
(See the best response by Hedgemistress.)
Code:
world
mob = /mob/PC
mob/PC
var/tmp
list/chat_color[] = list("gm name"="#FF0000", "own name"="#8C8C8C", "emote text"="#9C009C", "info text"="#0000FF", "default"="#000000")
list/ignore_list = new()
obj/Stage/current_stage
current_game_type
message_left
busy
item_num = 1
sleep_in_menu
credits

Login()

loc = locate(/area/start)
..()


Problem description: I'm somewhat a novice to this though I understand the basics, but I can't figure this out. Above I've given a set of variables from my mob/PC object, Login() and my world/mob code. The idea is so that the user's mob is defaulted to mob/PC instead of just mob so the player mob has access to variables that other mobs can't. I followed several help topics and none worked (and a lot of them have Login in the mob/PC object when logging in as a PC mob for example). Can someone explain to me where I'm going wrong and maybe give examples.
Well, to judge by the code you've posted here, it looks like you have Login() indented one too many times... see, you're dfining it under "mob/PC/var/tmp", when it should be under "mob/PC". The procedure and all its contents should all have one fewer tab than they do.

If you don't have a handle on what the tabs and slashes mean, that would be the next place I'd suggest boning up. Everything that "belongs to" mob/PC needs to be indented one more time than mob/PC. Everything that belongs to mob/PC/Login needs to be indented one more time than Login(), and so on.
Agh, it wasn't like that in the actual code, It kinda was a last second add in when I found out it also didn't work so I must of pasted it on a stray tab accidentally. It's not under mob/PC/var/tmp in the actual code. Heres a recopy of the actual code

mob/PC
var/tmp
list/chat_color[] = list("gm name"="#FF0000", "own name"="#8C8C8C", "emote text"="#9C009C", "info text"="#0000FF", "default"="#000000")
list/ignore_list = new()
//obj/Stage/current_stage //Move to PC
//current_game_type //Move to PC
//message_left //Move to PC
//busy //Move to PC
//item_num = 1 //Move to PC
//sleep_in_menu //Move to PC
//credits //Move to PC

Login()

loc = locate(/area/start)
..()
Best response
Ah! I think I see the problem, then.

You see that ..() at the end of Login? That's a supercall/parentcall. It means "Go up a level and do the thing you'd do there." So at the end of mob/PC/Login(), you are passing the proecure to mob/Login(). And unless you've overwritten mob/Login, what that proc does is move you to the open turf closest to 1,1,1.

So what's happening here is that you are moving your character to the designated start location, and then immediately undoing that.

Drop the ..() and it should work fine.

Don't just put ..() in for the heck of it. Use it when and where there's some default or higher-level function you need to preserver. For instance, if you have a mob/PC/admin that you need to give extra stuff to but you want the same login procedure for regular PCs to run, you'd put ..() at the end of mob/PC/admin/Login.
Reason that's there is because it was originally mob/Login() before I wanted to make it mob/PC/Login(). It's when I moved it to mob/PC/Login() that it stopped working. I removed the ..() and it's still not executing mob/PC/Login() proc. Moved it back to mob/Login() and it works fine. Even src.client.mob = new/mob/PC isn't working and that was also pointed out in the forum.

Edit: Reread my code and it seems like world/mob = /mob/PC was somehow deleted from it. It works now. Must of happened yesterday when I went downstairs during the day with an over curious 2 yr. old niece who likes to press buttons. Better be more careful next time. Gonna see if those vars will now work (the other problem).