reporter1

Untitled

Jan 23rd, 2014
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. // saves an oar with chat command
  2. //
  3. // YOU MUST enable osConsoleCommand in your [XEngine] section!
  4. //
  5. // i.e. Allow_osConsoleCommand = 00000000-0000-0000-0000-000000000000
  6. // replace the zeros with your uuid
  7. // set "oarpath" below if you want to use a location other than the current directory
  8. integer listenHandle;
  9. integer cmdchan = 99;
  10. string oarpath = "./";
  11. default
  12. {
  13. state_entry()
  14. {
  15. // Registers the listen to the current owner of the object at the moment of the call
  16. listenHandle = llListen(cmdchan, "", llGetOwner(), "");
  17. }
  18.  
  19. listen(integer channel, string name, key id, string message)
  20. {
  21. if(message == "save") //got save, make an oar
  22. {
  23. //we filtered to only listen to the current owner in the llListen call above!
  24. string region = llGetRegionName();
  25. llOwnerSay("Saving OAR for current region to " + oarpath + region + ".oar");
  26. osConsoleCommand("change region \"" + region + "\"");
  27. osConsoleCommand("save oar \"" + oarpath + region + ".oar\"");
  28. llOwnerSay("please wait...");
  29. llSleep(10.0);
  30. llOwnerSay("Done");
  31. }
  32. else if(message != "save") //bad input, tell the user how
  33. {
  34. llOwnerSay("Usage: /" + cmdchan + " save");
  35. }
  36. }
  37.  
  38. on_rez(integer start_param)// triggered when rezzed from agent's or prim's inventory
  39. {
  40. llResetScript();// by resetting on rez, the script registers a new listen handle
  41. }
  42.  
  43. // Registering a new listen handle with the new owner by script reset
  44. changed(integer change)// triggered by various events that change the task
  45. {
  46. if (change & CHANGED_OWNER)// when a new owner is detected
  47. {
  48. llResetScript();
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment