Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer out = FALSE;
- integer rod_equip = FALSE;
- //time 15 seconds delay for it to be visible
- default
- {
- state_entry()
- {
- llListen(-11223,"Fishing Rod",NULL_KEY,"");
- //llSetScriptState("ToggleFish",FALSE);
- }
- //listen for fishing rod is equip
- listen(integer channel, string what, key who, string msg)
- {
- llOwnerSay(what + ": " + msg);
- //if(llDetectedKey(0) == llGetOwner())
- //else
- // if(llGetOwnerKey(who) == llGetOwner())
- // {
- // This code will only run if the pond owner is also the rod owner. Students will not own the pond so this block cant run.
- if(what == "Fishing Rod") // Instead check if the object sending messages to the pond is the fishing rod
- {
- llOwnerSay("message from fishing rod.");
- if(msg=="Equip" )
- {
- llSay(0, "rod equipped");
- rod_equip = TRUE;
- //llSetScriptState("ToggleFish",TRUE);
- return;
- }
- else
- {
- llSay(0, "rod not equipped");
- rod_equip = FALSE;
- return;
- }
- /*
- else if(msg =="UnEquip")
- {
- rod_equip = FALSE;
- return;
- }
- */
- }
- }
- touch_start(integer total_number)
- {
- //ask for the fishing rod
- llRegionSayTo(llGetOwner(),-11223,"CheckRod");
- llSay(-11223,(string) llGetKey());
- if(out == TRUE && rod_equip == TRUE)
- {
- out = FALSE;
- llSay(10,"off");
- return;
- }
- else if(out == FALSE && rod_equip == TRUE)
- {
- out = TRUE;
- llSay(10,"on");
- return;
- }
- // instead of setting out to TRUE and FALSE in the touch event do:
- // Out = !Out;
- //This will toggle Out between True and False
- // Then you dont have to set out to true or false in the if statements
- }
- }
Add Comment
Please, Sign In to add comment