Constants
FilaSignal provides these constant sets to every program. They work like enums
you declare yourself: compare them with is, store them in globals and use their names as type annotations. Where a
device method takes a choice, the matching text also works: Direction.NORTH and "north" mean the same.
| Constant set | Members | Used by |
|---|---|---|
Access | Access.GRANTED Access.DENIED | player.result in Access Controller events |
Button | Button.ONE Button.TWO Button.THREE Button.FOUR | Control Panel buttons and button.id |
Direction | Direction.NORTH Direction.SOUTH Direction.EAST Direction.WEST Direction.UP Direction.DOWN | Redstone Controller faces, Inventory Module faces and the face value of events |
Entity | Entity.ALL Entity.PLAYER Entity.HOSTILE Entity.PASSIVE Entity.ITEM Entity.OTHER | Entity Detector filters and entity.category |
PortMode | PortMode.INPUT PortMode.OUTPUT | Redstone Controller setMode() |
Sound | Sound.BELL Sound.PLING Sound.CHIME Sound.BASS | Alarm Module configure() |
Weather | Weather.CLEAR Weather.RAIN Weather.THUNDER | weather() and weatherChanged |
const lamps = redstoneControllers.named("lamps")global last: Direction = Direction.NORTH
on lamps.inputChanged(face, power, previous) { last = face if face is Direction.UP { print("Something above changed to " + str(power)) }}printshows a constant with its set, such asDirection.NORTH.- Values from devices are constants where the table says so, for example
entity.categoryin detector events,weather()and thefacevalue of Redstone Controller events. - Some results are text instead, for example
mode(face)returns"input"or"output"andscan()results havecategoryas text. Each reference entry says which. - A constant set you declare with the same name, such as your own
enum Weather, replaces FilaSignal’s in your program. - Constants cannot be stored in drive or Storage Server storage. Store their text with
str(...)instead.