Skip to content

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 setMembersUsed by
AccessAccess.GRANTED Access.DENIEDplayer.result in Access Controller events
ButtonButton.ONE Button.TWO Button.THREE Button.FOURControl Panel buttons and button.id
DirectionDirection.NORTH Direction.SOUTH Direction.EAST Direction.WEST Direction.UP Direction.DOWNRedstone Controller faces, Inventory Module faces and the face value of events
EntityEntity.ALL Entity.PLAYER Entity.HOSTILE Entity.PASSIVE Entity.ITEM Entity.OTHEREntity Detector filters and entity.category
PortModePortMode.INPUT PortMode.OUTPUTRedstone Controller setMode()
SoundSound.BELL Sound.PLING Sound.CHIME Sound.BASSAlarm Module configure()
WeatherWeather.CLEAR Weather.RAIN Weather.THUNDERweather() 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))
}
}
  • print shows a constant with its set, such as Direction.NORTH.
  • Values from devices are constants where the table says so, for example entity.category in detector events, weather() and the face value of Redstone Controller events.
  • Some results are text instead, for example mode(face) returns "input" or "output" and scan() results have category as 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.