/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_SCRIPT_H #define CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_SCRIPT_H #pragma once #include /*! * This class implements script-functions for exposing the scripting system functionalities. * After initialization of the script-object it will be globally accessable through scripts using the namespace "Script". */ class CScriptBind_Script : public CScriptableBase { public: CScriptBind_Script(IScriptSystem* pScriptSystem, ISystem* pSystem); virtual ~CScriptBind_Script(); virtual void GetMemoryUsage(ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } //! Script.LoadScript(scriptName) //! Loads the script. //! name of the script to load int LoadScript(IFunctionHandler* pH); //! Script.ReloadScripts() //! Reloads all the scripts. int ReloadScripts(IFunctionHandler* pH); //! Script.ReloadScript() //! Reload the script. int ReloadScript(IFunctionHandler* pH); //! Script.ReloadEntityScript( className ) //! Name of the entity script. //! Reloads the specified entity script. int ReloadEntityScript(IFunctionHandler* pH, const char* className); //! Script.UnloadScript() //! Unloads the script. int UnloadScript(IFunctionHandler* pH); //! Script.DumpLoadedScripts() //! Dumps all the loaded scripts. int DumpLoadedScripts(IFunctionHandler* pH); //! Script.SetTimer( nMilliseconds, luaFunction [, userData [, bUpdateDuringPause]] ) //! //! Set a general script timer, when timer expires will call back a specified lua function. //! Lua function will accept 1 or 2 parameters, //! if userData is specified luaFunction must be: //!
LuaCallback = function( userData,nTimerId )
    //!         -- function body
    //!      end;
//! if userData is not specified luaFunction must be: //!
LuaCallback = function( nTimerId )
    //!         -- function body
    //!      end;
//!
//! Delay of trigger in milliseconds. //! . //! (optional) Any user defined table. If specified will be passed as a first argument of the callback function. //! (optional) will be updated and trigger even if in pause mode. //! ID assigned to this timer or nil if not specified. int SetTimer(IFunctionHandler* pH, int nMilliseconds, HSCRIPTFUNCTION hFunc); //! Script.SetTimerForFunction( nMilliseconds, luaFunction [, userData [, bUpdateDuringPause]] ) //! //! Set a general script timer, when timer expires will call back a specified lua function. //! Lua function will accept 1 or 2 parameters, //! if userData is specified luaFunction must be: //!
LuaCallback = function( userData,nTimerId )
    //!         -- function body
    //!      end;
//! if userData is not specified luaFunction must be: //!
LuaCallback = function( nTimerId )
    //!         -- function body
    //!      end;
//!.
//! Delay of trigger in milliseconds. //! . //! (optional) Any user defined table. If specified it will be passed as a first argument of the callback function. //! (optional) will be updated and trigger even if in pause mode. //! ID assigned to this timer or nil if not specified. int SetTimerForFunction(IFunctionHandler* pH, int nMilliseconds, const char* sFunctionName); //! Script.KillTimer( nTimerId ) //! Stops a timer set by the Script.SetTimer function. //! ID of the timer returned by the Script.SetTimer function. int KillTimer(IFunctionHandler* pH, ScriptHandle nTimerId); }; #endif // CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_SCRIPT_H