ID:270437
 
    Mute(client/C in players,duration as num|null,reason as null|text) //as null|anything
set category="Mod"
if(C)
if(duration)world<<"\red <b>[C.key] has been muted by [usr.key] for [duration] minutes. Reason: "
else world<<"\red <b>[C.key] has been muted by [usr.key]. Reason: [reason?"[reason]":"none"]"
muted["[C.ckey]"]=world.time+duration*60*10//muted["[C.ckey]"]=duration
muted["[C.address]"]=world.time+duration*60*10//muted["[C.address]"]=duration


Appearantly, I don't exist. This is in mod/verb (a datum, /mod).

Does anyone know why? The code never executed. I tried placing world< before if(C) but that returned a generic "C does not exist" runtime error.

Is this a BYOND Bug? What's going on?</<c>
Doubtful that it's a BYOND bug. Is players a list of clients (in my current project it's a list of player's mobs, and in some others I've done it's a list of /player datums.) If it's not a list of /client objects, there will be no client/C in the list.

Then, I can't believe that that mute verb would work. It ought to look something like this:

mob/verb/Mute(client/c as client,duration as null|num, reason as null|text)
set category = "Mod"
if(duration)
muted[c.ckey] = world.time + duration
muted[c.address] = world.time + duration
duration = "for [duration/60] minutes"
else
duration = "indefinitely"
muted[c.ckey] = -1
muted[c.address] = -1
if(reason) reason = " for [reason]"
world << "<font color=red><b>[c.key]] has been muted [duration] by [src.key][reason].</b></font>"


Perhaps your mute command works in some odd way that isn't apparent to me. Otherwise, you can take a look at what I wrote there.
In response to PirateHead
client/New() header.

client
command_text="say \""
New()
..()
world<<"\blue <b>[key] has logged in."
players+=src
ckey2key[ckey]=key


The ckey2key list works fine. This method allows the world to later say "[ckey2key(ckey)] has been automatically unmuted because the duration has exceeded.". It only works for keys that have logged in at least once, but then again, the mute and auto-kick lists are also temporary, and any permanant list would be a permanant kick anyway (without an auto-removal).

Anyway, if I make a verb called "translate" and put src<<ckey2key(ckey) in it, it outputs "Android Data" instead of "androiddata".

I have noticed something on your method that will improve it more, by using world.time instead of a proc which does a -= on the number every minute. It's much more efficent, so I thank you for that.

To make a long story short, yes, there are client objects in it. This may have something to do with it - sorry that I didn't tell you before: if I click the verb, the list contains "Android Data" (my client, appearantly) and """ (a single quote). I don't know what to make of it.
...and five seconds later, I find out the bug!

I'd like to take this brief message to formally say "thanks" to PirateHead for the new method I can use. Thanks, PirateHead!

What was wrong?

Mute(client/C in players,duration as num|null,reason as null|text) //after

Mute(client/C as null|anything in players,duration as num|null,reason as null|text) //before


Appearantly, "as null|anything" may not be used. I wonder why.

01000100011000010111010001100001
In response to Android Data
I never have good luck with null, but I doubt that was the problem. My guess is that you needed to state what C was, besides anything, because the variable had already been set to client. You might have been adding mobs to the list, rather than clients, creating a conflict of type between the variable and list.
In response to Android Data
Know what, I'll bet it's because you have as null|anything, then you expect the verb to come up with a list of avaliable clients... but since you put as null, it didn't? I avoid use of as null when there are multiple arguments involved, as a courtesy to the user. I would suggest doing the same, to enlist the aid of BYOND's neato auto-argument-helper-buddie.
In response to PirateHead
PirateHead wrote:
Know what, I'll bet it's because you have as null|anything, then you expect the verb to come up with a list of avaliable clients... but since you put as null, it didn't? I avoid use of as null when there are multiple arguments involved, as a courtesy to the user. I would suggest doing the same, to enlist the aid of BYOND's neato auto-argument-helper-buddie.
Normally, as null|anything in list provides an additional "Cancel" button which can be pressed to return null. That's the behavior I'd like, but appearantly it doesn't work in verbs.

01000100011000010111010001100001