Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string objMessage = "Click me to initiate the Difficulty Check."; //The message the object sends out to the users
- string Pass = "Pass"; //Message Received from HUD: DC passed
- string Fail = "Fail"; //Message Redeived from HUD: DC failed
- string DCPassed = "DC Passed"; //Message to players: DC Passed
- string DCFailed = "DC Failed"; //Message to players: DC Failed
- string DiffCheck = "Difficulty Check, "; //Message to HUD: This is a Difficulty Check message
- string DiffNum; //Message to HUD: The difficulty number
- string Stat; //Message to HUD: the stat to use for the Difficulty Roll
- integer listen_handle; //The listener
- integer objectchan = -1234555; //The channel this object sends to and receives from
- key TouchingAvatar; //The UUID of the avatar touching this object
- key ThisObject; //They UUID of this object, in case it's needed
- integer NPCSystem = 0;
- string Caption;
- string CaptionCheck = "Difficulty Check";
- string PassCheck;
- string FailCheck;
- string PassFail = "Pass or Fail";
- integer Passed;
- string StatDiffCheck;
- MessageLinkPass()
- {
- llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
- }
- MessageLinkFail()
- {
- llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed, FailCheck]), "");
- }
- default
- {
- state_entry()
- {
- //Set up the listener channel
- llListenRemove(listen_handle);
- listen_handle = llListen(objectchan, "", "", "");
- }
- listen(integer channel, string name, key target, string message)
- {
- //Inform the player whether the DC passed or failed
- if (channel == objectchan)
- {
- if (message == Pass)
- {
- Passed = TRUE;
- //llSay(0, DCPassed);
- //llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
- //MessageLinkPass();
- llSay( 0, llList2CSV([DCPassed, PassCheck]));
- }
- else if (message == Fail)
- {
- Passed = FALSE;
- llSay(0, DCFailed);
- //MessageLinkFail();
- //llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed, FailCheck]), "");
- }
- }
- }
- link_message( integer sender_num, integer num, string str, key id )
- {
- if (sender_num == NPCSystem)
- {
- list DiffCheckData = llCSV2List(str);
- Caption = llList2String(DiffCheckData, 0);
- DiffNum = llList2String(DiffCheckData, 1) + ", ";
- Stat = llList2String(DiffCheckData, 2) + ", ";
- PassCheck = llList2String(DiffCheckData, 5);
- FailCheck = llList2String(DiffCheckData, 6);
- StatDiffCheck = Stat + " Difficulty Check";
- llOwnerSay(PassCheck);
- if (Caption == CaptionCheck)
- {
- llRegionSayTo(TouchingAvatar, objectchan, ( DiffCheck + DiffNum + Stat + (string)ThisObject)); //Speak to the touching avatar's HUD
- //}
- //if (Caption == PassFail)
- //{
- if (Passed == TRUE)
- {
- llMessageLinked(LINK_THIS, 0, llList2CSV([DCPassed,PassCheck]), "");
- }
- else if (Passed == FALSE)
- {
- llMessageLinked(LINK_THIS, NPCSystem, llList2CSV([DCFailed,FailCheck]), "");
- }
- //}
- }
- }
- }
- touch_start(integer total_number)
- {
- //The player who touches this object gets the difficulty check performed
- TouchingAvatar = llDetectedKey(0);
- ThisObject = llGetKey();
- //llOwnerSay((string)TouchingAvatar); //A debug messageto check that the keys were obtained
- //llOwnerSay((string)ThisObject); //A debug message to check that they key was obtained
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement