Skip to content

Examples: MTC Status Transmitter

Kenny Mensah edited this page Jan 15, 2020 · 1 revision

Examples: MTC Status Transmitter

Requirements

ComputerCraft. You can get the latest 1.7.10 version here.

Not required for this setup, but for this example, the computer is located right next to the transmitter:

Speed Transmitter under the tracks, and a computer to the side of the speed transmitter

Set the MTC Status

The MTC Status is what mode MTC is active in. A 1 means it's on, a 2 means it's going to end soon on the line, and a 3 is inactive. However for that a 0 is usually used. In this example, the MTC Status will be set to Active once a train passes over it. However, please note, speed transmitters do this automatically, but this is for manual control.

local mtcTransmitter = peripheral.find("info_transmitter_mtc") -- Finds a status transmitter attached to the computer
local mtcStatus = 1 -- The status we want to transmit to the train

mtcTransmitter.setMTCStatus(1) -- Sets the MTC Status
mtcTransmitter.activate() -- Actives the status transmitter

Set the MTC Type

There are two kinds of MTC, standard MTC and Wireless Minecraft Train Control, which allows you remotely send data to trains. MTC has a type number of 1, while W-MTC is 2. This is normally set to 1 though.

local mtcTransmitter = peripheral.find("info_transmitter_mtc") -- Finds a status transmitter attached to the computer
local mtcStatus = 1 -- The status we want to transmit to the train
local mtcType = 2 -- The MTC type we want to send to the train
mtcTransmitter.setMTCStatus(1) -- Sets the MTC Status
mtcTransmitter.setMTCType(1) -- Sets the MTC Type
mtcTransmitter.activate() -- Actives the status transmitter

Set the server UUID

This isn't really necessary unless you use W-MTC, where you need to set the ID you need to send instructions to. Make sure the MTC Type is set to 2 for W-MTC.

local mtcTransmitter = peripheral.find("info_transmitter_mtc") -- Finds a status transmitter attached to the computer
local mtcStatus = 1 -- The status we want to transmit to the train
local mtcType = 2 -- The MTC type we want to send to the train
local uuid = "171f1884-35df-409a-bf7f-9cfea308b586"
mtcTransmitter.setMTCType(1) -- Sets the MTC Status
mtcTransmitter.setMTCType(2) -- Sets the MTC Type
mtcTransmitter.setServerUUID(uuid) -- Sets the UUID for the train when it passes over
mtcTransmitter.activate() -- Actives the status transmitter

Set the signal block the train in

This isn't necessary unless you use W-MTC, where you need to set the signal block the train is in for identification purposes.

local mtcTransmitter = peripheral.find("info_transmitter_mtc") -- Finds a status transmitter attached to the computer
local mtcStatus = 1 -- The status we want to transmit to the train
local mtcType = 2 -- The MTC type we want to send to the train

mtcTransmitter.setMTCType(2) -- Sets the MTC Type
mtcTransmitter.setServerUUID(uuid) -- Sets the UUID for the train when it passes over
mtcTransmitter.setSignalBlock("TF-2")
mtcTransmitter.activate() -- Actives the status transmitter

Anything else?

By these examples, (and the comments), you have learned how to set the MTC type, serverUUID, and signal block for the MTC Status Transmitter.

If you still need help, contact PeachMaster#9135 (or ((PeachMaster)chair.ridingEntity)) on the Discord. Happy coding!

Clone this wiki locally