sampleobject.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import rxactor
  2. import rxavatar
  3. import sys
  4. import clr
  5. asm = clr.LoadAssemblyByName('OpenSim.Region.ScriptEngine.Common')
  6. Vector3 = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3
  7. import random
  8. import math
  9. class TestActor(rxactor.Actor):
  10. def GetScriptClassName():
  11. return "sampleobject.TestActor"
  12. def EventCreated(self):
  13. super(self.__class__,self).EventCreated()
  14. print "TestActor EventCreated"
  15. def EventTouch(self,vAvatar):
  16. scalex = 0.5 + random.random()*2
  17. scaley = 0.5 + random.random()*2
  18. scalez = 0.5 + random.random()*2
  19. tempscale = Vector3(scalex,scaley,scalez)
  20. self.llSetScale(tempscale)
  21. str = self.llGetObjectName() + " was touched in region "+self.llGetRegionName() + " by " + vAvatar.GetFullName()
  22. self.llShout(0,str)
  23. self.llSetText("On top of text",Vector3(1,0,0),1)
  24. rotx = 0.5 + random.random()*3.14
  25. roty = 0.5 + random.random()*3.14
  26. rotz = 0.5 + random.random()*3.14
  27. r = self.llEuler2Rot(Vector3(rotx,roty,rotz))
  28. self.llSetRot(r)