ID:2424893
 
Dream Daemon has the "Send Announcement" feature which just sends a message to everyone logged in.

Is there a way to trigger a proc when one of these announcements are received through the server?

I basically want to use it as a sort of console command input.

So I could do something like this...

Send a server announcement with the text "cmd chat_on" or "cmd chat_off"

Server_Announcement(announce_msg)
switch(announce_msg)
if("cmd chat_on") world_chat = 1
if("cmd chat_off") world_chat = 0
return


this would toggle on a global var which could be used...

Global_Chat(msg as text)
if(!msg) return
world << "[usr.name]: [msg]"
if(world_chat) world.log << "[usr.key]: [msg]"
return


like this to cause the in-game chat to start being output to dream daemon as well.

I know the above code isn't correct, but that's what I mean with a proc triggering off of the server announcement.
Rather than the announcement feature, you could send a topic message. The point of that is to call world.Topic(), so it's probably more what you're after.
hmm. So if i send a topic message.

the proc

world/Topic(T)


would get called with T being the content of the message?
world/Topic(DATA)
var list/tokens = splittext(DATA," ")
if(tokens && tokens.len > 1)
switch(tokens[1])
if("cmd")
switch(tokens[2])
if("chat_on") {world_chat = TRUE}
if("chat_off") {world_chat = FALSE}