Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

notgodsarmy666

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by notgodsarmy666

  1. I am not very versed in that kind of programming,

    but I managed to write the following code so far:

    local modem=component.proxy(component.list("modem")())
    local turbine=component.proxy(component.list("br_turbine")())
    modem.open(1)
    local target = false
    while true do
    	local e, to, from, _, _, command = computer.pullSignal()
    	if e == "modem_message" then
    		if command == "s" then
    			modem.send(from,1, "Handshake")
    			local target = from
    		elseif command == "a" then
    			if (turbine.getActive()) then
    				turbine.setActive(false)
    			else
    				turbine.setActive(true)
    			end
    		elseif command == "c" then
    			if (turbine.getInductorEngaged()) then
    				turbine.setInductorEngaged(false)
    			else
    				turbine.setInductorEngaged(true)
    			end
    		elseif (target) then
    			local data1 = tostring(turbine.getActive())
    			local data2 = tostring(turbine.setInductorEngaged())
    			local data3 = tostring(turbine.getRotorSpeed())
    			modem.send(target,1, data1, data2, data3)
    		end
    	end
    end

    But if I try to run it I only get the error message:

    Quote

    bad argument #1 (string expected, got nil)

    and I haven't a clue what did I wrong where.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.