pebxcvi's picture
big update
d7bb13e
1.46 Object .
1.46.1 Object.DebugCreate .
1.46.2 Object.DebugDestroy .
1.46.3 Object.DebugEnableDebugRendering .
1.46.4 Object.DebugFind .
1.46.5 Object.DebugGetAlllnstancelds .
1.46.6 Object.DebugReport .
1.46.7 Object.DebugRun .
1.46.8 Object.EnableTargeting .
1.46.9 Object.GetCurrentListenerData .
1.46.10 Object.GetlnitialPosition .
1.46.11 Object.GetlnitialRotation .
1.46.12 Object.GetlnitialScale .
1.46.13 Object.Getlnstanceld .
1.46.14 Object.GetlnstanceName .
1.46.15 Object.GetlnstanceParameter .
1.46.16 Object.GetListenerObjects .
1.46.17 Object.GetLocalizedText .
1.46.18 Object.GetMe .
1.46.19 Object.GetNameRef .
1.46.20 Object.GetObjectld .
1.46.21 Object.GetPersonld .
1.46.22 Object.FlasFocus .
1.46.23 Object.FlasLocalizedText.
1.46.24 Object.IsOwnedLocally .
1.46.25 Object.IsPaused .
1.46.26 Object.Pause .
1.46.27 Object.Resume .
1.46.28 Object.SendListenerData .
1.46.29 Object.SetFaceActiveTarget .
1.46.30 Object.SetTargetableLegend .
1.46.31 Object.SetTargetablePosition .
1.46.32 Object.SetTargetableText .
Object
Object.DebugCreate
Brief
Instantiates an object.
Definition
string Object.DebugCreate( string objectld, string type, Vector4 position=[0,0,0,1], Vector4
rotation=[0,0,0,0], Vector4 scale=[1,1,1,1] )
Arguments
objectld - The object ID of the object to be created.position - The initial position of the object in world space.rotation - The initial rotation of the
object specified as XYZ-ordered local space axis rotations in degrees.scale - The initial scale of the object.type - Type of the object. Supported
types are 'portable'.
Return Values
The instance ID of the newly created object.
Description
Instantiates an object. For debug purposes only.
Examples
� Create a new object
objectld = "12345678-12345678-12345678-12345678
instanceld = Object.DebugCreate( objectld )
� Destroy the object
Object.DebugDestroy( instanceld )
See Also
� Object. Debug Destroy
Object.DebugDestroy
Brief
Destroys an object.
Definition
Object.DebugDestroy( string instanceld )
Arguments
instanceld - The instance ID of the object to destroy.
Return Values
None.
Description
Destroys an object. For debug purposes only.
Examples
� Create a new object
objectld = "12345678-12345678-12345678-12345678
instanceld = Object.DebugCreate( objectld )
� Destroy the object
Object.DebugDestroy( instanceld )
See Also
� Object. DebugCreate
Object.DebugEnableDebugRendering
Brief
Enable/disable debug rendering for an object.
Definition
Object.DebugEnableDebugRendering( Object object, boolean setEnabled )
Arguments
object - The object for which to enable/disable debug rendering.
Return Values
None.
Description
Sets/unsets a flag in the object to indicate that debug rendering is/is not desired. The flag is interpretted by other systems, eg the collision system.
Examples
j me = Object.GetMe()
i Object.DebugEnableDebugRendering( me, true )
See Also
None
Object.DebugFind
Brief
Finds the object by the specified instance ID.
Definition
Object Object.DebugFind( string instanceld )
Arguments
instanceld - The instance ID of the object to find.
Return Values
Returns the object if it is found and nil otherwise.
Description
Finds the object by the specified instance ID.
Examples
! obj = Object.DebugFind( "0000000000000123" )
See Also
None
Object.DebugGetAlllnstancelds
Brief
Returns a table of all the instance IDs in the scene.
Definition
string[] Object.DebugGetAllInstancelds()
Arguments
None
Return Values
A table of all the instance IDs in the scene
Description
Returns a table of all the instance IDs in the scene. For debug purposes only.
Examples
ids = Object.DebugGetAllInstancelds()
for i=l,#ids do
print( ids[ i ] )
end
See Also
None
Object.DebugReport
Brief
Reports to the tty the current state of all the objects in the instance.
Definition
! Object.DebugReport()
Arguments
None
Return Values
None.
Description
Reports to the tty the current state of all the objects in the instance. For debug purposes only.
Examples
: Object.DebugReport()
See Also
None
Object.DebugRun
Brief
Runs the specified Lua string in the object's Lua environment.
Definition
: Object.DebugRun( Object object, string luaString )
Arguments
object - The object whose Lua environment will execute the specified command.luaString - The Lua string to run in the object's Lua environment.
Return Values
None.
Description
Runs the specified Lua string in the object's Lua environment if it exists. For debug purposes only.
Examples
me = Object.GetMe()
Object.DebugRun( me, "print('hi')" )
See Also
None
Object.EnableTargeting
Brief
Enables the targeting system for this object if it has one. Defaults to enabled.
Definition
Object.EnableTargeting( Object object, boolean enable )
Arguments
object - The object to update.enable - The state to put the targeting in for this object.
Return Values
None.
Description
Enables the targeting system for this object if it has one. Defaults to enabled. This can only be used by the lua environment in the object. The
object requires a targetable component.
Examples
me = Object.GetMe()
if g_isLocked == true then
Object.EnableTargeting( me, false )
end
See Also
None
Object.GetCurrentListenerData
Brief
Gets the listener data sent to it.
Definition
string|table|boolean|number Object.GetCurrentListenerData()
Arguments
None
Return Values
The custom result(s) from the listener callback function.
Description
Listener data is only present whilst in the 'on_listener_received_data' callback.
Examples
function OnListenerReceivedData()
data = Object.GetCurrentListenerData()
if data.type == "letter_message" then
for i,1 in ipairs( data.letters ) do
print( 'letter ' ..i.. '=' ..1)
end
end
end
See Also
� Object.SendListenerData
Object.GetlnitialPosition
Brief
Returns the initial position of the object.
Definition
Vector4 Object.GetlnitialPosition ( Object object )
Object.GetlnitialPosition( Object object, Vector4 outPos )
Arguments
object - The object to query.outPos - (out) The vector to receive the position.
Return Values
The initial position of the object.
Description
Returns the initial position of the object.
Examples
j me = Object.GetMe()
i print( "My initial position is ", Object.GetInitialPosition( me ) )
See Also
None
Object.GetlnitialRotation
Brief
Returns the initial rotation of the object.
Definition
Vector4 Object.GetlnitialRotation( Object object )
Object.GetlnitialRotation( Object object, Vector4 outRotation )
Arguments
object - The object to query.outRotation - (out) The vector to receive the rotation.
Return Values
Returns the initial rotation of the object.
Description
Returns the initial rotation of the object. The vector returned is the x, y, and z angles in degrees.
Examples
j me = Object.GetMe()
print( "My initial rotation is ", Object.GetlnitialRotation( me ) )
See Also
None
Object.GetlnitialScale
Brief
Returns the initial scale of the object.
Definition
Vector4 Object.GetlnitialScale( Object object )
Object.GetlnitialScale( Object object, Vector4 outScale )
Arguments
object - The object to query.outScale - (out) The vector to receive the scale.
Return Values
The initial scale of the object.
Description
Returns the initial scale of the object.
Examples
j me = Object.GetMe()
! print( "My initial scale is ", Object.GetlnitialScale( me ) )
See Also
None
Object. Getlnstanceld
Brief
Returns the object's instance ID.
Definition
! string Object.GetInstanceld( Object object )
Arguments
object - The object to query.
Return Values
The object's instance ID.
Description
Returns the object's instance ID.
Examples
: obj = Object.GetMe()
! print( "My instance id is " .. Object.Getlnstanceld( obj ) )
See Also
� Object.GetMe
Object.GetlnstanceName
Brief
Returns the instance name that is set in the scene editor.
Definition
! string Object.GetInstanceName( Object object )
Arguments
object - The object to query.
Return Values
Returns the instance name that is set in the scene editor.
Description
Returns the instance name that is set in the scene editor. Currently supported with embedded objects and scene minigames.
Examples
j print( 'my instance name is Object.GetInstanceName( Object.GetMe() ) )
See Also
� Object. GetNameRef
� Object.GetObjectld
� Object.Getlnstanceld
Object.GetlnstanceParameter
Brief
Retrieve the value of a specified instance parameter for an embedded scene object.
Definition
1 string|number|boolean|nil Object.GetInstanceParameter(Object obj, string name)
Arguments
obj - the object to queryname - the name of the instance parameter (not case-sensitive)
Return Values
The value of the instance parameter if it exists, or nil if it cannot be found.
Description
Gets the value of a specified instance parameter assigned to an embedded scene object. Only objects with an Embedded component will have
access to the instance parameters. The names of the instance parameters are not case sensitive, and the type of the value can be string, boolean
or numeric, or nil if not found. �Enum�-typed instance parameters will be returned as strings.
Examples
local me = Object.GetMe()
local myGameld = me:GetlnstanceParameter("GamelD")
if (myGameld == nil or type(myGameld) ~= "number") then
print("Invalid game ID parameter")
end
See Also
Object.GetListenerObjects
Brief
Get the list of objects registered to receive messages from this object.
Definition
table Object.GetListenerObjects(number startlndex = 1, number maxCount = -1)
Arguments
startlndex - The position to start from. Previous indices are not added to the results.maxCount - The maximum size the results array can be.
Return Values
An array of Objects. The array will be empty if no listening objects are registered.
Description
Objects can register to listen for messages from other objects. This function will retrieve a list of all currently loaded objects that have registered to
receive messages from the current object. If no such objects exist an empty table will be returned.
Examples
local listeners = Object.GetListenerObjects()
for i, obj in ipairs(listeners) do
obj:SendListenerData("Hello!")
end
See Also
� Object.SendListenerData
� Scene.GetListenerObjects
Object.GetLocalizedText
Brief
Returns the localized string for the specified reference.
Definition
! string Object.GetLocalizedText( Object object, string reference )
Arguments
object - The object to query.reference - The reference text to find the localization for.
Return Values
The localized string.
Description
Returns the localized string for the specified reference from the object's localization file.
Examples
| me = Object.GetMe()
1 localizedGameOver = Object.GetLocalizedText( me, "GAME_OVER_MESSAGE" )
See Also
� Object.GetMe
� Object.GetNameRef
Object.GetMe
Brief
Returns the object that owns the script.
Definition
j Object Object.GetMe ()
Arguments
None
Return Values
The object that owns the script.
Description
Returns the object that owns the script.
Examples
me = Object.GetMe()
See Also
None
Object.GetNameRef
Brief
Returns the localization reference of the object's name.
Definition
! string Object.GetNameRef( Object object )
Arguments
object - The object to query.
Return Values
The localization reference of the object's name.
Description
Returns the localization reference of the object's name.
Examples
| me = Object.GetMe()
i print ( "My name ref is " .. Object.GetNameRef ( me ) )
See Also
� Object. GetLocalizedText
Object.GetObjectld
Brief
Returns the object's object ID.
Definition
string Object.GetObjectld( Object object )
Arguments
object - The object to query.
Return Values
The object ID.
Description
The object's object ID.
Examples
j me = Object.GetMe()
i print( "My object id is " .. Object.GetObjectId( me ) )
See Also
� Object.GetMe
Object.GetPersonld
Brief
Returns the person ID that owns this object.
Definition
! string Object.GetPersonld( Object object )
Arguments
object - The object to query.
Return Values
The person ID of the avatar that owns this object, or nil if the object is not owned by a person.
Description
Returns the person ID of the avatar that owns this object. Some objects, such as those placed in a clubhouse, are not considered as owned by a
person, and but rather by the scene. Such objects will return nil using this function, scripts should take care to check for this case.
Examples
me = Object.GetMe()
ownerld = Object.GetPersonld( me )
if ( ownerld ~= nil ) then
name = Person.GetName( ownerld )
print( "My owner is " .. name )
end
See Also
� Object.GetMe
Object.HasFocus
Brief
Indicates if the object has the user's focus.
Definition
boolean Object.HasFocus ( Object object )
Arguments
object - The object.
Return Values
True if the game is currently active, or false if it has lost the user input focus for any reason.
Description
Various events may take the user focus away from the currently active object, such as menus and notifications. A script may wish to use this
function to poll for this case and pause the update or perform other actions while the user's focus is elsewhere. Note that due to the nature of the
various actions that may take away the user focus, it is possible for this state to alternate briefly as certain systems become active or inactive. A
script may wish to wait for several frames of the same focus state before reacting to a new state. The list of events that is considered to take focus
away from the object is subject to change, but is currently:
� Minigame exit menu
� Menu Screen
� OSK
� Game launching OSD
� Chat log in maximized mode
� Console open (in developer builds)
� Screen adjustment
� Controller disconnection
Examples
paused = false
function OnUpdateO
paused = not Object.GetMe():HasFocus()
if (paused) then
DoPausedLogic()
else
DoNormalGameLogic()
end
end
See Also
None
Object.HasLocalizedText
Brief
Returns true if a localized string exists for the specified reference.
Definition
bool Object.HasLocalizedText( Object object, string reference )
Arguments
object - The object to query.reference - The reference text to find the localization for.
Return Values
True if a localized string exists for the specified reference or false otherwise.
Description
Returns true if there exists a localized string for the specified reference in the object's localization file.
Examples
i if ( Object.HasLocalizedText( Object.GetMe(), "TEST_MESSAGE" ) ) then
print( Object.GetLocalizedText( Object.GetMe(), "TEST_MESSAGE" ) )
| end
See Also
� Object.GetMe
� Object.GetLocalizedText
Object.lsOwnedLocally
Brief
Returns true if the user owns this object and false otherwise.
Definition
I boolean Object.IsOwnedLocally( Object object )
Arguments
object - The object to query.
Return Values
true if the user owns this object and false otherwise.
Description
Returns true if the user owns this object and false otherwise.
Examples
obj = Object.GetMe()
if Object.IsOwnedLocally( obj ) then
print( "I am owned by this user" )
else
print( "I belong to someone else" )
end
See Also
� Object.GetMe
Object.lsPaused
Brief
Reports if the object's Lua environment is paused.
Definition
! boolean Object.IsPaused( Object object )
Arguments
object - The object to query.
Return Values
true if the specified object's Lua environment is paused and false otherwise.
Description
Reports if the Lua environment of the specified object is paused.
Examples
: me = Object.GetMe()
1 print( 'pause state = ' .. Object.IsPaused( me ) )
See Also
� Object. Pause
� Object. Resume
Object.Pause
Brief
Pauses the lua environment.
Definition
j Object.Pause ( Object object )
Arguments
object - The object to be paused.
Return Values
None.
Description
Pauses the lua environment.
Examples
j me = Object.GetMe()
; Object.Pause( me )
See Also
� Object. Resume
� Object. IsPaused
Object.Resume
Brief
Resumes the lua environment.
Definition
: Object.Resume( Object object )
Arguments
object - The object to be resumed.
Return Values
None.
Description
Resumes the lua environment it it is paused.
Examples
! me = Object.GetMe()
! Object.Resume( me )
See Also
� Object. Pause
� Object. IsPaused
Object.SendListenerData
Brief
Sends data from one object to another object.
Definition
string|table|boolean|number Object.SendListenerData( Object object, string|table|boolean|number data )
Arguments
object - The object to send the data to.data - The lua string to run in the object's lua environment.
Return Values
Custom return value depending on what the listener callback returns.
Description
Sends data from one object to another object.
Examples
sceneObject = Scene.GetVirtualObject ()
t = { letters={ "a", "b", "c" }, type="letter_message" }
results = Object.SendListenerData( sceneObject, t )
print( results )
See Also
Object.SetFaceActiveTarget
Brief
Set whether the avatar will face the target upon activation.
Definition
1 Object.SetFaceActiveTarget(Object object, boolean value = true)
Arguments
object - The object to update.val - Whether the avatar will face the target upon activation.
Return Values
None.
Description
Sets whether the avatar will face the target upon activation. By default, it will face the target. The object requires a targetable component.
Examples
: me = Object.GetMe()
! Object.SetFaceActiveTarget(me, false)
See Also
Object.GetMe
Object.SetTargetableLegend
Brief
Set the text of the targeting trigger (legend) for the object.
Definition
! Object.SetTargetableLegend( Object object, string text )
Arguments
object - the object to update.text - the localized text to use, or nil/empty string to use the default (the object's name)
Return Values
None.
Description
Set the text of the targeting trigger (legend) for the object. This is the initial interaction trigger for the object in the scene, which brings up the
targeting menu. The text should be pre-localized. The interaction symbol will be prepended to the text automatically. The object requires a
targetable component.
Examples
me = Object.GetMe()
i Object.SetTargetableLegend( me, "Play a game of pool!" )
See Also
� Object.SetTargetableText
Object.SetTargetablePosition
Brief
Sets the object's targetable position if it is targetable.
Definition
! Object.SetTargetablePosition( Object object, Vector4 position )
Arguments
object - The object to update.position - The new targetable position
Return Values
None.
Description
Sets the object's targetable position if it is targetable using the targetable component. The position is in world space. The object requires a
targetable component.
Examples
j me = Object.GetMe()
j Object.SetTargetablePosition( me, Vector4.Create( 1, 2, 3 ) )
See Also
� Object.GetMe
Object.SetTargetableText
Brief
Sets the text of the interact/play option in the targeting dialog.
Definition
| Object.SetTargetableText( Object object, string text )
Arguments
object - The object to update.text - The localized text to display.
Return Values
None.
Description
Sets the text of the interact/play option in the targeting dialog. The object requires a targetable component.
Examples
| me = Object.GetMe()
i Object.SetTargetableText( me, 'Switch On' )
See Also
� Object. SetTargetableLegend