Choice
Turns a Button into a picker of one of several Options: “Difficulty: Normal”. Left and right change it while it’s picked, and clicking (or the mouse wheel) moves to the next. SaveAs keeps the choice for next time, for scripts to read with Game.SaveData.GetString(“difficulty”). Needs a Button on the same entity.
Requires: Button
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.
options: lines of text: an array of strings, or one string with line breaks = [“Easy”,“Normal”,“Hard”]. What can be picked, one per row. (Options in order (as a list, one a line; as text, separated by commas), at least 1. The Inspector lists them a row each to rename, add, take out and reorder.) (Field: its own editor: Name List.)index: a whole number = 1. Which option is picked, from 0. (Field: a number.)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 picks, with no code: Window Size or Frame Cap. While set, its options are the setting’s own (the window sizes that fit the screen, or the frame caps) in place of Options, it always shows the setting, and the game remembers it next time. (Field: one of its values.)format: text = “{0}”. What the entity’s Text says, with {0} for the option: “Difficulty: < {0} >”. Empty leaves the text alone. (Text with holes the game fills in: {0} the option picked, each with a number format after a colon if it says, e.g. {0:000}. The Inspector has a button for each and shows how it reads now.) (Field: its own editor: Format.)saveAs: text = null. A name to keep the option under in Game.SaveData, e.g. “difficulty”. It’s saved as the option’s text. (Names a name in the save data: this entity’s own, which other fields can name.) (Field: a name.)wrap: true or false = true. Whether going past the last option comes round to the first again (and back). (Field: on or off.)sound: text = null. A sound played as it changes, e.g. “Sounds/blip.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
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.
value: text. The option picked, or null if there are none.
Scripts use it as Choice: its methods, events and values that aren’t saved with the scene.