POO Library

Login and Logout functions

The implementor can define functions on object #0 which are automatically executed when a user logs in or out. The functions below may be useful for your POO, or can be easily adapted to your needs.
This login procedure prints a file called "welcome.txt" (located in the poofiles subdirectory) if it exists, announces the login, and causes the user to look at her surroundings.
@newfunc #0.login(self,who)
# print welcome message
try:
	file = open('welcome.txt')
	for line in file.readlines():
		print line[:-1]
except: pass

# announce the login to everyone
getObj('$universe').broadcast( who.name + " has connected.")

# look around
who.do_cmd("look")
.x

This logout function prints poofiles/goodbye.txt (if it exists), sends the user home if he's not already there, and announces the logout.
@newfunc #0.logout(self,who)
# print goodbye message
try:
	file = open('goodbye.txt')
	for line in file.readlines():
		print line[:-1]
except: pass

# if not home, go home
if who.location != who.home:
	who.do_cmd("@home")

# announce the disconnect to everyone
getObj('$universe').broadcast( who.name + " has disconnected.")
.x


http://www.strout.net/python/poo/lib/loginout.html
Last Updated: 6/28/97 . . . . . . Joe Strout