Open Source Platform
for interconnected virtual worlds

Content Scripting Python World Enter Location

From RexWiki

Below is a sample script for testworldinfo.py named file. This script does the following:

  • changes the start location of the avatars to coordinates 124.465, 139.667, 24 (by teleporting them locally when they enter the world)
  • turns on hchdr post-processing effect for all users who enter the world


import rxactor
import rxavatar
import rxworldinfo
import sys
import math
import clr

asm = clr.LoadAssemblyByName('OpenSim.Region.ScriptEngine.Common')
Vector3 = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3

class WI(rxworldinfo.WorldInfo):
    def GetScriptClassName():
        return "testworldinfo.WI"

    def EventCreated(self):
        super(self.__class__,self).EventCreated()
        self.MyWorld.MyEventManager.onAddPresence += self.handleOnAddPresence
        
    def EventDestroyed(self):
        self.MyWorld.MyEventManager.onAddPresence -= self.handleOnAddPresence
        super(WI,self).EventDestroyed()

    def handleOnAddPresence(self,vAvatar):
        vAvatar.rexSetPostProcess(11,True)
        vAvatar.DoLocalTeleport(Vector3(124.465,139.667,24))