Slider
A bar the player drags (or moves with the arrow keys, D-pad or stick once picked) to choose a number between Min and Max. Options menus need no code: set Setting to a volume and the slider changes it, and the game remembers it next time. SaveAs keeps any other choice (a difficulty) in Game.SaveData.
Draws itself (its entity draws at Order 100 unless it has a Sprite, whose order counts).
In a network game, each machine keeps its own entity with this on it: it isn’t sent.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
value: a number = 1. Where it’s set, from Min to Max: a text inside it can show it (“{0:0} ms”). (Field: a number.)min: a number = 0. The value at its left end. (Field: a number.)max: a number = 1. The value at its right end. (Field: a number.)step: a number = 0.1. How far one press of an arrow key moves it, and what dragging snaps to: 0.1 picks tenths. 0 doesn’t snap, and the keys move it a tenth of the way. (Field: a number.)
Setting and Saving
Section titled “Setting and Saving”setting: one of None, Volume, MusicVolume, SoundVolume, Sound, Fullscreen, Skip, Auto, SkipUnread, AutoSpeed, AudioOffset, VisualOffset, NoteSpeed, WindowSize, VSync, FrameCap, UiScale, EdgeScroll, PanSpeed = “None”. A setting of the game it changes, like the music volume. While set, the slider always shows that setting: a volume from 0 to 1 fills it from Min to Max, so a slider from 0 to 10 works too. An offset is in milliseconds, which is the slider’s value. (Field: one of its values.)saveAs: text = null. A name to keep the value under in Game.SaveData, e.g. “difficulty”: it’s saved whenever it changes and comes back next time. Read it from scripts with Game.SaveData.GetFloat(“difficulty”). (Names a name in the save data: this entity’s own, which other fields can name.) (Field: a name.)
Control
Section titled “Control”sound: text = null. A sound played as the value changes, e.g. “Sounds/blip.wav”: with the sound volume, you hear how loud it is. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)navigable: true or false = true. Whether the arrow keys, D-pad and stick can move to it, like Button.Navigable. (Field: on or off.)
size: [x, y] = [4,0.5]. World units before the transform’s scale, centered on the entity. It’s dragged along its width. (A rectangle’s size, around the entity, in its own units before its scale: with Resize handles the Scene view puts handles on its edges and corners to drag.) (Field: a vector.)fill: a color, “#RRGGBB” or “#RRGGBBAA” = “#4C9AFFFF”. The color of the part up to the handle. (Field: a color.)background: a color, “#RRGGBB” or “#RRGGBBAA” = “#00000080”. The color of the track past the handle. (Field: a color.)knob: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFFF”. The handle at the end of the filled part. Transparent for none. (Field: a color.)order: a whole number = 100. Higher draws on top, like Sprite.Order. (Field: a number.)
Images
Section titled “Images”fillImage: text = null. A picture for the part up to the handle instead of a plain color, e.g. “Sprites/slider_fill.png”: laid over the whole slider and shown only as far as it’s set, cut off there rather than squeezed, and tinted by Fill (white shows the picture as it is). (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)backgroundImage: text = null. A picture for the track behind the fill, shown whole, instead of a plain color; tinted by Background. (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)backgroundSlice: a number = 0. For a track that stretches (nine-slice), like Sprite.Slice: how much of the BackgroundImage, from 0 to 0.5 of its width and height, is border at each edge. Its corners then keep their shape however long the slider is. 0 stretches the whole picture. (Only used when backgroundImage is set.) (Field: a number.)backgroundSliceSize: a number = 0.1. With BackgroundSlice: how big the border is drawn, in world units (never more than half the slider). (Only used when backgroundSlice is set.) (Field: a number.)knobImage: text = null. A picture for the handle instead of a plain rectangle, e.g. “Sprites/slider_knob.png”: drawn at the end of the filled part in the handle’s usual box (half as wide as the slider is high, one and a half times as tall), tinted by Knob. A transparent Knob still hides it. (A picture in Assets, e.g. “Sprites/back.png”.) (Field: an image.)
Outputs
Section titled “Outputs”What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.
Value(a number). Where it’s set, from Min to Max: a text inside it can show it (“{0:0} ms”).
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
isHovered: true or false. True while the mouse is over it.isFocused: true or false. True while the keyboard or a gamepad has picked it (see Button.IsFocused); left and right change it.isDragging: true or false. True while it’s being dragged with the mouse.fraction: a number. How far along it is, from 0 at Min to 1 at Max.
Scripts use it as Slider: its methods, events and values that aren’t saved with the scene.