WEEK 4: Adding New Behaviors and Menu Options

FUNCTIONS (continued)

Going back to the Data box, get rid of 1264, and type in the number zero (0).


Fig. 1.17

Look at Line 6:


Fig. 1.18

Quite interesting, isn't it? Instead of stack object or neighbor, we have our friend, the GUID! And that, folks, opens up a whole lot of opportunities for us. With this little bit of code, we can have our nice chair create all sorts of things — providing we have the "thing's" correct GUID. Very cool, indeed!

After the GUID number, which in the case above is currently blank, there is a placement instruction (place in front of me). We can change that. We can have the chair create something and place it wherever we want, or a random available place. The game is quite smart, though. If you ask the chair to create something and place it at a specific location, and that location is occupied... the game will find the next closest available spot and place it there (if coded to do so).

Back to the Data box! Go into Parameter 3 and experiment typing numbers in there. Not big numbers, though. Start with the number 1 and see what your line says. Then type in a number 2 instead, and so on. You'll be amazed at where you can have the chair place the object it is creating, and hopefully will also give you ideas for creating an object (which you will do for your final assignment). Keep your Data box open when you're done experimenting with Parameter 3.

* * * * * * * * * * * * * * * * * * * * *

The next function we will look at is Function 16. If you previously did not add it to your Code Book, enter it now:

Function 16: Find Location For

 

Continued on Next Page . . .