View Single Post
Old 03-13-2004, 11:46 AM   #4
Yui Unifex
Senior Member
 
Join Date: Apr 2002
Location: Florida
Posts: 323
Yui Unifex is on a distinguished road
Send a message via ICQ to Yui Unifex Send a message via AIM to Yui Unifex
Question

I was just chastised for leaving out an essential part of our say command. Behold the power of Ruby!
[code] class Element
def dumbass (msg, &code)
if get("dumbass") then
send(msg)
dumbasses = get("dumbass").to_s
dumbasses.split(",").each { |dname|
person = Game.find_player dname
person.send(msg) if person
}
else
yield
end
end

def cmdSay (args)
return if args.empty?

msg = "<#{name}> #{args}\n"
dumbass(msg) {
room.broadcast(msg)
room.sendevent(EVENT_TEXT, self, args, args)
}
end[/quote]
Had some players getting too annoying, so we implemented a property for making messages they send only send to themselves or their little friends =). All without a reboot, btw.
Yui Unifex is offline   Reply With Quote