Home ] Up ] 

DSPK V02.00 Furcadia
* // title: Self Service Dynamic Image Swapper.
* // htmlname: dynselfserve
* // Created by: Dreamless Dancer, current version date: Oct-10-2003

* // begin swapping code
(0:0) When everything is starting up,
* // we use a timer system to avoid ambiguous errors we would get from (0:32)
* // if you already have timers in your code, be certain to avoid using that one here
* // if you're using variables like this, put this one with the rest.
    (5:300) set variable %tabletimer to the value 1.

* // set these to point to the objects used for each type of invocation
* // use distinct names to keep the code clear and understandable
* // demo uses two
    (5:300) set variable %tableclear to the value 182.
    (5:300) set variable %tablepizza to the value 2403.
    (5:300) set variable %tablesandwich to the value 2404.

* // repeat this for each table requiring service, keep track of your incrementing.
* // by using the same variable names for each table location, you can minimize
* // then overhead in tracking each table.
    (5:300) set variable %tablelocation1.x to the value 20.
    (5:300) set variable %tablelocation1.y to the value 14.

    (5:300) set variable %tablelocation2.x to the value 26.
    (5:300) set variable %tablelocation2.y to the value 14.

* // this ends the initialization chunk

* // start the table service chunk
* // exact word matching used, repeat for each gimme action desired. I demo 2 + clear
(0:31) When a furre says {gimme pizza},
    (5:350) set variable %servetable to the X,Y position the triggering furre (moved from/is standing at).
    (5:300) set variable %servefood to the value %tablepizza.
    (5:50) set countdown timer %tabletimer to go off in 1 seconds.

(0:31) When a furre says {gimme sandwich},
    (5:350) set variable %servetable to the X,Y position the triggering furre (moved from/is standing at).
    (5:300) set variable %servefood to the value %tablesandwich.
    (5:50) set countdown timer %tabletimer to go off in 1 seconds.

(0:31) When a furre says {clear table},
    (5:350) set variable %servetable to the X,Y position the triggering furre (moved from/is standing at).
    (5:300) set variable %servefood to the value %tableclear.
    (5:50) set countdown timer %tabletimer to go off in 1 seconds.

* // now create four point checker
* // this is all timer triggered to avoid ambiguous results from (0:32)
* // the (1:201) line is purely optional if you use %tabletimer for other code.
(0:50) When countdown timer %tabletimer goes off,
 (1:201) and variable %servetable.x is greater than 0.
    (5:301) copy the value of variable %servetable into variable %servetableNE.
    (5:352) move the position in variable %servetableNE northeast (up and right) 1 step(s).

    (5:301) copy the value of variable %servetable into variable %servetableSE.
    (5:353) move the position in variable %servetableSE southeast (down and right) 1 step(s).

    (5:301) copy the value of variable %servetable into variable %servetableNW.
    (5:355) move the position in variable %servetableNW northwest (up and left) 1 step(s).

    (5:301) copy the value of variable %servetable into variable %servetableSW.
    (5:354) move the position in variable %servetableSW southwest (down and left) 1 step(s).

* // swap tables with invocation request if table present NE/SE/SW/NW of the furre.
* // demo two tables, one needed for each table in array, increment the [#] for each
* // service chunk for each table. You will note that the only differences in each table
* // checking chunk is the second line where we copy the table to a local variable,
* // this keeps the code cleaner and easier to manage.

* // table 1
(0:50) When countdown timer %tabletimer goes off,
    (5:301) copy the value of variable %tablelocation1 into variable %colocation.
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableNE.x is equal to variable %colocation.x .
 (1:203) and variable %servetableNE.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableSE.x is equal to variable %colocation.x .
 (1:203) and variable %servetableSE.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableSW.x is equal to variable %colocation.x .
 (1:203) and variable %servetableSW.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableNW.x is equal to variable %colocation.x .
 (1:203) and variable %servetableNW.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).

* // table 2
(0:50) When countdown timer %tabletimer goes off,
    (5:301) copy the value of variable %tablelocation2 into variable %colocation.
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableNE.x is equal to variable %colocation.x .
 (1:203) and variable %servetableNE.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableSE.x is equal to variable %colocation.x .
 (1:203) and variable %servetableSE.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableSW.x is equal to variable %colocation.x .
 (1:203) and variable %servetableSW.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).
(0:50) When countdown timer %tabletimer goes off,
 (1:203) and variable %servetableNW.x is equal to variable %colocation.x .
 (1:203) and variable %servetableNW.y is equal to variable %colocation.y .
    (5:41) place object type %servefood at (%colocation).

* // cleanup, only needed with the (1:201) Additional conditions check above
* // if you decide to really make weird changes to the code, at this time
* // I cannot think of any. :)
(0:50) When countdown timer %tabletimer goes off,
    (5:300) set variable %servetable.x to the value 0.
    (5:300) set variable %servetable.y to the value 0.

* // this ends the service routine, because of we use a timer, it is possible
* // for unexpected results when two furre request different things at the same time.
* // so, blame it on the staff.

*Endtriggers* 8888 *Endtriggers*