lsl.lsl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. Testing syntax highlighting
  3. of Ace Editor
  4. for the Linden Scripting Language
  5. */
  6. integer someIntNormal = 3672;
  7. integer someIntHex = 0x00000000;
  8. integer someIntMath = PI_BY_TWO;
  9. integer event = 5673; // invalid.illegal
  10. key someKeyTexture = TEXTURE_DEFAULT;
  11. string someStringSpecial = EOF;
  12. some_user_defined_function_without_return_type(string inputAsString)
  13. {
  14. llSay(PUBLIC_CHANNEL, inputAsString);
  15. }
  16. string user_defined_function_returning_a_string(key inputAsKey)
  17. {
  18. return (string)inputAsKey;
  19. }
  20. default
  21. {
  22. state_entry()
  23. {
  24. key someKey = NULL_KEY;
  25. someKey = llGetOwner();
  26. string someString = user_defined_function_returning_a_string(someKey);
  27. some_user_defined_function_without_return_type(someString);
  28. }
  29. touch_start(integer num_detected)
  30. {
  31. list agentsInRegion = llGetAgentList(AGENT_LIST_REGION, []);
  32. integer numOfAgents = llGetListLength(agentsInRegion);
  33. integer index; // defaults to 0
  34. for (; index <= numOfAgents - 1; index++) // for each agent in region
  35. {
  36. llRegionSayTo(llList2Key(agentsInRegion, index), PUBLIC_CHANNEL, "Hello, Avatar!");
  37. }
  38. }
  39. touch_end(integer num_detected)
  40. {
  41. someIntNormal = 3672;
  42. someIntHex = 0x00000000;
  43. someIntMath = PI_BY_TWO;
  44. event = 5673; // invalid.illegal
  45. someKeyTexture = TEXTURE_DEFAULT;
  46. someStringSpecial = EOF;
  47. llSetInventoryPermMask("some item", MASK_NEXT, PERM_ALL); // reserved.godmode
  48. llWhisper(PUBLIC_CHANNEL, "Leaving \"default\" now...");
  49. state other;
  50. }
  51. }
  52. state other
  53. {
  54. state_entry()
  55. {
  56. llWhisper(PUBLIC_CHANNEL, "Entered \"state other\", returning to \"default\" again...");
  57. state default;
  58. }
  59. }