ID:159852
 
I've been working with GScript with and I'm really out of touch with DM, I did a little re-reviewing with the Guides & References, but perhaps I skipped over sections with it.

I want to work with a verb that a user could disable a chat-channel (So to speak). Much like the disable "OOC" features many games support. Basically, I was looking for a little guidance to get me back on the right track? Anyone willing to lend me a hand?
I don't mean to sound pushy, just a bit paranoid that this is buried way back - It's been around a day's span since I posted this. If anyone has some guidance, that'd be nice.

If not, I'm just going to let this topic die and try to figure it out on my own.
In response to Swimchao
Well, I'd say that ways of implementing this depends on your preferences.

You could for example, depending on how many "channels" you have, go with simple lists.

Disable -> Subtract from list (sanity checks!)
Enable -> Add to list (sanity checks!)
Output -> Simply output to the list here
You could use the Tabs element in the skin editor and use multiple outputs for each "channel", then when you want to disable one, use the winset() function.

winset(ref,"windowID","is-disabled=true")
Or if you just mean something simple like muting the world (OOC I suppose)... Something along the lines of:
var/OCC_On = 1

mob/verb/OOC(txt as text)
if(!OOC_On) return
world << txt

mob/verb/Toggle_OOC()
OOC_On = !OOC_On
In response to Ephemerality
You can do that with the idea I posted with a loop :)

for(var/client/C in world)
winset(C,"OutputElementID","is-disabled=true")
Well it kind of depends on the implementation of your Chat-channels (So to speak :P), But like Schniti-poo said, you may aswell use lists... Uhh... Something like

ChannelDatum
var/list/chatters = list()
proc
Join(mob/M)
chatters += M
chatters << "[M] has joined us!" // I hope the << let's you do that :P
Leave(mob/M)
if(!(M in chatters)) return FALSE
chatters << "[M] has left us!" //Again, I hope this works
chatters -= M


As I was writing this onto my FireFox textarea, I got hit by a strange feeling that I'm way off what you needed?

:(
In response to Schnitzelnagler
Right, right. I'm picking up on all this.

However, what I still don't understand is: How would only one person be able to disable THEIR world? I don't know if that's worded properly.. So let me write it out stupidly.

Bill logs onto the game, doesn't want to hear nonsense being said world-wide, he clicks "IH8UALL" verb. This verb turns his world chat off in some form.. Thus, leaving him piece and quiet to do things in say with other people.
In response to Swimchao
well, the best way I could think of would be something like so..

mob/verb/IH8UALL()
src.OOC_channel=0

mob/verb/IMISSUALL()
src.OOC_channel=1

mob/verb/OOC(msg as text)
for(var/client/c)
if(c.OOC_channel)
c << msg


That should be what you are asking for really simply. Hope it helps or is what you were looking for exactly.

EDIT: Took out the "in world" part of my client loop.
In response to Haywire
Um, yeah. Just kinda ;p
In response to Mizukouken Ketsu
If he uses that, he shall edit the client/New() and check if the world is muted and if so setting the output id is-disable parameter to true or else just client(s) currently on the world will be muted and not the one that comes after it's muted.
In response to Dominico
Ah... I forgot about that. Thanks.

var/worldIsMuted = FALSE
client/New()
..()
if(worldIsMuted) winset(src,"OutputWindowID","is-disabled=true")
//Tack that into your code somewhere :)
In response to Mizukouken Ketsu
Note: that will not actually work as-is, and will not iterate through the loop at all. You must omit the 'in world' portion; the reason is that this expands to 'in world.contents', but the world.contents list only contains /atom objects, not objects of other types like /client.
Using a loop like for(var/type/X) appears to instead use an internal looping method, so it can use all/more types, including datums. Incidentally, this also appears to be a bit faster than looping through world.contents, so it's a good idea to use this method even for atoms. It's shorter to type, anyway.
In response to Kaioken
So...
for(var/mob/M in world)
if(M.client)
winset(M,"OutputWindowID","is-disabled=true")

...is better?
In response to Mizukouken Ketsu
No.

for(var/client/C)
winset(C,"OutputWindowID","is-disabled=true")
In response to Jeff8500
Ohhh. Thanks :)
In response to Jeff8500
As I'm too lazy to create a sample, host it and run a packet sniffer... setting the interface element "is-disabled=true" would still have the server send the messages, just not display them, right?
Or is BYOND actually smart enough to only send data that are used (like with resources)?

Since network transfer can get an issue with BYOND games rather fast it might be best to avoid it wherever possible.
In response to Schnitzelnagler
You could also have a global isWorldMuted kinda variable and check to see if it's true before the chat verb takes any real action o.O

mob/verb/Disable_Chat()
if(!global.isWorldMuted)
global.isWorldMuted = TRUE
return
global.isWorldMuted = FALSE

mob/verb/Chat()
if(global.isWorldMuted) return
var/msg = input("","") as text|null
if(!msg) return
for(var/mob/M)
if(M.client) M<<"[usr]: [msg]"