MPI Wind Toy demo

From Redwall MUCK Wiki

Wind Demo - Passive (Background) Object

@create tree==bgobj

lsedit $bgobj=ldesc

.del 1 999

A small frail tree with golden tinged leaves starting to fall off it's witherd branches.

.end

@desc $bgobj={lexec:ldesc}

@lock $bgobj=me&!me

@set $bgobj=x

@set $bgobj=z

@flock $bgobj=me

@force $bgobj=status #ic

@set $bgobj=!z

@flock $bgobj=$bgobj

@action start_bg;stop_bg;faster_bg;slower_bg=$bgobj

@link stop_bg=$nothing

lsedit start_bg=start_bg.cmd

.del 1 999

{if: {eq:{prop:islit},Yes},

   Your object is already sending messages.

,

   Starting it now.

   {null:{store:30,delaysecs}}

   {null:{store:Yes,islit}}

   {null:

      {store:

         {delay:

            {prop:delaysecs}

         ,

            {lit:

               {lexec:showmessages}

            }

         }

      ,

         pid

      }

   }

}

.end

lsedit start_bg=stop_bg.cmd

.del 1 999

{if: {eq:{prop:islit},Yes},

   You are stopping the background messags.

   {null:{kill:{prop:pid}}}

   {null:{store:No,islit}}

,

   No messages are being output.

}

.end

lsedit start_bg=faster_bg.cmd

.del 1 999

{if: {eq:{prop:islit},Yes},

   {if: {lt:{prop:delaysecs},5},

       Messags can't come out more rapidly.

   ,

       {null:{store:{subt:{prop:delaysecs},3},delaysecs}}

       You increse the number of messages per time unit.

   }

,

   No messages are coming at all. start_bg needed.

}

.end

lsedit start_bg=slower_bg.cmd

.del 1 999

{if: {eq:{prop:islit},Yes},

   {if: {gt:{prop:delaysecs},55},

       You can't slow down the messages any further.

   ,

       {null:{store:{add:{prop:delaysecs},3},delaysecs}}

       You slow down the number of messages shown per time unit.

   }

,

   No messages are coming at all. start_bg needed.

}

.end

lsedit start_bg=showmessages

.del 1 999

{null:{force:{prop:myobject}, spoof {rand:bg_descs}}}

{null:

    {store:

        {delay:

            {prop:delaysecs}

        ,

            {lit:

               {lexec:showmessages}

            }

        }

          ,

             pid

    }

}

.end

lsedit start_bg=bg_descs

.del 1 999

The wind blows slightly through the trees, russeling the leaves.

A gust of wind sweeps a few leaves across your footpaws.

A leaf floats idly through the wind.

.end

@succ start_bg={lexec:{&cmd}.cmd}

drop tree

Type start_bg to start showing messages, stop_bg to stop, faster_bg to show them often, and slower_bg to slow them down.

Be sure to @set start_bg=myobject:#id of the object created for this to work!

E.g., do a look, and if the stone is #3432, then enter:

@set start_bg=myobject:#3432

The name 'myobject' is exactly as it should be (don't put 'tree')

See Also