battlecore::screens

The screens module reads and sets the current screen, writes to the elements on it, and navigates the screen roller. Include its declarations with include "./battlecore/screens.bst";.

getScreen

Returns the name of the screen currently showing.

native string battlecore::screens.getScreen ();

setScreen

Shows a screen by name. It takes effect at once: the old screen is torn down and the new one built before this returns, so the next line can write to the new screen's elements. A designed screen replaces the built-in screen of the same name.

native void battlecore::screens.setScreen (string screenName);

Screen elements

Each of these writes to one element on the current screen, found by its id.

native void battlecore::screens.setText (string elementId, any value);
native void battlecore::screens.setValue (string elementId, int value);
native void battlecore::screens.setMax (string elementId, int total);
native void battlecore::screens.setColor (string elementId, string color);
native void battlecore::screens.setBackground (string elementId, string color);
native void battlecore::screens.setVisible (string elementId, bool visible);
native void battlecore::screens.setIcon (string elementId, string icon);
  • setText— sets a text element's content. Any value is accepted and converted, so setText("ammo", battlecore::weapon.getAmmo()) works as it is.
  • setValue — sets a gauge's value: an arc or a progress bar. Other elements ignore it.
  • setMax — sets a gauge's total, so its value is drawn as a share of it.
  • setColor — sets an element's foreground colour as "#RRGGBB". It is a string because BattleScript has no hex literals: 0xFF0000 does not mean what it looks like.
  • setBackground — sets an element's background colour as "#RRGGBB".
  • setVisible — shows or hides an element without removing it from the screen.
  • setIcon — changes which symbol an icon element draws, by name (OK, WARNING, CHARGE and so on).

getRollerIndex

Returns the index of the selected roller option, on screens that have a roller.

native int battlecore::screens.getRollerIndex ();

rollerPrev / rollerNext

Moves the roller to the previous or next option.

native void battlecore::screens.rollerPrev ();
native void battlecore::screens.rollerNext ();