Line 6: | Line 6: | ||
end | end | ||
− | Space.Host.ExecutingObject.UISlider.OnValueChanged(valueChanged)</pre>}} | + | Space.Host.ExecutingObject.UISlider.OnValueChanged(valueChanged)</pre>|6=<pre>--This script will make moving a slider control the Master Volume |
+ | --and also update a text field with the current Master Volume | ||
+ | --(example: custom UI) | ||
+ | --[You need to add the slider and text field as a reference] | ||
+ | |||
+ | slider = Space.Host.GetReference("Slider").UISlider | ||
+ | textField = Space.Host.GetReference("Text Field").UIText | ||
+ | |||
+ | |||
+ | OnValueChanged = function() | ||
+ | Space.UI.MasterVolume = slider.NormalizedValue * 100 | ||
+ | textField.Text = Space.UI.MasterVolume | ||
+ | end | ||
+ | |||
+ | slider.OnValueChanged(OnValueChanged)</pre>}} | ||
Line 38: | Line 52: | ||
}} | }} | ||
{{ScriptFunction|float|NormalizedValue|{ get;set; }|The current value of the slider normalized into a value between 0 and 1.|5=<pre>Space.Log(Space.Host.ExecutingObject.UISlider.NormalizedValue) | {{ScriptFunction|float|NormalizedValue|{ get;set; }|The current value of the slider normalized into a value between 0 and 1.|5=<pre>Space.Log(Space.Host.ExecutingObject.UISlider.NormalizedValue) | ||
− | --displays the current normalized value of the slider in the console</pre>}} | + | --displays the current normalized value of the slider in the console</pre>|6=<pre>--This script will make moving a slider control the Master Volume |
+ | --and also update a text field with the current Master Volume | ||
+ | --(example: custom UI) | ||
+ | --[You need to add the slider and text field as a reference] | ||
+ | |||
+ | slider = Space.Host.GetReference("Slider").UISlider | ||
+ | textField = Space.Host.GetReference("Text Field").UIText | ||
+ | |||
+ | |||
+ | OnValueChanged = function() | ||
+ | Space.UI.MasterVolume = slider.NormalizedValue * 100 | ||
+ | textField.Text = Space.UI.MasterVolume | ||
+ | end | ||
+ | |||
+ | slider.OnValueChanged(OnValueChanged)</pre>}} | ||
{{ScriptFunction|SColor|PressedColor|{get;set}|The color of the control when it is pressed.|5= | {{ScriptFunction|SColor|PressedColor|{get;set}|The color of the control when it is pressed.|5= |
Callback executed when the value of the slider is changed.
function valueChanged() Space.Log("value changed") end Space.Host.ExecutingObject.UISlider.OnValueChanged(valueChanged)
--This script will make moving a slider control the Master Volume --and also update a text field with the current Master Volume --(example: custom UI) --[You need to add the slider and text field as a reference] slider = Space.Host.GetReference("Slider").UISlider textField = Space.Host.GetReference("Text Field").UIText OnValueChanged = function() Space.UI.MasterVolume = slider.NormalizedValue * 100 textField.Text = Space.UI.MasterVolume end slider.OnValueChanged(OnValueChanged)
This multiplies the tint color for each transition by its value.
The direction of the slider (0 to 4). 0 Left To Right, 1 Right To Left, 2 Bottom To Top, 3 Top To Bottom
Space.Host.ExecutingObject.UISlider.Direction = 1
The color of the control when it is disabled.
Whether this slider is Enabled or not
Space.Host.ExecutingObject.UISlider.Enabled = false --or false
The color of the control when it is highlighted.
Use to enable or disable the ability to interact with the slider.
Space.Host.ExecutingObject.UISlider.Interactable = true
The maximum allowed value of the slider.
Space.Host.ExecutingObject.UISlider.MaxValue = 20
The minimum allowed value of the slider.
Space.Host.ExecutingObject.UISlider.MinValue = 10
The normal color.
The current value of the slider normalized into a value between 0 and 1.
Space.Log(Space.Host.ExecutingObject.UISlider.NormalizedValue) --displays the current normalized value of the slider in the console
--This script will make moving a slider control the Master Volume --and also update a text field with the current Master Volume --(example: custom UI) --[You need to add the slider and text field as a reference] slider = Space.Host.GetReference("Slider").UISlider textField = Space.Host.GetReference("Text Field").UIText OnValueChanged = function() Space.UI.MasterVolume = slider.NormalizedValue * 100 textField.Text = Space.UI.MasterVolume end slider.OnValueChanged(OnValueChanged)
The color of the control when it is pressed.
The current value of the slider.
Space.Log(Space.Host.ExecutingObject.UISlider.Value) --displays the current value of the slider in the console
Should the value only be allowed to be whole numbers?
Space.Host.ExecutingObject.UISlider.WholeNumbers = true --or false
|