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

All Activity

This stream auto-updates     

  1. Yesterday
  2. Great job! This system seems amazing.. Although I was rather disappointed it doesn't only use in-game Lua, thats understandable. Keep working on great things.
  3. Last week
  4. Overview Hello there. Some of you may remember KLang. I decided that I should you know, actually work on it. Therefore, I present Triton/TritonLang. Triton is the continuation of KLang, a C++-styled programming language that compiles to Lua. I have no ETA on when it will be done as of the moment, but it is work in progress and I would possibly like to get feedback on my current project status. Hello, world! [Pseudocode] #include <io> int main() { io::info("Hello, world!"); return 0; } Advantages to Lua Headers/easily include libraries Statically and dynamically compiled libraries for programs C++-style syntax and easier OOP Helpful Links WIP Documentation GitHub Repository
  5. The program seems to require a redstone card.
  6. open computers config file (settings.conf) lines 584-603.
  7. Earlier
  8. Wow, isn't it annoying to write EEPROMs? Don't you hate how messy they are? Well, I have the utility for you! LuaComp! LuaComp A general purpose Lua preprocessor and minifier. Building To build, either execute luapreproc or luacomp on src/init.lua luapreproc Execute luapreproc init.lua ../luacomp.lua luacomp Execute luacomp init.lua -xO ../luacomp.lua NOTE: Do not use a minifier, it breaks argparse! How-To Merging Lua source files -- myfile.lua local my_lib = {} function my_lib.hello_world() print("Hello, world!") end -- main.lua --#include "my_file.lua" my_lib.hello_world() Getting enviroment variables print("This was compiled in the shell "..$(SHELL)) Macros @[[function my_macro(a, b)]] print("Hello, @[{a}]. Your lucky number is @[{b}].") @[[end]] @[[my_macro("world", 7)]] @[[my_macro("user", 42)]] @[[my_macro("Earth", 0)]] @[[my_macro("Satna", 666)]] @[[my_macro(os.getenv("USER"), os.getenv("UID")]]
  9. Ups, i tested it with file:read() but i miss typed and somehow wrote file:write()
  10. By calling hres.set(x, y, state) you can set a pixel at that x, y position to either be the foreground, or the background color. The x and y positions are the exact pixel location you'd like. This allows for a theoretical maximum resolution of 320 by 200. This is achieved by using the Unicode braille characters. To get the current "hres" resolution you take the screens current x resolution and multiply by 2, and you take the screens current y resolution and multiply by 4. There may be bugs, and things may behave oddly if you try to "turn off" a pixel that was not "on" in the first place. local gpu = require("component").gpu local unicode = require("unicode") hres = {} function hres.set(x, y, state) local x = math.floor(x) local y = math.floor(y) local scrx = math.ceil(x/2) local scry = math.ceil(y/4) local maxx, maxy = gpu.getResolution() if scrx > maxx or scry > maxy or scrx < 1 or scry < 1 then return end local prechar = gpu.get(scrx, scry) _, prechar = utf8.codes(prechar)(prechar) local offset = 0x2800 local offsetx = (x-((math.floor(x/2))*2)) if offsetx == 0 then offsetx = 2 end local offsety = y-(math.floor(y/4)*4) if offsetx == 1 then if offsety == 0 then brs = 7 else brs = offsety end else if offsety == 0 then brs = 8 else brs = offsety+3 end end local offsetdec = 2^(brs-1) if prechar < offset or prechar > 0x28FF then prechar = offset end if state then gpu.set(scrx, scry, unicode.char(prechar+offsetdec)) else gpu.set(scrx, scry, unicode.char(prechar-offsetdec)) end end
  11. Firstly you're mixing up file:read and file:write.. One writes to the file and the other reads. local config = {} for line in io.lines "/path/to/config.txt" do table.insert(config, line) end print(config[3]) -- # 3rd line in your config -- # this is probably the simplest way but there are others. To read a specific line in a file you'd have to know the exact offset of bytes until the information you're trying to read.
  12. But what if I want to read the third line? do I need to: -- file:read("*l") file:read("*l") x = file:read("*l") -- or can i type the number somewhere somehow? edit: Marked a section where I replaced all "write" with "read" because I'm stupid
  13. It writes to the current line of a new file, so in this case it'd be the 1st line. To read the first line just open the file in read mode ` file = io.open("myfile", "r") Ip = file:read("*l") file:close() ` *l reads 1 line from a file 1 reads one byte from a file
  14. That should write to the first line or to a new line? IP = file:read(1)? What is with multiple settings? How should i use the write function then? Can you give me an example how someone uses such system?
  15. file = io.open("/path/to/config.txt", "w") file:write(newIP) file:close()
  16. I want to make an application that creates a file named "config.txt" and read/write to it but i am hanging on creating the file. Can't find how to create the file. My Project: Github_Project_Line85 I want to save the IP that the user writes in and after rebooting it should stay. (Line 85) I want to make a check system with the config.txt and then load the variable into it. It's using the GUI API from MineOS
  17. OC-ports OC-ports provides a database and library for using said database to cross-reference between protocol names and network port numbers. The database also contains the entity that registered the port(s) and, if applicable, a link to more information. API The portinfo API provides one function: portinfo.search(*query*, [*database*]) table: result The search() function takes your query - either a string or a port number - and searches the database, defaulting to the OC ports database, for your query, returning the first result as a table in the format: name port registered by more information This is more than enough to use for simple port lookups and generating tables. Reserving ports To reserve a port in the database, please submit an issue on the GitHub repository. Download portinfo can be installed via oppm from the Minitel repository, using the command oppm install portinfo Additionally, to install manually, place portinfo.lua into /usr/lib/, and both oc.db and minitel.db into /usr/lib/ports/.
  18. Hi! I have a webserver running on localhost I need opencomputers to communicate with, but that is blacklisted. How can I disable/bypass that function?
  19. Ever needed real-world time in OpenComputers? I did today, so I did something about it. realtime realtime is a set of libraries and protocols designed to let you synchronise your computers with the real world, and includes: The realtime library, for taking and keeping time. The realtime-sync daemon, for synchronising your realtime library with the real world The realtime-relay daemon, for synchronising your realtime across the local network. All of these can be downloaded via oppm, or from the Minitel GitHub repository. Additionally, all of these come with manual pages describing their functionality and usage, all of which can be found here.
  20. The reason that your code isn't working is that require is a function avaliable in open-os on an eeprom you have to interface directly with the components. try: function getComponent(name) component.proxy(component.list(name, true)()) end local m = getComponent("modem") component.list lists all components with the given name's addresses and type (calling the return value returns the first index's address) component.proxy gives you a "proxy" of the component using an address with out a proxy you would have to use component.invoke to call a method on a component realised that you needed help with the server not the drone sorry, ignore this post.
  21. OpenSolidState for Minecraft 1.12.2 ____________________________________________________ Source Code and builds can be found on Github. Note: Requires Forgelin. General Purpose (E)EPROMs? Have you ever wanted fast storage? How about wanting to boot PsychOS 2 on a uC? Well, now you can! There are two main variants: The card and the drive. The Card! The Drive! Tiers: Tier 1 - Manually erased EPROM, erased with the assembler. 64KiB Tier 2 - Electronically erased! Still 64KiB Tier 3 - Bigger EEPROM! 128KiB! But how do I craft them? Just use JEI, trust me. What else is included? A utility floppy and ROMFS boot EEPROM are included with the mod! Feel free to ask more questions! i need to make docs
  22. Try: local c = require("component") local m if c.isAvailable("modem") then m = c.getPrimary("modem") end or local c = require("component") local m = c.modem or local m = require("component").modem or local m = require("component").getPrimary("modem")
  23. You want a progress bar for the file transfer via modems? There is no built-in method available, so you need custom scripts for this. My approach would start with calculating the file's size and transmitting it to the receiving computer. Then the file is split into packets and transferred; by the size of the arriving packets the progress can easily be calculated. The remaining question is how to split the file. You could either send line by line or send a fixed number of bytes. Depending on your choice, the calculation method for the file size will vary. Number of lines: local n = 0 -- number of your lines for _ in io.lines("path/to/file") do n = n + 1 end Number of bytes: -- Method 1: local function filesize (file) local pos = file:seek() local size = file:seek("end") file:seek("set", pos) return size end -- open file and call function with file local f = assert(io.open("path/to/file")) local n = filesize(f) -- Method 2: local f = assert(io.open("path/to/file")) local data = f:read("*all") local size = #data The only thing you then need is a way to display the progress, either by simply printing the percentage or by drawing a more or less detailed progress bar. I hope in correctly interpreted your question and this gets you started. Feel free to ask if you need further assistance.
  24. Is possible to copy files in openos with percent progress output? Require for big files copy with low speed over network card. Probably im first who ask this
  25. Hello world ! I need you for the first time because i'm in a project : research ice by drone like the series "Mars" on mars from the Galacticraft mod but i have problems for programing : for the client (drone) it's done but for the server no i'm stuck i'm using the folowing line for registering the module : modem : local m=require("modem") but it's not working... the error : module modem not found thanks a lot
  26. EveryOS

    4 Choices

    c) You go back You go back to the room you started in. The bed is gone! Do you a) Sleep on the floor b) Check if a phone is in your pocket c) Run through the hallway d) Try to punch through the *room*'s wall
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?
    Sign Up
  • Create New...

Important Information

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