Stormworks: Build and Rescue

Stormworks: Build and Rescue

Not enough ratings
Toggleable buttons and style [Number]
   
Award
Favorite
Favorited
Unfavorite
Microcontrollers: Cockpit, Microcontroller
Tags: v0.7.4
File Size
Posted
32.715 KB
18 May, 2019 @ 7:35am
1 Change Note ( view )

Subscribe to download
Toggleable buttons and style [Number]

Description
Presentation

This microcontroller allow you to create a 2x2 (by default) maximum 6 toggleables buttons screen.
You can use a bigger screen, but don't forget to set correct values for the " w " in the sub-table " pos " of each buttons.

Settings

- Change the background color :
globalBackGroundColor = function() screen.setColor(89, 89, 89) end

{"btn_1", display=true, pos={x=1, y=2, w=62, h=9}, borderAndTextColor=function() screen.setColor(0, 0, 0) end, backgroundColor=function() screen.setColor(255, 255, 255) end, text="Button 1", outputChannel=1, valOn=0, valOff=0, defaultState=false}

Field
Description
First field
the first field ( "btn_1" in this exemple) is the name of the button, not used anywhere. just a memo for you. If you don't use it, you can remove the field and don't forget the comma.
pos
This field is the position from the top-left corner of the screen. In order : x, y, width, height
borderAndTextColor
This field define the color of borders and text. When the button is toggled, the borders and text take the background color.
backgroundColor
This field define the color of the button background. When the button is toggled, the background take the borders and text color.
text
This field define the displayed text of the button.
channel
Define the exit channel of the signal with the exit composite signal. If you change it, don't forget to update module after the LUA module.
valOn
Define the value returned when the button is toggled.
valOff
Define the value returned when the button is not toggled.
defaultState
Define the default state when the microcontroller is initialized.
1 Comments
SamuelPepys 31 Jan, 2020 @ 3:14pm 
Hey! Am using this right now. Is there any way of making a couple of buttons non-toggle? Also, what would I need to change if I wanted to input and display a number (distance to target) other than changing the sizes of the buttons to accomodate it? Hope it's not too much to ask :)