ID:261222
 
var/const/GM = "Lord of Water"
mob/Login()
if(ckey(src.key) == ckey(GM))
client.mob = /mob/GM
GM_ref = src
else
client.mob = /mob/Player
usr:Name()
src.loc = null
..()
mob
GM
Player


There are no compiled errors, but I am not a GM -or- a player when I log in. Both of them have verbs and stat panels, and the mob that I end up as has none of either.
client.mob = /mob/GM

else
client.mob = /mob/Player

There are no compiled errors, but I am not a GM -or- a player when I log in. Both of them have verbs and stat panels, and the mob that I end up as has none of either.

You need to instantiate those mobs.
In response to Spuzzum
Can you tell me how to instantiate them? If you mean making a new /mob/GM, it just keeps logging in, and loggin in, and reaches an infinite loop... I don't think I know just what you mean.

Thanks any way.
In response to Lord of Water
Lord of Water wrote:
Can you tell me how to instantiate them? If you mean making a new /mob/GM, it just keeps logging in, and loggin in, and reaches an infinite loop... I don't think I know just what you mean.

Thanks any way.

you need to start out as a seperate mob to begin, then test for your GM status, then create a new mob. Whats happening when you try to initialize new mobs with the code you have currently is each time you initialize a new mob, that same login code gets called again. You need to take the decision making login code out of the base mob Login().

world
mob = /mob/testforGM

mob
GM
Login()
..()
src << "GM"
Player
Login()
..()
src << "Player"
testforGM
Login()
if(client.ckey == "lord of water")
client.mob = new /mob/GM
else
client.mob = new /mob/Player


This is going to create a brand new player each time you log in, no saving or anything. You should probably check out Deadrons Character Handling, as there is much more functionality included already. The testforGM Login() code could be included in the mob/creating_character Login(), and you would be all set, with saving built in.

In response to Flick
That's OK, I don't want saving. Thanks for showing me the alternate mob method, though.
In response to Lord of Water
Lord of Water wrote:
Can you tell me how to instantiate them? If you mean making a new /mob/GM, it just keeps logging in, and loggin in, and reaches an infinite loop... I don't think I know just what you mean.

Thanks any way.

Thats the thing about Login(), its called on a mob when its created. You can bypass it through many methods, using an is_logged variable, checking the type of mob, etc.


Or you can do the check for GM at client/New()

Alathon
In response to Alathon
Called by a mob when it's created? This is quite wrong. It is called when a mob is stuck into it. mob/New() is called when it is created. Keep the two apart, and you will go far. Confuse them, and you will become confused.

Good day.
In response to Lord of Water
Lord of Water wrote:
Called by a mob when it's created? This is quite wrong. It is called when a mob is stuck into it. mob/New() is called when it is created. Keep the two apart, and you will go far. Confuse them, and you will become confused.

Good day.

It was a simple answer to a simple question, I did not believe I had to go into the exact details of how it works.

Alathon
In response to Alathon
But then, if I didn't know any better, I would have beleived you. -please-, for BYOND's newb community, get your facts right.
In response to Lord of Water
Lord of Water wrote:
Called by a mob when it's created? This is quite wrong. It is called when a mob is stuck into it. mob/New() is called when it is created. Keep the two apart, and you will go far. Confuse them, and you will become confused.

Good day.

Actually, this is quite wrong. It is called (from reference) 'when a player's client attempts to connect to a mob', not 'when a mob is stuck into it'. Clients and mobs are different. Keep the two apart, and you will go far. Confuse them, and you will become confused.

Good day. :P
In response to Flick
Ooh, I hate these things. Thank you for correcting me.