sloodle_choice_text.lslp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. // Sloodle Choice text display
  4. // Displays the text of a choice using hover text
  5. //
  6. // Copyright (c) 2008 Sloodle
  7. // Released under the GNU GPL
  8. //
  9. // Contributors:
  10. // Peter R. Bloomfield
  11. //
  12. integer SLOODLE_CHANNEL_OBJECT_CHOICE = -1639270051;
  13. // Update the choice text. Followed by "|text"
  14. string SLOODLE_CHOICE_UPDATE_TEXT = "do:updatetext";
  15. vector TEXT_COLOUR = <1.0, 0.5, 0.0>;
  16. float TEXT_ALPHA = 1.0;
  17. default
  18. {
  19. state_entry()
  20. {
  21. }
  22. link_message(integer sender_num, integer num, string sval, key kval)
  23. {
  24. // Check the channel
  25. if (num == SLOODLE_CHANNEL_OBJECT_CHOICE) {
  26. // Parse the string
  27. list parts = llParseString2List(sval, ["|"], []);
  28. integer numparts = llGetListLength(parts);
  29. string cmd = llList2String(parts, 0);
  30. if (cmd == "do:reset") {
  31. llSetText("", <0.0, 0.0, 0.0>, 0.0);
  32. } else if (cmd == SLOODLE_CHOICE_UPDATE_TEXT) {
  33. // There should be a parameter
  34. if (numparts > 1) llSetText(llList2String(parts, 1), TEXT_COLOUR, TEXT_ALPHA);
  35. else llSetText("", <0.0, 0.0, 0.0>, 0.0);
  36. }
  37. }
  38. }
  39. }
  40. // Please leave the following line intact to show where the script lives in Git:
  41. // SLOODLE LSL Script Git Location: mod/choice-1.0/objects/default/assets/sloodle_choice_text.lslp