Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function modemListen()
- local messageHandlers = {
- LFT = executeTurnLeft,
- RHT = executeTurnRight,
- FWD = executeForward,
- BWD = executeBack,
- UP = executeUp,
- DWN = executeDown,
- DCT_UPW = executeDetctUpward,
- DCT_DWD = executeDetctDownward,
- DCT_FWD = executeDetctForward,
- USE_FWD = executeUseForward,
- CHK_SL1 = getInventoryInfo_SLOT1,
- }
- modem.open(5)
- executed = false
- _, _, from, port, _, msg = event.pull(0.05, "modem_message")
- if msg ~= nil then
- message = msg
- if message == "LFT" and not executed then
- executeTurnLeft()
- message = " "
- end
- if message == "RHT" and not executed then
- executeTurnRight()
- message = " "
- end
- if message == "FWD" and not executed then
- executeForward()
- message = " "
- end
- if message == "BWD" and not executed then
- executeBack()
- message = " "
- end
- if message == "UP" and not executed then
- executeUp()
- message = " "
- end
- if message == "DWN" and not executed then
- executeDown()
- message = " "
- end
- if message == "DCT_UPW" and not executed then
- executeDetctUpward()
- message = " "
- end
- if message == "DCT_DWD" and not executed then
- executeDetctDownward()
- message = " "
- end
- if message == "DCT_FWD" and not executed then
- executeDetctForward()
- message = " "
- end
- if message == "USE_FWD" and not executed then
- executeUseForward()
- message = " "
- end
- if message == "CHK_SL1" and not executed then
- getInventoryInfo_SLOT1()
- message = " "
- end
- else
- message = " "
- end
- os.sleep(0.0)
- end
Add Comment
Please, Sign In to add comment