wiki.sine.space | sinespace

Difference between revisions of "Scripting/SScriptingData"

From wiki.sine.space
Jump to: navigation, search
Line 4: Line 4:
 
{{ScriptFunction|bool|Enabled|{get; set;}|Return if the ScriptingData component is Enabled or not|5=local thisObject=Space.Host.ExecutingObject<br>
 
{{ScriptFunction|bool|Enabled|{get; set;}|Return if the ScriptingData component is Enabled or not|5=local thisObject=Space.Host.ExecutingObject<br>
 
local thisObjectData=thisObject.Data<br>
 
local thisObjectData=thisObject.Data<br>
Space.Log(thisObjectData.Enabled)
+
Space.Log(thisObjectData.Enabled)|6=<pre>--clicking this object will Enable/Disable it's Scripting Data component
 +
thisGameObject = Space.Host.ExecutingObject
 +
component = thisGameObject.Data
 +
 
 +
OnClick = function()
 +
component.Enabled =  not component.Enabled
 +
end
 +
 
 +
 
 +
thisGameObject.AddClickable()
 +
thisGameObject.Clickable.OnClick(OnClick)</pre>
 
}}
 
}}
  

Revision as of 03:59, 13 October 2021

Composts of ScriptingData class.

Members

Enabled

bool Enabled {get; set;}

Return if the ScriptingData component is Enabled or not

local thisObject=Space.Host.ExecutingObject

local thisObjectData=thisObject.Data

Space.Log(thisObjectData.Enabled)


--clicking this object will Enable/Disable it's Scripting Data component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.Data

OnClick = function()
component.Enabled =  not component.Enabled
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

Variables

string Variables {get;}

Return a list of variables.

local thisObject=Space.Host.ExecutingObject.

local thisObjectVariable=thisObject.Data.Variables
for i=1, #thisObjectVariable do
    Space.Log(thisObjectVariable[i])

end



Properties

SetVariable

void SetVariable {string name, DynValue property;}

Set properties to variable.

local thisObject=Space.Host.ExecutingObject.

thisObjectData.SetVariable(no1Name,"no1",false)

Space.Log(no1)


GetVariable

object GetVariable {string name;}

Return the object of the variable.

local thisObject=Space.Host.ExecutingObject.

local thisObjectVariable=thisObject.Data.Variables
for i=1, #thisObjectVariable do
    Space.Log(thisObjectVariable[i])

end