![]() |
![]() |
![]() |
Content Scripting Python DialogFrom RexWikiThe following example is straight from sampledialog.py and demonstrates how to use the llListen and llDialog functions from Python.
import rxactor
import rxavatar
import sys
import clr
asm = clr.LoadAssemblyByName('OpenSim.Region.ScriptEngine.Common')
Vector3 = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3
List = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.list
import random
import math
class DialogActor(rxactor.Actor):
def GetScriptClassName():
return "sampledialog.DialogActor"
def EventCreated(self):
super(self.__class__,self).EventCreated()
print "DialogActor EventCreated"
self.llSetObjectName("QuestionPrim")
self.llListen(1,"","","")
def EventTouch(self, vAvatar):
self.llDialog(vAvatar.AgentId, "Which do you like better?", List("Apples", "Oranges"),1)
def listen(self,channel, name, id, message):
if self.MyWorld.AllAvatars.has_key(id):
avatar = self.MyWorld.AllAvatars[id]
strmes = name + " selected option " + message + ". Message channel:" + channel + " avatar full name:" + avatar.GetFullName()
self.llShout(0,strmes)
else:
print "No avatar found matching id:",id
|
||
![]() |
![]() |
![]() |

