samplevolumetrigger.py 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. class SayHello(rxactor.Actor):
  8. def GetScriptClassName():
  9. return "samplevolumetrigger.SayHello"
  10. def EventCreated(self):
  11. super(self.__class__,self).EventCreated()
  12. self.SetUsePrimVolumeCollision(True)
  13. self.MyAvatars = {}
  14. # This event triggers every 1 second
  15. # It's enough to send text to avatar every 6 seconds
  16. def EventPrimVolumeCollision(self,vOther):
  17. if isinstance(vOther,rxavatar.Avatar):
  18. if self.MyAvatars.has_key(vOther.AgentId):
  19. if(self.GetTime() > self.MyAvatars[vOther.AgentId]):
  20. self.ShowMyTextToAvatar(vOther)
  21. else:
  22. self.ShowMyTextToAvatar(vOther)
  23. def ShowMyTextToAvatar(self,vAvatar):
  24. self.MyAvatars[vAvatar.AgentId] = self.GetTime()+6
  25. vAvatar.ShowTutorialBox("This is a nice place to stand for a while",9)