Advertisement
TheKeeper81

Untitled

Nov 18th, 2024
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string objMessage = "Click me to initiate the Difficulty Check.";   //The message the object sends out to the users
  2. string Pass = "Pass";   //Message Received from HUD: DC passed
  3. string Fail = "Fail";   //Message Redeived from HUD: DC failed
  4. string DCPassed = "DC Passed";  //Message to players: DC Passed
  5. string DCFailed = "DC Failed";  //Message to players: DC Failed
  6. string DiffCheck = "Difficulty Check, ";    //Message to HUD: This is a Difficulty Check message
  7. string DiffNum;    //Message to HUD: The difficulty number
  8. string Stat;  //Message to HUD: the stat to use for the Difficulty Roll
  9. integer listen_handle;  //The listener
  10. integer objectchan = -1234555;  //The channel this object sends to and receives from
  11. key TouchingAvatar; //The UUID of the avatar touching this object
  12. key ThisObject; //They UUID of this object, in case it's needed
  13. integer NPCSystem = 0;
  14. string Caption;
  15. string CaptionCheck = "Difficulty Check";
  16. string PassCheck;
  17. string FailCheck;
  18. string PassFail = "Pass or Fail";
  19. integer Passed;
  20. string StatDiffCheck;
  21.  
  22. MessageLinkPass()
  23. {
  24.     llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
  25. }
  26.  
  27. MessageLinkFail()
  28. {
  29.     llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed, FailCheck]), "");
  30. }
  31.  
  32. default
  33. {
  34.     state_entry()
  35.     {
  36.         //Set up the listener channel
  37.         llListenRemove(listen_handle);
  38.         listen_handle = llListen(objectchan, "", "", "");
  39.        
  40.     }
  41.  
  42.  
  43.     listen(integer channel, string name, key target, string message)
  44.     {
  45.         //Inform the player whether the DC passed or failed
  46.         if (channel == objectchan)
  47.         {
  48.             if (message == Pass)
  49.             {
  50.                 Passed = TRUE;
  51.                 //llSay(0, DCPassed);
  52.                 //llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
  53.                 //MessageLinkPass();
  54.                 llSay( 0, llList2CSV([DCPassed, PassCheck]));
  55.             }
  56.             else if (message == Fail)
  57.             {
  58.                 Passed = FALSE;
  59.                 llSay(0, DCFailed);
  60.                 //MessageLinkFail();
  61.                 //llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed, FailCheck]), "");
  62.             }
  63.         }
  64.     }
  65.  
  66.     link_message( integer sender_num, integer num, string str, key id )
  67.     {
  68.         if (sender_num == NPCSystem)
  69.         {
  70.             list DiffCheckData = llCSV2List(str);
  71.             Caption = llList2String(DiffCheckData, 0);
  72.             DiffNum = llList2String(DiffCheckData, 1) + ", ";
  73.             Stat = llList2String(DiffCheckData, 2) + ", ";
  74.             PassCheck = llList2String(DiffCheckData, 5);
  75.             FailCheck = llList2String(DiffCheckData, 6);
  76.             StatDiffCheck = Stat + " Difficulty Check";
  77.            
  78.             llOwnerSay(PassCheck);
  79.            
  80.             if (Caption == CaptionCheck)
  81.             {
  82.                 llRegionSayTo(TouchingAvatar, objectchan, ( DiffCheck + DiffNum + Stat + (string)ThisObject));  //Speak to the touching avatar's HUD
  83.             //}
  84.             //if (Caption == PassFail)
  85.             //{
  86.                 if (Passed == TRUE)
  87.                 {
  88.                     llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
  89.                 }
  90.                
  91.                 else if (Passed == FALSE)
  92.                 {
  93.                     llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed,FailCheck]), "");
  94.                 }
  95.             //}
  96.             }
  97.         }
  98.     }
  99.  
  100.     touch_start(integer total_number)
  101.     {
  102.         //The player who touches this object gets the difficulty check performed
  103.         TouchingAvatar = llDetectedKey(0);
  104.         ThisObject = llGetKey();
  105.         //llOwnerSay((string)TouchingAvatar); //A debug messageto check that the keys were obtained
  106.         //llOwnerSay((string)ThisObject); //A debug message to check that they key was obtained
  107.     }
  108.    
  109. }
  110.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement