• Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Welcome to OpenComputers

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more!

This message will be removed once you have signed in.

  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.6.1 for MC 1.7.10, 1.8.9, 1.9.4 & 1.10.2. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)

Molinko

Members
  • Content count

    202
  • Joined

  • Last visited

  • Days Won

    20

1 Follower

About Molinko

  • Rank
    Leading Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

634 profile views
  1. what am i doing wrong?

    The screenshot resolution is hard to read. Could you post the full code in 'code' tags?
  2. thread question #2

    Please post all your code. In code tags please.
  3. Break not exiting while loop

    Thanks. It's always referenced as 'the' newline char
  4. Lost mount after installing OpenOS

    Start from scratch. Install OpenOS on fresh hardware. Reboot. Then create your directories and whatnot.
  5. Break not exiting while loop

    I believe term.read returns its input with a newline char (\n) appended to the end of its output. So, typing 'exit' would return 'exit\n'. One option is to use io.read if you don't need all of the options term.read offers. io.read will return the input without a newline. Or, you can strip the newline and compare as usual. local input = term.read() if input:sub(-2) == 'exit' then -- # I believe input:sub(-2) should strip the last two chars (\n) from the input variable... end
  6. Can a robot use a Tool Forge or other type of crafting block?

    Have you tried getting the robot to pull from specific sides of the block? Some blocks robot can only pull from a specific side.
  7. Micro controller programming. (my erorrs in it)

    When you're dumb and overlook the obvious.. thanks. I don't know why I didn't think of that...
  8. Micro controller programming. (my erorrs in it)

    It's pretty hard to tell where exactly this is coming from. I dont have br and im too lazy to install a modpack with it.... However, I would usggest littering your code with print statements to see where specifically the code is failing... Try this and see if provides any clues... local modem=component.proxy(component.list("modem")()) local turbine=component.proxy(component.list("br_turbine")()) modem.open(1) local target = false print "main loop start." while true do local e, to, from, _, _, command = computer.pullSignal() if e == "modem_message" then print("modem_message event. from: '" .. from .. "'") if command == "s" then print "'s' command. sending handshake." modem.send(from,1, "Handshake") local target = from elseif command == "a" then print "active command" if (turbine.getActive()) then turbine.setActive(false) print "turbine inactive" else turbine.setActive(true) print "turbine active" end elseif command == "c" then print "inductor command" if (turbine.getInductorEngaged()) then print "inductor disengaged" turbine.setInductorEngaged(false) else print "inductor engaged" turbine.setInductorEngaged(true) end elseif (target) then print "target... how did we get here..." local data1 = tostring(turbine.getActive()) local data2 = tostring(turbine.setInductorEngaged()) local data3 = tostring(turbine.getRotorSpeed()) print("sending turbine data to target") print("target: " .. (type(target)=="string" and target or "target should be string not bool..")) modem.send(target,1, data1, data2, data3) end end end print "we made it..."
  9. Sending multiple Variables in the network

    I'm pretty sure your problem is here.. data1 = pct -- pct is nil data2 = nrj -- nrj is nil data3 = nrjMax -- nrjMax is nil gpu.set(4,8,nrj) -- This is where the error comes from. "Bad Argument #3 (string expected, got nil.)"... gpu.set(4,10,nrjMax) -- so on.. gpu.set(4,12,pct) -- and so on.. Nowhere in the above code you supplied did you define the values of pct, nrj, or nrjMax. So, they are nil.
  10. Sending multiple Variables in the network

    From looking at the modem component API you should be able to send up to 8 basic datums in each message. From what I can see in your example It should work fine sending. Could you post your receiving code? The 'modem_message' event has 5 return values before the data you've sent. local _event, localAddress, remoteAddress, portNumber, distance, sentData1, sentData2, sentData3, sentData4 = event.pull("modem_message")
  11. Motion sensor isn't working

    I'm sorry for the headache rather than the help.. local component = require("component") local sides = require("sides") local event = require("event") local term = require("term") local thread = require("thread") local rs = component.redstone local gpu = component.gpu -- Config local delay, isOpen = 5, (rs.getOutput(sides.right) > 0) and true or false local timer = nil term.clear() term.setCursor(1, 1) gpu.setForeground(0x00FF00) print("--------------------------- ToNELvision MICROSYTEMS ---------------------------\n") gpu.setForeground(0xFFFFFF) print("Welcome. Please enter one of the displayed commands. It may take a few seconds for the command to be interpreted.\n") gpu.setForeground(0xE6AB38) print("Open\nClose") term.setCursor(1, 9) local inputThread inputThread = thread.create(function() while true do local input = term.read(nil, false) if type(input) == "string" then input = input:sub(1, -2) elseif type(input) == "boolean" and input == false then print("interrupted") inputThread:kill() end term.clearLine() if input == "open" or input == "Open" then if not isOpen then rs.setOutput(sides.right, 15) isOpen = true if timer then event.cancel(timer) end timer = event.timer(delay, function() if isOpen then rs.setOutput(sides.right, 0) isOpen = false timer = nil end end) end elseif input == "close" or input == "Close" then if isOpen then rs.setOutput(sides.right, 0) event.cancel(timer) isOpen = false end elseif input == "quit" or input == "Quit" then inputThread:kill() end end end) local motionThread = thread.create(function() while true do local _, _, x, y, name = event.pull("motion") if not isOpen then rs.setOutput(sides.right, 15) isOpen = true if timer then event.cancel(timer) end timer = event.timer(delay, function() if isOpen then rs.setOutput(sides.right, 0) isOpen = false timer = nil end end) else event.cancel(timer) timer = event.timer(delay, function() if isOpen then rs.setOutput(sides.right, 0) isOpen = false timer = nil end end) end end end) thread.waitForAny({inputThread, motionThread}) print("\nProgram Exit") os.exit() Tested... sorry for the headache...
  12. Motion sensor isn't working

    I edited the original script in my post. I'm confident I fixed open() however I'm not sure if threads can call thread:kill() from within themselves.. So quitting may still be bugged :/
  13. Motion sensor isn't working

    The thread library is included in later versions of openos. Check the forums for openos updater. Download it with internet card. Install it. Lemme know how it goes.
  14. Motion sensor isn't working

    local component = require("component") local sides = require("sides") local event = require("event") local term = require("term") local thread = require("thread") local rs = component.redstone local gpu = component.gpu -- Config local delay = 5 local function open() rs.setOutput(sides.right, 15) os.sleep(delay) rs.setOutput(sides.right, 0) end local inputThread inputThread = thread.create(function() while true do term.clear() term.setCursor(1, 1) gpu.setForeground(0x00FF00) print("--------------------------- ToNELvision MICROSYTEMS ---------------------------\n") gpu.setForeground(0xFFFFFF) print("Welcome. Please enter one of the displayed commands. It may take a few seconds for the command to be interpreted.\n") gpu.setForeground(0xE6AB38) print("Open\nClose") term.setCursor(1, 9) local input = term.read() if input == "open" or input == "Open" then open() elseif input == "quit" or input == "Quit" then inputThread:kill() end end end) local motionThread = thread.create(function() while true do local _, _, x, y, name = event.pull("motion") open() end end) thread.waitForAny({inputThread, motionThread}) print("\nProgram Exit") This is and example using payonels thread api. I haven't used it yet myself but it is very powerful. Hats off to payonel for this one. If this example has a bug, (its untested), lets me know the error and ill try to remedy it..
  15. Motion sensor isn't working

    The motion sensor must be in line of sight. Solid blocks and maybe even doors will keep the motion sensor from triggering. From a glance the code seems like it should work as expected...