Generic Scripted Object (#826)

(an instance of generic thing made by Marcus)

     You don't see much. It's a block. It might be fun to play with?

Go to location of this object, wooden box.

After a moment, something begins to happen...
     A block. A script.
     Spam your friends!
     The possibilities are endless.


HELP MANUAL:
     The Generic Scripted Object is a simple toy.
     Descendents of it have a property, .script, a list of lines to be played to the room.
     @notedit .script to write your script.
     The lag between lines may be changed with @setdelay  to . (The default 
setting is 4).




VERB SOURCE CODE:

play perf*orm:
if (this.location != player)
    player:tell($string_utils:pronoun_sub(this.not_wearing_msg));
elseif ($code_utils:task_valid(this.runtask))
    player:tell(this.name, " is already playing...");
else
    player:tell($string_utils:pronoun_sub(this.perform_msg));
    player.location:announce($string_utils:pronoun_sub(this.operform_msg));
    suspend(this.delay);
    this:play_script(@args);
    while (this.playing)
        suspend(this.delay);
    endwhile
    player:tell($string_utils:pronoun_sub(this.finished_msg));
    player.location:announce($string_utils:pronoun_sub(this.ofinished_msg));
endif
.


stop halt:
" interrupts the script in mid-performance... ";
if (this.playing)
    kill_task(this.runtask);
    this.runtask = 0;
    this.playing = 0;
else
    player:tell(this.name, " is quiet at the moment.");
endif
.


play_script:
this.playing = 1;
fork runtask (0)
    this.runtask = runtask;
    script = this.script;
    for line in (script)
        if (this.location == player)
            player.location:announce_all(line);
        else
            this.location:announce_all(line);
        endif
        suspend(this.delay);
    endfor
    this.playing = 0;
endfork
.


@setdelay:
" sets the interval between lines when the script is performed ";
if (player != this.owner)
    player:tell("You're not allowed to set the delay on this ", this.name);
else
    this.delay = tonum(iobjstr);
    player:tell("You set the delay on ", this.name, " to ", this.delay, " seconds.");
endif
.


credits:
for line in (this.credits)
    player:tell(this.name, " ::  ", line);
endfor
.



PROPERTY DATA:
      script
      not_wearing_msg
      delay
      perform_msg
      operform_msg
      finished_msg
      ofinished_msg
      runtask
      playing
      credits
      help_msg

CHILDREN:
Noh Mask feather boa a caress a leather mask Princess Mask T'ai Chi Classics a clod of earth thought transformation Inner Smile Generic Costume framework testmovie a star ScriptedObject battery-powered radio pomegranate a coil of darkness whip