SHOW:
|
|
- or go back to the newest paste.
1 | integer visible = TRUE; | |
2 | vector defaultsize; | |
3 | ||
4 | //Random number variable | |
5 | float FloatValue; | |
6 | integer IntValue; | |
7 | string StringValue; | |
8 | ||
9 | //key id; | |
10 | show() | |
11 | { | |
12 | llSetAlpha(1,ALL_SIDES); | |
13 | visible = TRUE; | |
14 | return; | |
15 | } | |
16 | hide() | |
17 | { | |
18 | llSetAlpha(0,ALL_SIDES); | |
19 | visible = FALSE; | |
20 | return; | |
21 | } | |
22 | ||
23 | Ssize() | |
24 | { | |
25 | ||
26 | llSetScale(<0.3, 0.3, 0.3>); | |
27 | ||
28 | } | |
29 | Msize() | |
30 | { | |
31 | ||
32 | llSetScale(<0.6, 0.6, 0.6>); | |
33 | ||
34 | } | |
35 | Bsize() | |
36 | { | |
37 | ||
38 | llSetScale(<0.9, 0.9, 0.9>); | |
39 | ||
40 | } | |
41 | default | |
42 | { | |
43 | state_entry() | |
44 | { | |
45 | ||
46 | llListen(-11223,"Fish Pond",NULL_KEY,""); | |
47 | llSetAlpha(1,ALL_SIDES); | |
48 | defaultsize = llGetScale(); | |
49 | ||
50 | } | |
51 | ||
52 | listen(integer channel, string what, key who, string msg) | |
53 | { | |
54 | - | if(llGetOwnerKey(who) == llGetOwner()) |
54 | + | // if(llGetOwnerKey(who) == llGetOwner()) // Note that the message comes from the pond and not the owner of the rod. You can't use llGetOwnerKey(who) because the owner of the pond and the owner of the rod are not necessarily the same owner. |
55 | - | { |
55 | + | |
56 | - | if(msg == "on") |
56 | + | list tmp = llParseString2List(msg,["_"],[]); // 10. Repeat parsing the essage |
57 | ||
58 | string cmd = llList2String(tmp,0); | |
59 | ||
60 | key rod_owner = (key)llList2String(tmp,1); // 11. We are only working with the rod owner key in this event so do not need to store it ina global variable. | |
61 | - | else if(msg == "off") |
61 | + | |
62 | if(rod_owner == llGetOwner) //12. We've passed the rod owner jey to the spawner and can now check if they key corresponds to the owner of the sapwner. | |
63 | { | |
64 | ||
65 | if(cmd == "on") // 13. Remember to check the parsed message. | |
66 | { | |
67 | hide(); | |
68 | llSetScale(defaultsize); | |
69 | } | |
70 | else if(cmd == "off") | |
71 | { | |
72 | ||
73 | //llSleep(8.0); | |
74 | show(); | |
75 | //random number generator | |
76 | FloatValue = llFrand(3); | |
77 | IntValue = llRound(FloatValue); | |
78 | StringValue = (string)IntValue; | |
79 | ||
80 | llSay(-11223, "StringValue" +StringValue); | |
81 | ||
82 | //llMessageLinked(LINK_SET, 1, "String ", id); | |
83 | if(IntValue == 1) | |
84 | { | |
85 | Ssize(); | |
86 | //llMessageLinked(LINK_SET, 1, "Small Fish", NULL_KEY); | |
87 | } | |
88 | else if(IntValue == 2) | |
89 | { | |
90 | Msize(); | |
91 | //llMessageLinked(LINK_SET, 2, "Medium Fish",NULL_KEY); | |
92 | } | |
93 | else if(IntValue == 3) | |
94 | { | |
95 | Bsize(); | |
96 | //llMessageLinked(LINK_SET, 3, "Big Fish", NULL_KEY); | |
97 | } | |
98 | ||
99 | } | |
100 | ||
101 | ||
102 | } | |
103 | } | |
104 | ||
105 | // touch_start(integer total_number) | |
106 | // { | |
107 | // if(visible == TRUE) | |
108 | // { | |
109 | // hide(); | |
110 | // } | |
111 | // else if(visible == FALSE) | |
112 | // { | |
113 | // show(); | |
114 | // } | |
115 | // } | |
116 | ||
117 | } | |
118 |