Page 1 of 1

Guide to writing Decorations

PostPosted: Wed Aug 01, 2012 9:40 pm
by Amaikokonut
Decoration agents are painfully simple to write-- in fact, it probably takes more time to write the PRAYfile than the code, unless you want to include some really snazzy special actions.

This is your basic code for a decoration agent:

Code: Select all
new: simp 1 99 [spcs] "[sprite]" 1 0 500
mvto game "ch_x" game "ch_y"

scrp 1 99 [spcs] 1001
*special action 1
endm

scrp 1 99 [spcs] 1002
*special action 2
endm

scrp 1 99 [spcs] 1003
*special action 3
endm

scrp 1 99 [spcs] 1004
*special action 4
endm


rscr
enum 1 99 [spcs]
   kill targ
next


Unless you plan on actually including special actions in your scripts, you don't have to include those scrp lines either, meaning the only code you need is:

Code: Select all
new: simp 1 99 [spcs] "[sprite]" 1 0 500
mvto game "ch_x" game "ch_y"

rscr
enum 1 99 [spcs]
   kill targ
next

How's that for simple?

Important things to note:
- The family/genus must always be 1/99 -- that's how the deco panel tells it's a decoration.
- it has to be a simple, not a compound agent, else it won't show up with the box-selection properly (Turns out LINE doesn't play nice with compound agents) >:
- You cannot change the ATTR (well, you can try, but the deco panel will reset it). Deco agents will always be invisible to creatures, no matter what.
- If you want to get really creative and include other scripts in your deco agents, keep in mind that the following are already used with the garden box deco panel:
     - 1 (Activate 1/Select)
     - 4 (Pickup)
     - 10 (Creation/Self-select)
     - 75 (Mouse movement)
     - 1001-1004 (Special Actions-- you can use these obviously, for their intended purpose)
     - 2000 (Plane Change)
If you use any of these scripts in your deco agent, they're unlikely to work properly.

If you're confused or have any questions, don't hesitate to post them here. Otherwise, have fun! The decoration possibilities are endless.

Re: Guide to writing Decorations

PostPosted: Sat Mar 30, 2013 5:10 pm
by malkin
So, if those scripts are already taken, would it theoretically be possible to make a decorative bush that has a timer script (9) and grows fruit?