-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open Computers Tutorial
First of all, you must place a computer and insert the appropriate components. You can find more information here.
The next step is to connect a controller to the computer so that the corresponding signal can be controlled. The controller can either be placed directly next the PC or connected with a cable. Now the controller must be linked to a signal. You can find out how to do this here.
(controller with outdated texture)
Once you have placed and connected everything, you can type lua in the console to open the Lua interpreter. You can get out of this at any time with CTRL+D.
Very important, each command must be preceded by component.signalcontroller.
component.signalcontroller.hasLink()Output: booleanWith this command you can check whether the signal is correctly linked.
component.signalcontroller.getSignalType()Output: stringWith this command you can display the signal type of the linked signal.
component.signalcontroller.getSupportedSignalTypes()Output: table{string, int <type>}With this command you can display which signal types you can control. The ID in the form of an integer is relevant.
component.signalcontroller.getSignalState(int <type>)Output: int <state>Example: component.signalcontroller.getSignalState(3) -> 1With this command, you can output which signal aspect displays the signal as an integer.
component.signalcontroller.changeSignal(int <type>, int <state>)Output: booleanExample: component.signalcontroller.changeSignal(3,1)With this command you can finally adjust the signal. To do this, you must enter the IDs in the brackets as integers (signal type, signal state). You can find more information about what you can enter here. A boolean is output whether it has been adjusted or not.
component.signalcontroller.addressOutput: stringWith this command you can display the address of the controller.
If you want to run the signals via some kind of signal box, it is a good idea to write your own programme. You can find more information here. And you can find examples of programmes in our code samples. These are only simple examples and not fully functional signal boxes.