Essay on U05a3 UML Diagram Of A Program With Multiple Modifications

Submitted By hal4511
Words: 426
Pages: 2

Chapter 11: Changing Object Attributes page 198
Listing 11.1: Random Color Cube
Hal Hagood/Looker Coba

default
{
state_entry()
{
llSetTimerEvent(1);
}
timer()
{
rotation rot = llGetRot(); vector vrot = llRot2Euler(rot); vrot+=<0,0,350*DEG_TO_RAD>; rot = llEuler2Rot(vrot); llSetRot(rot); float purple = llFrand(1); float yellow = llFrand(1); float orange = llFrand(1); vector color = <purple,yellow,orange>; llSetPrimitiveParams( [PRIM_COLOR, ALL_SIDES, color, 1]
);
}
}

Or

default
{
state_entry() { llSetTimerEvent(1); } timer() { rotation rot = llGetRot(); vector vrot = llRot2Euler(rot); vrot+=<0,0,350*DEG_TO_RAD>; rot = llEuler2Rot(vrot); llSetRot(rot);

float purple = llFrand(1); float yellow = llFrand(1); float orange = llFrand(1); vector color = <purple,yellow,orange>; llSetPrimitiveParams( [PRIM_COLOR, ALL_SIDES, color, 1] ); }
}
(Heaton, 2007)

The above script has been modified in several ways, the llSetTimerEvent has been changed from a 10 second interval to a 1 second interval. The colors have also be changed from a red, green, blue scheme to vector color = <purple,yellow,orange>; and the size of the object has also been adjusted to a larger scale.
The above script displays the objects location and rotation; these are basic attributes of all objects. In the above script the position is stored in to a vector variable named pos. The x, y, and z variables can be accessed directly. In addition this script begins by setting a timer event that will occur every 1 second. Each time the timer event is called; three random values are generated for purple, yellow and orange. These components are combined in a vector to produce a color. This color is then applied to the prim.
“In previous chapters functions such as llSetPos and llGetPos were presented to change the position of a