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

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

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


  • Content count

  • Joined

  • Last visited

  • Days Won


Fingercomp last won the day on July 10

Fingercomp had the most liked content!


About Fingercomp

  • Rank
    Junior Member

Contact Methods

  • GitHub
  • IRC

Profile Information

  • Gender

Recent Profile Visitors

756 profile views
  1. Need help with TCP socket

    Check if you can connect to your server from a remote host. A firewall might be blocking the connection. Keep in mind that your host may be blacklisted in the configuration file by default (if you're trying to connect to localhost, for instance). Wrap handle:write("1234") into print (like print(handle:write("1234"))) so that if there were any errors, they would be printed, not ignored. Also, try to os.sleep a while before writing to or reading from the socket. Perhaps the socket doesn't get enough time to establish the connection. Call handle.stream.socket.finishConnect() to check if the socket is connected.
  2. Robots cannot attack players, is this intended?

    No, you shouldn't. This is the default behaviour of OpenComputers. You can allow robots to attack players by setting canAttackPlayers to true in the OC configuration file.
  3. Sending PUT and DELETE requests [Solved]

    The internet card's request method doesn't allow to set a custom request method. No mod adds such feature, either. Though if you can't avoid the need to use methods different from GET and POST, there's a rough implementation of HTTP/1.1 I've written in Lua to test my TLS library. It may easily fail for some unusual responses (I didn't really test it much specifically), and is slow (like, really really slow) in comparsion to the internet card's built-in HTTP request method. Also, it lacks support for HTTP/2, obviously, which is the protocol that many websites start gradually switching to. So hacking your way around could be better than using this library, perhaps, unless you know what you're doing. But you can consider it an option if you just want to make a small request to some specific host that doesn't return huge responses.
  4. What algorithm is used to approximate colors?

    This page, though in Russian, may be useful to you. The code there contains functions to deflate a color into its palette index and vice versa. Generate a color palette and use palette:inflate(palette:deflate(color)).
  5. what am i doing wrong?

    You don't need to use component.invoke here. It's a quite rarely used function since there are better alternatives. First, component.<component type>.<method>. E.g., component.tile_defense_machine_launcherscreen_name.launch(). This is what you should use if you only have a single component of some type. local component = require("component") local launcher = component.tile_defense_machine_launcherscreen_name launcher.launch() Second, component.proxy(address). Use it if there are several components of the same time, and you need to operate with a specific one. An address of the component should be passed to the function. local component = require("component") -- the address of the component, use an analyzer to get it local componentAddress = "1234567890ab-1234-1234-1234-12345678" local launcher = component.proxy(componentAddress) launcher.launch()
  6. Caesar Hashing

    The Vigenère cipher is vulnerable to cryptanalysis. Unless the length of key equals to the length of plaintext, the cipher IS NOT secure. Generation of such key, which also must be random and not used previously, isn't an easy task. In such case, because the cryptographic strength is provided by the key instead of the cipher (in other words, it's an OTP system), you can simply XOR the plaintext with the key instead of using this cipher and get the same strength. This cipher might be used to encrypt short pieces of text, but for relatively large pieces, especially when the attacker knows the structure of plaintext (like a TLS packet, although TLS 1.2 doesn't have any ciphersuites with the Vigenère cipher, thankfully) it makes more sense to use stronger ciphers (e.g. AES). Also, hashing and encryption are completely different things. Hashing function is one-way: given the output, you can't calculate the input without using bruteforce. Though an encrypted text can be decrypted.
  7. upload to github

    Have you read GitHub help articles? They explain everything to start using GitHub. Read these two articles first: 1, 2. You can use the web interface if you want to simply throw a file on GitHub and prefer not to mess with git. Although I highly recommend you to learn how to use it if you want to keep pushing updates to the repository. This book is an excellent guide to git.
  8. table.concat()

    When table.concat is called without specifying the fourth argument it's assumed to be #list. The default value for the third argument is 1. Operator # returns any of the table's borders. A border is a natural index of a non-nil element that is followed by a nil element. There's only one border in sequences. In table {1, 1, 2, 3, 5, 8}, the border is 6. Your table is different, as it has more than one border: 0 and 2. The border the operator # chooses depends on the Lua table implementation -- it could be 0 as well as 2 depending on how the table was populated and its non-numeric key elements' memory addresses. In your case, the implementation has chosen 0. So you have implicitly called table.concat(a, "", 1, 0) and because the end index was less than the starting index, table.concat returned an empty string, which was then printed to the console. More info: https://www.lua.org/manual/5.3/manual.html#pdf-table.concat https://www.lua.org/manual/5.3/manual.html#3.4.7
  9. tablet

    Try component.isAvailable("tablet").
  10. term.clear() isn't working?

    You need to require("term") before you can use the library in your code, like this: local term = require("term") term.clear()
  11. Robot Wont Cut Tree

    Insert saplings in the bottom-right slot of robot inventory, and a log in the previous one. The program compares blocks in front of robot with contents of these slots to distinguish saplings from trees.
  12. Drone Follow Script

    Assemble both the drone and the client with a navigation upgrade.
  13. My gui (Now with visual editor)

    When I was writing that response, I didn't really know, well, how experienced you are at Lua programming. OOP in general, not in Lua, isn't really advanced. Many languages allow to write in object-oriented style. To name a few: Java, Python, C++. If you don't know what OOP is, writing a few programs in these languages can help to understand the subject. OOP in Lua is really complicated. It requires using of metatables -- and that is advanced. In library, the code may quickly become complicated and hard to maintain. Instead of messing with metatables, I prefer to use libraries that nicely hide all the mess. It's just me searching for the greatest library possible, and someone would need quite a lot of Lua experience to create a library I would be satisfied with. So if you don't want to rewrite the whole GUI library once again and want to keep it as it is, I am not going to stop you. If you can't do OOP, do what you can, or you can easily lose the motivation. Create the library you want, not I. Your current way is very beginner-friendly, so Lua beginners might use it, while I would stick to using some other library.
  14. This mod adds a new architecture. Use the same items and blocks you use to build a regular Lua computer. Before you insert the processor, shift-click while holding it, until something like "65C02 Thistle" is printed to the chat. Then you can insert it into the computer. I also think the mod adds an EEPROM, so don't forget to insert it.
  15. My gui (Now with visual editor)

    As an author of a few programs that heavily used different GUI libraries, I have found problems in your current library. The approach it going to work for really simple programs, but when someone uses it for bigger projects, it becomes really hard to use. Below are some of problems I've found. You wanted feedback, after all. Why not use OOP? So that GUI elements could be modified in some way by calling its method, like menu:addSeparator(). OOP is a really great choice when making GUI libraries. It's incredibly hard to add a custom element that would use your GUI system. Every program with GUI I've written needed some elements that were not provided by a GUI library I used. With proper OOP, it becomes a really easy thing. Without OOP or support for adding custom objects, it's often a pain. Your code exports some functions to the global environment. A user can accidentally override such functions and break the library. Use local whenever possible. Only export functions via the return statement. (Note, adding local when defining function in a table is a syntax error: local function tbl.func() end will not work.) GUIs quickly become more complex as more features are added. Using your library, it's hardly possible to change a button callback to another function. Ideally, it'd be something like button.callback = function() print("Now it does something else") end. You also can't switch a button to the pressed state, you can't add child objects (like a label on a frame in a container).