Shinobiace

Fishing animation

Oct 23rd, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float fishingtime;
  2. float fishingcounter;
  3. integer ifishingtime;
  4. integer Fish = FALSE;
  5. float counter = 0.0;
  6.  
  7. fishtime()
  8. {
  9.     fishingtime = 10.0 - llFrand(3.0);
  10.     ifishingtime = (integer)fishingtime;
  11.     llSay(0,"Fishing time: "+ (string)fishingtime);
  12.     for(fishingcounter = 0; fishingcounter<= ifishingtime; ++fishingcounter)
  13.     {
  14.          llSetTimerEvent(fishingtime);
  15.        
  16.     }  
  17.     llSleep(0.3);
  18. }
  19. default
  20. {
  21.     state_entry()
  22.     {
  23.  
  24.        
  25.         llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
  26.        
  27.     }
  28.     link_message(integer source, integer num, string str, key id)
  29.     {
  30.         key ownerid;
  31.         ownerid = llGetOwner();
  32.         if(ownerid == id)
  33.         {
  34.             Fish=TRUE;
  35.         }
  36.        
  37.     }
  38.      
  39.     run_time_permissions(integer perm)
  40.     {
  41.         key ownerid;
  42.         ownerid = llGetOwner();
  43.         if (perm & PERMISSION_TRIGGER_ANIMATION)
  44.         {
  45.             if(Fish == TRUE)
  46.             {
  47.             fishtime();
  48.             llStartAnimation("Fishing Middle Animation");
  49.             llOwnerSay("animation will end in " + (string)ifishingtime);
  50.             }
  51.             else if(Fish == FALSE)
  52.             {
  53.             llMessageLinked(LINK_THIS, 0, "Fish Script", ownerid);
  54.             }
  55.             //llSetTimerEvent(ifishingtime);
  56.         }
  57.     }
  58.    
  59.      timer()
  60.     {
  61.         counter = counter + fishingtime;
  62.         llSay(0, (string)counter+" seconds have passed");
  63.         llSetTimerEvent(0);
  64.         llStopAnimation("Fishing Middle Animation");
  65.         Fish=FALSE;
  66.        
  67.     }
  68. }
Add Comment
Please, Sign In to add comment