Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer visible = TRUE;
- vector defaultsize;
- //Random number variable
- float FloatValue;
- integer IntValue;
- string StringValue;
- integer lchan;
- //key id;
- show()
- {
- llSetAlpha(1,ALL_SIDES);
- visible = TRUE;
- return;
- }
- hide()
- {
- llSetAlpha(0,ALL_SIDES);
- visible = FALSE;
- return;
- }
- Ssize()
- {
- llSetScale(<0.4/9,2.0/9, 5.0/9>);
- }
- Msize()
- {
- llSetScale(<0.4/6, 2.0/6, 5.0/6>);
- }
- Bsize()
- {
- llSetScale(<0.4, 2.0, 5.0>);
- }
- default
- {
- state_entry()
- {
- llListen(-11223,"Fish Pond",NULL_KEY,"");
- llSetAlpha(1,ALL_SIDES);
- defaultsize = llGetScale();
- lchan = ((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) - 723) | 0x8000000;
- llListen(lchan,"Fish Pond",NULL_KEY,"");
- }
- listen(integer channel, string what, key who, string msg)
- {
- // 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.
- list tmp = llParseString2List(msg,["_"],[]); // 10. Repeat parsing the essage
- string cmd = llList2String(tmp,0);
- 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.
- 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.
- {
- if(cmd == "on") // 13. Remember to check the parsed message.
- {
- hide();
- llSetScale(defaultsize);
- }
- else if(cmd == "off")
- {
- //llSleep(8.0);
- show();
- //random number generator
- FloatValue = llFrand(3);
- IntValue = llRound(FloatValue);
- StringValue = (string)IntValue;
- llSay(-11223, StringValue);
- //llMessageLinked(LINK_SET, 1, "String ", id);
- if(IntValue == 1)
- {
- Ssize();
- //llMessageLinked(LINK_SET, 1, "Small Fish", NULL_KEY);
- }
- else if(IntValue == 2)
- {
- Msize();
- //llMessageLinked(LINK_SET, 2, "Medium Fish",NULL_KEY);
- }
- else if(IntValue == 3)
- {
- Bsize();
- //llMessageLinked(LINK_SET, 3, "Big Fish", NULL_KEY);
- }
- }
- }
- }
- // touch_start(integer total_number)
- // {
- // if(visible == TRUE)
- // {
- // hide();
- // }
- // else if(visible == FALSE)
- // {
- // show();
- // }
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement