Added the tree scripts, w/ comments
[ProgettoPaperellaDiGomma.git] / fractalTreeMain.lsl
blobbe3a28a696f5c8b08847b21657422599ba41ca68
1 //////////////////////////////////////////////////////////
2 //Base Fractal Tree Code
3 //Created By Ming Chen
4 //You can sell this code as long as you leave this line, sell it with FULL permissions, and
5 //modify the code just a little to make it different
6 //
7 //By the way, these are the only comments you'll see mainly through the script (because
8 //usually im the only one to read my code)
9 ////////////////////////////////////////////////////////
11 //Modified by Davide Byron
12 // no comments of mine here since it's not made by me...
13 //dedicated to Mealea, thanks for the passion you put into things and for being able to pass it on to me :)
15 string TREE_BRANCH_NAME;
17 integer totalBranches = 2;
18 integer minAngle = 15;
19 integer maxAngle = 60;
20 float posOffset = 1;
22 float MIN_POS_OFFSET = 0;
23 float MAX_POS_OFFSET = 2;
25 integer MIN_TOTAL_BRACHES = 2;
26 integer MAX_TOTAL_BRACHES = 4;
28 integer MIN_MINIMUM_ANGLE = 5;
29 integer MAX_MINIMUM_ANGLE = 89;
31 integer MIN_MAXIMUM_ANGLE = 5;
32 integer MAX_MAXIMUM_ANGLE = 89;
34 float REGEN_TIME = 540.0; //9m mins
39 integer checkLimits(float min, float max, float val)
41 if(val >= min && val <= max)
42 return TRUE;
43 else
44 return FALSE;
50 default
53 state_entry()
55 //determine the branch name based on the inventory content
56 TREE_BRANCH_NAME = llGetInventoryName(INVENTORY_OBJECT, 0);
57 if( TREE_BRANCH_NAME == llGetObjectName() )
59 TREE_BRANCH_NAME = llGetInventoryName(INVENTORY_OBJECT, 1);
61 //start the timer for sprouting
62 llSetTimerEvent(REGEN_TIME);
68 on_rez(integer param)
70 llResetScript();
76 timer()
78 llRezObject(TREE_BRANCH_NAME,llGetPos(),<0,0,0>,ZERO_ROTATION,1);
79 llSleep(.2);
80 llSay(1, llDumpList2String([totalBranches,0,minAngle,maxAngle,posOffset],"|"));
86 object_rez(key id)
88 llGiveInventory(id,TREE_BRANCH_NAME);