• 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.

Molinko

Members
  • Content count

    132
  • Joined

  • Last visited

  • Days Won

    7

1 Follower

About Molinko

  • Rank
    Leading Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

167 profile views
  1. Look up the function 'load' and or 'loadstring'. I'd post more but I'm on my phone at work
  2. https://www.lua.org/pil/2.4.html
  3. The backslash is above the the enter/return key(qwerty) below the backspace button..
  4. From what I understand file:seek is only a method available when reading files with io.open. The char you need it backslash n or '\n'. You can use the concatenation operator to join 2 strings into one. Looks like this '..' . I.e. s = 'line 1\n' .. 'line 2\n' .. 'More lines...' file:write(s)
  5. Could you post the script that is running on one of the computers when this crash happens please. 'Too long without yielding' is an error thrown by OpenOS when a program doesn't yield to let other programs or the shell run.
  6. Tis a really old post.. If you're seeking help on a particular piece of code try making a new topic in Programming/Support
  7. Key presses are events. You need to yield (i.e event.pull ) to catch them. Try this.. require('event').pull('key') print( require('keyboard').isKeyDown( 0x39 ) )
  8. FYI, dunno if you already know this but, the print function is just a wrapper for io.stdout:write with a concatenated newline char. i.e. function print( ... ) local out = "" for i = 1, #arg do out = out .. type(arg[i]) == 'string' and arg[i] or tostring(arg[i]) end io.stdout:write( out .. '\n' ) end ... Seems the latest definition of print in OpenOS uses a buffer like what @TYKUHN2 said. Here is the real def in the latest version of OpenOS. -- Other code above in file. -- found @ "/boot/00_base.lua" function print(...) local args = table.pack(...) local stdout = io.stdout stdout:setvbuf("line") for i = 1, args.n do local arg = tostring(args[i]) if i > 1 then arg = "\t" .. arg end stdout:write(arg) end stdout:write("\n") stdout:setvbuf("no") stdout:flush() end
  9. --try loading the robot lib through the require statement. In the lua interpreter the robot lib is loaded by default. -- I dont think the component.robot library uses the same robot.fill function.... -- So, either replace the top lines of your program with this... local robot = require 'robot' robot.fill(1000) -- this assumes the tank is attatched to sides.front -- Or try this which i would recommend... local component = require 'component' local sides = require 'sides' local robot = component.proxy( component.get('967f') ) robot.fill( sides.front, 1000 ) -- or whatever side you want...
  10. This is the first line of your getClick() function. Try changing it to this... notice the quotes. local _, _, x, y = event.pull( 1, 'touch' )
  11. Please run the code and copy and paste the errors. I'll try to help ya out
  12. yes it does. try again. less tude...
  13. oh but it did work. rs.getItems() returns a list(table). I assume you have 505 of something in your storage... The list returned has data(as a table) in each index. Look at it like this... local function dumpSlot(n, items) local info = items[ n ] for k, v in pairs( info ) do print( k, v ) end end -- look at details of slot 1 in list of items returned by rs.getItems() dumpSlot(1, rs.getItems())
  14. The table is being turned into a string. Lua doesn't know how to do this in a meaningful way by default. What you want are the table keys and its values. Try this out and see if its what you're looking for. for k, v in pairs(test) do print( k, tostring(v) ) end Sorry for the crap formatting. Phone...
  15. I've made some small changes.. I think this is what you're looking for arg1=... cm=require("component") si=require("sides") s=si.east c=require("colors") rs=cm.redstone doors = { -- # key, value list of door id's and their respective colors ["s1"] = 'red', ["s2"] = 'green', ["s3"] = 'brown', ["s4"] = 'blue', ["s5"] = 'purple', ["s6"] = 'cyan', ["p1"] = 'pink', ["p2"] = 'lime', ["office"] = 'yellow', ["utility"] = 'orange' } function openDoor(id, doorlist) local color = doorlist[ id ] if color then rs.setBundledOutput(s, c[ color ], 255) else print(("[%s] is not a valid door id."):format(id)) end end openDoor(arg1, doors) Hope this helps.