ID:149877
 
why is my logout beging called right after login evern when the usr does not logout?
Don't know... what's your login code look like?
In response to Xooxer
mob/create_character
var/nname
var/sex
var/mob/character
Login()
var/charactername = input("What is your name?","Name",src.key)
switch(input("What race are you??","Race","Type") in list("Human","Mage","Elf"))
if("Human")
character = new /mob/Human()
if("Mage")
**overlays += 'black_hair.dmi'**
character = new /mob/Mage()
if("Elf")
character = new /mob/Elf()
src << "Your name is [name]."
src << "<center><h1>\blue Welcome to Age of Metal.</h1>
Thanks for playing. This game was made by Scoobert. If you can find him in the game, talk to him about joining the army. If Im are not in this server, be careful. You never know who is in here, they cauld be really mean.</center>"
world << "\blue [usr.name] has joined"
usr.loc = locate(2,2,1)
character.name = charactername
src.client.mob = character
del(usr)
mob/Logout()
world << "\blue [usr.name] has left"
del(usr)

that the code, oh and see the part in stars**** like that, i cant get that to work right now
In response to Scoobert
del(usr) <-- that's calling your Logout(), I believe. You might want to put ..() at the begining of the Login() proc, I could be wrong... but that might help a bit...

~X
In response to Xooxer
With both login and logout your leaving out ..() so then the logout is being called in with login
In response to Super16
nope didnt make a diffrence
In response to Scoobert
Overlays isnt working because you need to implement that after the new mob because they can't put an overlay on something that isnt made also use src.overlays
In response to Super16
when i put it here:

mob/Mage
icon='person.dmi'
icon_state = "Mage"
race = "Mage"
src.overlays += 'black_hair.dmi'

i get this error:


main.dm:71:error:src.overlays:duplicate definition
main.dm:71:error:'black_hair.dmi':duplicate definition
main.dm:71:error:+= :instruction not allowed here

anyone know why?
In response to Scoobert
No dont use src.overlays in the mob code. also why dont you make a totally new icon with the hair on it instead of going through this hassle
In response to Super16
because overlays are supasta be easyer, and mu human and mage can have the same icon wirth diffrent over lays. and if i cant put it there wee can i put it???
In response to Super16
..() actually doesn't matter with Logout() because as soon as it's called the client is removed from the mob, and adding del(src) would cease all function.
Looking at your code I see you're switching mobs, everytime you switch a mob Logout is called for the old mob, and Login is called for the new, so your problem is you're not handling mob switching right, I suggest looking at Deadron's character handling library.
In response to Scoobert
Scoobert wrote:

src.client.mob = character

This calls Logout() for the current mob and Login() for the new mob. Login() and Logout() are used when a client connects to a mob. It has nothing directly to do with when a client joins or leaves the game. Those are handled by client/New() and client/Del().

Since your Deadronesque Login() code is defined only for create_character, it will only be called when a client logs into a create_character mob and not other mob types. You want to move your Logout() code to client/Del().
In response to Shadowdarke
by move do you mean change?
In response to Scoobert
Scoobert wrote:
by move do you mean change?

Yes, I tend to think graphically things, so when I change a segment of code from one path to another, I visualize lopping it off one branch of the tree and grafting it on in the other place. The code can sit in exactly the same place within your files. :)
In response to Scoobert
To put an overlay onto a mob at creation...you should put it into the mob's New() proc (it's a predefined proc that's there for you to override... if it isn't in your code...all you have to do is add it like my example below)... Like so:


mob/Mage
icon='person.dmi'
icon_state = "Mage"
race = "Mage"
New()
src.overlays += 'black_hair.dmi'

That should work...
In response to Nadrew
When I was making my game that threw me off at first. I thought Login and Logout were only called when you actually login and logout.

It shows that it pays to read your F1 help :)
In response to SuperSaiyanGokuX
ohh ok thanks