Gayngel

Enable_Fishing

Sep 23rd, 2020 (edited)
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer out  = FALSE;
  2. integer rod_equip = FALSE;
  3.  
  4. //time 15 seconds delay for it to be visible
  5.  
  6.  
  7. default
  8. {
  9.      state_entry()
  10.     {
  11.         llListen(-11223,"Fishing Rod",NULL_KEY,"");
  12.         //llSetScriptState("ToggleFish",FALSE);
  13.                          
  14.     }
  15.     //listen for fishing rod is equip
  16.     listen(integer channel, string what, key who, string msg)
  17.     {
  18.         llOwnerSay(what + ": " + msg);
  19.         //if(llDetectedKey(0) == llGetOwner())
  20.         //else
  21.        // if(llGetOwnerKey(who) == llGetOwner())
  22.        // {
  23.            
  24.            // 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.
  25.          if(what == "Fishing Rod") // Instead check if the object sending messages to the pond is the fishing rod
  26.          {
  27.          
  28.          llOwnerSay("message from fishing rod.");
  29.          
  30.             if(msg=="Equip" )
  31.             {
  32.                llSay(0, "rod equipped");
  33.                rod_equip = TRUE;
  34.                //llSetScriptState("ToggleFish",TRUE);
  35.                return;
  36.             }
  37.             else
  38.             {
  39.                  llSay(0, "rod not equipped");
  40.                 rod_equip = FALSE;
  41.                 return;
  42.             }
  43.             /*
  44.             else if(msg =="UnEquip")
  45.             {
  46.                rod_equip = FALSE;
  47.                return;
  48.             }
  49.             */
  50.         }
  51.                        
  52.     }
  53.    
  54.     touch_start(integer total_number)
  55.     {
  56.         //ask for the fishing rod
  57.         llRegionSayTo(llGetOwner(),-11223,"CheckRod");
  58.         llSay(-11223,(string) llGetKey());
  59.         if(out == TRUE && rod_equip == TRUE)
  60.         {
  61.             out = FALSE;      
  62.             llSay(10,"off");          
  63.             return;
  64.         }
  65.        
  66.         else if(out == FALSE && rod_equip == TRUE)
  67.         {
  68.             out = TRUE;
  69.             llSay(10,"on");
  70.             return;
  71.         }
  72.        
  73.         // instead of setting out to TRUE and FALSE in the touch event do:
  74.  
  75.        // Out = !Out;  
  76.        
  77.        //This will toggle Out between True and False
  78.  
  79.         // Then you dont have to set out to true or false in the if statements
  80.        
  81.        
  82.        
  83.        
  84.     }
  85.    
  86.    
  87. }
Add Comment
Please, Sign In to add comment