public void RegionLoaded(Scene scene) { if (m_enabled) { m_scene = scene; m_comms = m_scene.RequestModuleInterface <IScriptModuleComms>(); if (m_comms == null) { m_log.WarnFormat("[ModInvoke] ScriptModuleComms interface not defined"); m_enabled = false; return; } m_comms.RegisterScriptInvocation(this, "ModTest0"); m_comms.RegisterScriptInvocation(this, "ModTest1"); m_comms.RegisterScriptInvocation(this, "ModTest2"); m_comms.RegisterScriptInvocation(this, "ModTest3"); m_comms.RegisterScriptInvocation(this, "ModTest4"); m_comms.RegisterScriptInvocation(this, "ModTest5"); m_comms.RegisterScriptInvocation(this, "ModTest6"); m_comms.RegisterScriptInvocation(this, "ModTest7"); m_comms.RegisterScriptInvocation(this, "ModTest8"); // Register some constants as well m_comms.RegisterConstant("ModConstantInt1", 25); m_comms.RegisterConstant("ModConstantFloat1", 25.000f); m_comms.RegisterConstant("ModConstantString1", "abcdefg"); } }
public override void RegionLoaded(Scene scene) { base.World = scene; try { IScriptModuleComms m_scriptModule = base.World.RequestModuleInterface <IScriptModuleComms>(); m_scriptModule.RegisterScriptInvocation(this, "osStartScriptEvents"); m_scriptModule.RegisterScriptInvocation(this, "osStopScriptEvents"); m_scriptModule.RegisterScriptInvocation(this, "osTriggerCustomEvent"); m_scriptModule.RegisterConstant("EVENT_CUSTOM", 0); m_scriptModule.RegisterConstant("EVENT_NEWPRESENCE", 1); m_scriptModule.RegisterConstant("EVENT_REMOVEPRESENCE", 2); m_scriptModule.RegisterConstant("EVENT_AVATARENTERPARCEL", 3); m_scriptModule.RegisterConstant("EVENT_AVATARTELEPORT", 4); m_scriptModule.RegisterConstant("EVENT_DATASTORAGESET", 1001); m_scriptModule.RegisterConstant("EVENT_DATASTORAGEREMOVE", 1002); m_scriptModule.RegisterConstant("EVENT_EASYDIALOGTIMEOUT", 2001); m_scriptModule.RegisterConstant("EVENT_GENERIC", 42001337); } catch (Exception e) { base.Logger.WarnFormat("[" + Name + "]: Script method registration failed; {0}", e.Message); } ScriptEngine = base.World.RequestModuleInterface <IScriptModule>(); base.World.EventManager.OnScriptReset += onScriptReset; base.World.EventManager.OnRemoveScript += onScriptRemove; //DataStorage Events DataStorageEvents.onDeleteDataValue += scriptevent_onDeleteDataValue; DataStorageEvents.onSetDataValue += scriptevent_onSetDataValue; DataStorageEvents.onRateLimit += scriptevent_onRateLimit; //EasyDialog Events EasyDialogEvents.onDialogTimeout += scriptevent_onDialogTimeout; //Events for Scripts base.World.EventManager.OnNewPresence += scriptevent_OnNewPresence; base.World.EventManager.OnRemovePresence += scriptevent_OnRemovePresence; base.World.EventManager.OnAvatarEnteringNewParcel += scriptevent_OnAvatarEnteringNewParcel; base.World.EventManager.OnTeleportStart += scriptevent_OnTeleportStart; }
public void RegionLoaded(Scene scene) { if (m_enabled) { m_scene = scene; m_comms = m_scene.RequestModuleInterface<IScriptModuleComms>(); if (m_comms == null) { m_log.WarnFormat("[ModInvoke] ScriptModuleComms interface not defined"); m_enabled = false; return; } m_comms.RegisterScriptInvocation(this,"ModTest0"); m_comms.RegisterScriptInvocation(this,"ModTest1"); m_comms.RegisterScriptInvocation(this,"ModTest2"); m_comms.RegisterScriptInvocation(this,"ModTest3"); m_comms.RegisterScriptInvocation(this,"ModTest4"); m_comms.RegisterScriptInvocation(this,"ModTest5"); m_comms.RegisterScriptInvocation(this,"ModTest6"); m_comms.RegisterScriptInvocation(this,"ModTest7"); m_comms.RegisterScriptInvocation(this,"ModTest8"); m_comms.RegisterScriptInvocation(this,"ModTestR1"); m_comms.RegisterScriptInvocation(this,"ModTest1p"); m_comms.RegisterScriptInvocation(this,"ModTest2p"); m_comms.RegisterScriptInvocation(this,"ModTest3p"); m_comms.RegisterScriptInvocation(this,"ModTest4p"); m_comms.RegisterScriptInvocation(this,"ModTest5p"); m_comms.RegisterConstant("ModConstantInt1",25); m_comms.RegisterConstant("ModConstantFloat1",25.000f); m_comms.RegisterConstant("ModConstantString1","abcdefg"); } }
public void RegionLoaded(Scene scene) { if (!m_enabled) return; m_scene = scene; m_scriptModuleComms = scene.RequestModuleInterface<IScriptModuleComms>(); if (m_scriptModuleComms == null) { m_log.Error("IScriptModuleComms could not be found, cannot add script functions"); return; } #region Constants m_scriptModuleComms.RegisterConstant("MATH_TWO_PHI", (float)(MATH_PHI * 2.0)); m_scriptModuleComms.RegisterConstant("MATH_PHI_BY_TWO", (float)(MATH_PHI / 2.0)); #endregion m_scriptModuleComms.RegisterScriptInvocations(this); m_scriptModuleComms.RegisterConstants(this); }