649 @verb #9239:"msg_task" this none this rx #7788 @program #9239:"msg_task" this none this return dur = max(this.suspend_dur, 60 + random(120)) here = this.location if (this:has_listeners()) "We have an audience, queue the task to be called again soon, and then do this now." this.clock_task = $clock:schedule(this, verb, {}, 0, 0, dur) else "Don't have an audience? Well, don't even play this then. Geez. :)" this.clock_task = 0 return endif connected = connected_players() "see if anybody is here and awake." "perhaps also pick somebody to sniff." sniffee = $nothing listeners = 0 for here_obj in (here.contents) if (here_obj in connected) "check and see if any players here are active." if (idle_seconds(here_obj) < 60) listeners = 1 endif "maybe pick a person to sniff." if (random(100) <= this.random_prob) sniffee = here_obj endif endif endfor "with probability .random_prob print one of the .random_msgs messages," "but half the time print the .sniff_msg message instead, but only if we" "chose a sniffee up above." "Hmm, quick bug fix." player = this.owner if (this.random_msgs && listeners && !is_player(this.location)) if (random(100) <= this.random_prob) if (random(10) <= 5) msg = this.random_msgs[random(length(this.random_msgs))] this.location:announce_all_but({this}, this:title(), " ", $msg:substitute(this, msg)) elseif (valid(sniffee)) this.location:announce_all_but({this}, this:title(), " ", $msg:substitute(this, this:sniff_msg(), sniffee)) endif endif endif . 0