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

Teodeoth

Members
  • Content Count

    7
  • Joined

  • Last visited

About Teodeoth

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. From the wiki: This can be changed in the config file. For me, it is lines 789-792.
  2. Disclaimer first, I have never tried to use any of these specific blocks. That said, I have enjoyed using opencomputers for other things. From what I can see here, there is a getStackInSlot() function that will let you get an itemstack as a table from a specified inventory slot. According to documentation for a different component with almost identical purpose and function name, that table should look something like this: Of corse, it will return nil if there is a problem. As "name" is the internal name, you probably want to look at "label" for the name that is displayed in-game.
  3. As you seem to favor the whitelist approach, I would use CptMercury's 2nd option, and just log the address and message that we get from the modem message, and get the time from os.date(). something like log_file.write(string.format("%s: Got '%s' from %s.\n", os.date(), msg, send_addr)) in the else clause. P.S. You only need a whitelist or a blacklist, as everything not on one is assumed to be on the other.
  4. My vote is to use the navigation upgrade to get relative coordinates to the center of a map. You can send the robot to (0, 0, 0) to find where it thinks that is, and then just write down the real coordinates for the spot to be used as an offset so that you can convert relative to absolute. As an alternative, you can: 1) Using the navigation and waypoints, you can retrieve coordinates of specific blocks and their coordinates relative to the robot 2) Try a gps-like approach by measuring the signal strength of wireless transmitters at known locations 3) Use the error codes from robot.move() to tell if it was sucessfull, and update some internal counters to track offset from a starting position
  5. Thank you for the tip. I had not thought to look in OpenOS for serialization tools, partly because I had not thought that it had any, and also partly because I was hoeping to cram everything onto a single eeprom. I will have a look at the OpenOS libraries again. Out of curiosity, do you think that it would be possable to fit the OpenOS serialization function onto the eeprom?
  6. From what I can tell, the error bubbled up through your require(). For more evdence, the "<" character is not in the file that you linked to on github, sothe only way something could be expected near it is if it appears inside some external piece of code; in this case, the require()ed nReactorGUI.lua. I know that I am responding a few months latter, but If you still have not fixed the error, I would be happy to have a look at the code for you.
  7. I am working on a script to control robots using the internet card, and as part of this I need to be able to know where a waypoint is. I am using navigation.findWaypoints(), but the tabe that it returns behaves differently depending on weather or not I use the LuaOS interpreter, or just run the same function over the network. I have already tried two ways of serialization, and both work as expected in the lua interpreter. They also function as expected when call them directly with hand-typed tables over the network. The problem comes when they are passed the result of pcall(component.invoke("ADDRESS_GOES_HERE", "findWaypoints", 16)). In that case, I get only the first layer of tables as follows: R2-D2 recived command 'component.invoke("c4272274-e2ab-472b-b450-153710c88709", "findWaypoints", 16)'. 1: table: 0x7fbce02af5f0 n: 1 What is changed such that the functions no longer have the same behavior? version 1 (self-made): function ptable(tbl, recursed) if not recursed then for k, v in pairs(tbl) do if type(v)~='table' then link.write(string.format("%s:%s, ", k, v)) else link.write(string.format("%s:{", k)) ptable(v, true) link.write("}, ") end end else for k, v in pairs(tbl) do if type(v)~='table' then link.write(string.format("%s:%s, ", k, v)) else link.write(string.format("%s:{", k)) ptable(v, true) link.write("}, ") end end end end versions 2&3 (found on the lua wiki): function table_print (tt, indent, done) done = done or {} indent = indent or 0 if type(tt) == "table" then for key, value in pairs (tt) do io.write(string.rep (" ", indent)) -- indent it if type (value) == "table" and not done [value] then done [value] = true io.write(string.format("[%s] => table\n", tostring (key))); io.write(string.rep (" ", indent+4)) -- indent it io.write("(\n"); table_print (value, indent + 7, done) io.write(string.rep (" ", indent+4)) -- indent it io.write(")\n"); else io.write(string.format("[%s] => %s\n", tostring (key), tostring(value))) end end else io.write(tt .. "\n") end end function vardump(value, depth, key) local linePrefix = "" local spaces = "" if key ~= nil then linePrefix = "["..key.."] = " end if depth == nil then depth = 0 else depth = depth + 1 for i=1, depth do spaces = spaces .. " " end end if type(value) == 'table' then mTable = getmetatable(value) if mTable == nil then print(spaces ..linePrefix.."(table) ") else print(spaces .."(metatable) ") value = mTable end for tableKey, tableValue in pairs(value) do vardump(tableValue, depth, tableKey) end elseif type(value) == 'function' or type(value) == 'thread' or type(value) == 'userdata' or value == nil then print(spaces..tostring(value)) else print(spaces..linePrefix.."("..type(value)..") "..tostring(value)) end end Thank you all in advance for helping me learn what I should fix.
×
×
  • Create New...

Important Information

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