set_texture.lslp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. /*
  4. * Part of the Sloodle project (www.sloodle.org)
  5. *
  6. * set_texture.lslp
  7. *
  8. * Copyright (c) 2011-06 contributors (see below)
  9. * Released under the GNU GPL v3
  10. * -------------------------------------------
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. * All scripts must maintain this copyrite information, including the contributer information listed
  26. *
  27. * Contributors:
  28. * Paul Preibisch
  29. *
  30. * DESCRIPTION
  31. * waits for a linked message, sets the texture givien: prim_name(string)|face(integer)|texture(string)
  32. * eg: llMessageLinked(LINK_SET, SLOODLE_SET_TEXTURE, "pie_slice"+(string)j+"|"+(string)face+"|"+texture,NULL_KEY);
  33. * Using this instead of llSetPrimitiveParamsFast because doesn't appear to work in opensim
  34. */
  35. integer SLOODLE_SET_TEXTURE= -1639277010;
  36. init(){
  37. llSetTexture("blank_white", ALL_SIDES);
  38. }
  39. default {
  40. on_rez(integer start_param) {
  41. init();
  42. }
  43. state_entry() {
  44. init();
  45. }
  46. link_message(integer sender_num, integer num, string str, key id) {
  47. if (num==SLOODLE_SET_TEXTURE){
  48. list data = llParseString2List(str, ["|"], []);
  49. string prim=llList2String(data, 0);
  50. if (prim!=llGetObjectName()){
  51. return;
  52. }
  53. integer face=llList2Integer(data, 1);
  54. string texture=llList2String(data, 2);
  55. llSetTexture(texture, face);
  56. }
  57. }
  58. }