- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
Gorzoid
-
Content Count
111 -
Joined
-
Last visited
-
Days Won
22
Posts posted by Gorzoid
-
-
My method mimics the general method used in computercraft which would allow easier conversion, many of the oc users used cc before hand or still do so it isn't crazy to believe op might be converting old cc code.
pcall method does however fit the op's description while also seeming like less of a hackish method. But just saying pcall will fix it may confuse newer users. It's different to the first method as instead of blocking the interrupt, it just catches it and returns early, causing some of the code not to run.
The method of overriding an os function is not ideal and I'd rather the way to cause the interrupt to be passed as an event instead of an error.
-
On 2017-6-23 at 7:23 PM, Molinko said:
I think Gorzoid means a 'debug' card
Yep whoops thanks for that
-
Go watch tutorials before screaming for help on forums.
???
Profit
-
As in locate any player anywhere in the map? You can't, atleast not without a debug card i believe. Motion sensor can detect movement in a small radius and navigation card can get your position relative to a map or waypoint.
-
I don't think you're using the correct function, internet.open creates a TCP socket with the IP at the port. Try using internet.request, although OC may not support HTTPS, pretty sure computercraft doesn't.
-
filesystem.open or io.open used like this
local io = require("io") local f = io.open("file.txt","w") f:write("file contents") f:close()
-
stands for relative x, relative z, relative y, width(x), depth(z), height(y) dunno what last one does.
-
This is the video I used when drones first came out, the interactive prompt makes it very easy to experiment
-
Since you have probably done arrays in your C/C++ tables can be explained like this: there are 2 types of tables, numerically indexed table which is like an array (except you start at array[1] rather than array[0]) and there is the hash table which contains 2 values, the key which is used to look up the value, this can be a a number, a string, any type except another table I think. Luckily for you getItemsInNetwork returns this type, so you can just loop from 1 to #essentiatable to get essentiatable. The itemstack values inside the array are hash tables though, you can think of them like structs/classes in C/C++ in this case. They have a specific format and the easiest way to find that format is just by doing what Fingercomp stated above:
=component.me_controller.getItemsInNetwork()[1]
I'm pretty sure it has a field named "name" so as an example if you wanted to check if the item is cobblestone then you'd do
for i = 1,#essentiatable do local item = essentiatable[i] if item.name == "minecraft:cobblestone" then print(serialization.serialize(item) end end
-
If files and processing was all done client side then having multiple users use a computer would be next to impossible, requiring the server to relay the state of the computer back and forth continuosly. It's also bad networking practice to do any important processing client side.
-
Have you tried using robot.swingDown from robot API provided by OpenOS?
-
OpenComputers is not the best for timed redstone due to the forced delay, I have to use computercraft when I want to do it.
-
getInput also returns a number not a boolean check if it is > 0
-
Pretty weird, looks like the font renderer is using the wrong image. You may want to post this to the issue tracker along with the version of OC used.
Does it happen on regular computers?
-
So there's quite a bit wrong with this, for a start the for loop can't be used that way, not in Lua atleast. I'd recomend a while loop which would look something like this.
while true do local gis = tp.getItemInSlot(sides,east,i) --store item that is being read to recall later if not gis then break end -- Rest of code end
With your list, you first need to create a table before you can reference gp like that. So at the top of your code you would need something like "local gp = {}". Then when adding to it the simplest way is to use
gp[slot] = gis -- or if you want to copy it gp[slot] = {} gp[slot].label = gis.label gp[slot].size = gis.size
In above code I also fixed some other issues where you used the calling syntax "(" and ")" instead of indexing syntax "[" and "]". Also "==" is the equality operator, what you meant to have was "=" the assignment operator.
For the last bit of code the easiest way to do it correctly is using the same indexing you saw in above code (gp[slot].label) and replace slot with #gp
-
Just so you know, event.pull calls coroutine.yield so really modifying event.pull is unnecessary, just coroutine.resume the task with each signal and event lib will do the rest of the work.Not exactly correct, looks like machine.lua also messes with coroutine table in order to correctly sandbox it. Shame, it'd be so simple otherwise.
-
1. According to the wiki
-
Important*: it is generally recommended to use
io.open
instead of this function, to get a buffered wrapper for the file stream.
When opening files directly via the file system API you will get a file stream, a table with four functions. These functions are thin wrappers to the file system proxy's callbacks, which also means that read/write operations are not buffered, and can therefore be slow when reading few bytes often. You'll usually want to use
io.open
instead.So yeah use io.
2. Text files are basically large strings of characters with a special newline character to indicate the text editor to display the rest of the string below the previous. Using the "\n" character you go down to the next line. So if you wanted to write to the 10th line you would need 9 \n's. Files don't work like the screen so you can't just set your cursor anywhere, instead you got to use a combination of spaces and newlines to get to that point.
-
-
Assuming you are require'ing the io and fs table, your only problem is that you need to put the w/r inside quotes, like "w"
-
This may be because you are not sleeping, if you constantly check without yielding then it can't check keys pressed, add an os.sleep call before or after the print
-
https://github.com/Gorzoid/oc_dcpu
I think there is a java 1.6 compatibility issue blocking it from building, but you should be able to run it fine in either gradle runClient or eclipse
-
Don't you think the first n ports should be saved for public oetf network protocols, rather than taking the first 10 for a private chat program? I think maybe the first 256. Or since people tend to use low numbers for their private programs, we should use the highest 256 ports for oetf ports
-
You can do this by overriding event.shouldInterrupt
function event.shouldInterrupt() return false end
-
So I have very slowly been making a DCPU Architecture for OpenComputers. If you don't know what DCPU is, it's a fake CPU architecture designed by notch for his discontinued game 0x10c. While all work on the game has come to a halt, there is still alot of interest for the CPU spec which he released.
My idea was to make an emulator that completely follows the spec, including all or most of the devices. This would mean that existing software would work perfectly.
Development is slow as my motivation disappears and returns very briefly. One of my problems is that I can never keep working on one project for long, my interest change sporadically. But I have mostly finished the CPU itself, I haven't tested all the instructions so it's not bugfree. Currently I am working on the devices, specifically the lem1802 (the screen) and the keyboard. The screen works but currently I can't change the colour pallette or change the font(which I don't think will be possible in oc currently). The keyboard is alot more buggy, keys are sometimes doublepressed, not pressed at all, and sometimes just completely break the buffer.
It's not on github atm but if people are interested in the code I'll post the source.
-
3 hours ago, Lizzy Trickster said:
We have a system where you need 3 approved posts before you can post freely. It's done this way because of spammers in the past.
Because of the little activity on this forum, that 3 post system may deter any new users, or force them to basically shitpost on other threads. Maybe instead just make sure they have confirmed their email address? It's not like there is much spam anyway.
Adding a color to Bundled Output
in Programming
Posted
getBundledOutput does not return a table, sadly there is no way to get the entire bundled output in 1 call.
However that doesn't mean this is impossible, it's actually way easier than you think, you are just using the alternate version of setBundledOutput.
According to the docs the first version of setBundledOutput takes side, color, value. So you really don't need functions to do this, but if you're still unsure here is the fixed version.
Also while I was able to understand the attempt in your code, it was both syntactically and logically wrong. You tried to reference your variables by prepending the table which contains the type, and the function arguments were completely wrong. I'd suggest you watch/read a few Lua and OC tutorials, and most importantly read the docs.