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

Search the Community

Showing results for tags 'api'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • OpenComputers
    • Announcements
    • Feedback
    • IRC
  • Code Central
    • Support
    • Showcase
    • Tutorials
  • Addons & More
    • Addons Mods
    • Architectures
    • OpenEngineering Task Force
  • General
    • Lounge
    • Forum Games
    • Showcase
    • Servers
  • Archives
    • Public Archives

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Fediverse ID



Found 30 results

  1. Hello there. Can i somehow get information about which and how many items do i need to craft certain item available to craft in ae2 system? For example, when i am requesting any craft by my hands in ae2 system, its shows me information about which and how many items do i need for crafting this item. So can in any way get this information using opencomputers? Thanks
  2. It seems completely funny but I am actually trying to get through this for the last 2 days: I try to access weather data through the OpenWeatherMap.org API wich seems to work fine with internet.request(url). The problem is just that it returns me the JSON as a table instead of a String. I tried to access fields of that table but everything seems to return nil. I just can't get to access anything from that table. There are tons of JSON serialization librarys out there but they all need the JSON as a String. I am completely lost rn. This is the API response that gets stored as a table for some reason: {"coord":{"lon":7.68,"lat":52.85},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":10.51,"pressure":999,"humidity":66,"temp_min":10,"temp_max":11.11},"visibility":10000,"wind":{"speed":5.1,"deg":230},"rain":{"3h":0.11},"clouds":{"all":92},"dt":1552771115,"sys":{"type":1,"id":1871,"message":0.0045,"country":"DE","sunrise":1552714945,"sunset":1552757625},"id":2810860,"name":"Werlte","cod":200} My Lua code couldn't be simpler: local web = require("internet") local data = web.request(<API_LINK>) -- data is of type table and I don't know how to get any values. Tried so many combinations on indices. -- For each loop works to loop through everything though
  3. I have developed a sort of DNS server/client system. This is the fifth iteration of this system and finally, one which works and I'm happy with. Here is the link: https://github.com/SpaceBeeGaming/OC-DNS I know there was another "DNS" posted recently but it has not influenced mine (sounds selfish, I know; but true).
  4. Hello everyone! Direwo... eh, not quite right. Well, OpenGlasses for 1.12 is out! And I noticed there were no public button API for it, so I made one myself! I have a few functions built-in to make it easier to change stuff, but it was created with simplicity in mind. So if you simply just initialize a button and bind a function to it, it won't do any fancy stuff except for activating the function when you press it, so you have to add your own functionality to it: But with a little bit of extra code: Ok, not that big a difference, you guys are probably more creative than me! I also have a concept called "groups". When creating a button, you can specify what group it should be in. So if you want to change the color of all the buttons to the left side to pink, you can do that. Functions (in no particular order): --Needs to be called before creating any buttons, works as a reset also: gButtonAPI4.initialize() --Creating a new button element: gButtonAPI4.createNewButton(name,group,display,x,y,w,h,color: table,transparently,callback: function) --Has to be inside of your main loop: gButtonAPI4.update() --Prints all registered groups: gButtonAPI4.printGroups() --Change the visibility of the button/group: gButtonAPI4.visibility(button/group,boolean) --Change the color of the button/group: gButtonAPI4.Color(button/group[,color: table])--None for default color. --Same as color, but changes the label: gButtonAPI4.Label(button/group[,text])--None for default label. --Add a button to a group: gButtons.addToGroup(button,group) If you don't want to make a new function for each new button, you can then bind them all to the same function. And add a parameter to your function, the name of the button that was clicked will be returned: local function btniF(buttonx) gButtons.Color(buttonx,{0,255,0}) print("I am " .. buttonx .. "!") os.sleep(0.5) gButtons.Color(buttonx) end I added a Demo program that shows most of the library's functions. Oh, btw, I like the number 4. It's not like this is my fourth attempt creating this or anything! Write a reply if you have any questions, this was my first attempt to create a usable library. gButtonAPI4.lua gButtonsDemo.lua
  5. Is there currently a way of getting the tier of a component?
  6. A simpe API to connect to a Websocket Server / Endpoint Forgot to mention: This API requires a Internet Card and Lua 5.3 Example Code: local ws = require("websocket_client"); local event = require("event"); local cl = ws.create(function(ev ,var1) print(ev .. "->" .. var1) end); cl:connect("localhost", 12345, "/"); while true do local ev = {event.pull()}; if ev[1] == "interrupted" then cl:disconnect(); return; elseif ev[1] == "touch" then cl:send("HI"); end end Full API documentation here: https://github.com/feldim2425/OC-Programs/blob/master/websocket_client/API.md To download and install the API simply run this command: pastebin run xnXssAtH
  7. i don't know if this is even possible but what i am trying to do is this NOTE: that is know that useing a thread in this scene is 100% Unnecessary but remeber this is a simple test -------------------------------------------------------------------------------- thread = require "thread" e = require "event" running = true t = thread.create(function() e.pull("touch") -- i know that i can put a os.exit() here but the thing is to try to get this to work running = false --<< that end) while running do --some random thing to run a io.read() will be a good combo print( "you said: "..io.read() ) end ----------------------------------------------------------------------------------------------- so this ends the thread as inspected but does not end the loop my guess is that all things in the thread function is local only but what can i then do to update the "running" value in the global process aka in the while loop??? all help will be great --thanks
  8. I present you my first version of a hologram api. so first of all, yes I know the hologram already has an component api well documented. but I extended a bit upon this. First and for all, I found the 48*48*32 voxels a bit low... so thats what this api does. it will give you the option to combine 2,3,4,n hologram projectors and access them as if it where one. so how to use this api? just download the files and save them on your pc. github link to files (you only need the /usr/lib/hpu.lua for the basic functionality) then add the next requirement to your script in need of a bigger hologram: -- just add this to your script local hpu = require("hpu"); -- now you can 'bind' the holograms to this api: holo = component.proxy(component.get(<your short address>)); hpu.bind(holo,1,1,1);-- first your hologram proxy, next your starting x,y,z positions. -- and then your second hologram holo = component.proxy(component.get(<your short address>)); hpu.bind(holo,49,1,1); -- and now your free to use the functions to your content: hpu.set(60,1,1,1)-- this will set the needed voxel on the second configured hologram. Be ware, while it is already functioning, some api functions of hologram where not yet implemented, but they will come in the coming days. (as fast as I can get some free time to code them) functions working: set,get also for those who wanted some extended drawing features for holograms, on the same github page there is also an hpudraw.lua file, this is an api that builds upon this api, and gives you the possibility to draw a line between 2 points. (maybe later other features as well) for those who want to see what's possible, and cause everyone wants pictures:
  9. where is the thread api. as i understand it, then the thread api is a build in api in openos aka in /lib (/lib/thread.lua) require("thread") >> file not found (module "thread" not found in: (and so on) ) please tell me if i miss understood this and then were i can get it NOTE: i know that you can get this file on the internet but it does not work that well (at all)
  10. An API that makes creating and reading configuration files easier. Any line starting with a '#' is ignored in config files. Documentation: loadConfig(string: path) Returns a stream of the file the path points to. saveConfig(string: path) Creates a config file at the given path. If a config file with the same name already exists it will be overwritten. flush() Clears all properties currently in memory. addProperty(string: name, value) Adds a property to the config. Note that the order properties appear in the config is the same order that the functions are called in. addComment(string: text) Adds a comment to the config. Comments are lines that start with '#', you could do this with addProperty, but this saves memory and doesn't add an '=' at the end of the line. getNumber(stream: file, string: name): number Returns the value of property 'name' as a number. getBoolean(stream: file, string: name): boolean Returns the value of property 'name' as a boolean. getString(stream: file, string: name): string Returns the value of property 'name' as a string. Download: pastebin get wE9xT51N /lib/config.lua
  11. How do I interface with an IC2 reactor to get values like case heat, EU/t, etc?
  12. I wasn't sure where else to put this, hopefully I got the rightish area. Any who, I'm working on a mod and want to add OpenComputers as an optional dependency. I've never used another mods before and I'm having difficulty adding OC's. I'm trying to add it via gradle.
  13. net API - The most basic DNS system How this works: The DNS server constantly broadcasts out its information every 2 seconds on the specified port The client APIs have a function to search for the next DNS server (they wait for the above information) which then sets the table containing the information to net.foundServer Now the client APIs have the ability to call net.setDNS(net.foundServer.address) to lock to that DNS With that the client APIs can now register and delete their URLs on this DNS server Every other client who has that DNS server locked on too can look up your modem's address by calling net.resolve(url) [returns true/false and the message (either an error or the address)] Requirements: DNS server: A setup with color support (it logs stuff on the screen and uses colors for that too) Of course a wireless network card My multitasking API which should be saved as "oc_multitasking_api" At best: openOS (because it uses the keyboard and event api) Client: The api A wireless network card of course And maybe an idea on how you can make use of it At best: openOS (because it uses the event api) How to set it up: Build a server / computer for the DNS server (look at the requirements) Buld a computer for the client(s) (look at the requirements) Create a new program to use the API NOTE: At boot, the API doesn't have a DNS server registered, you NEED to register it using net.listenForDNS() or directly putting in an address local net = require("net") --This needs to be called for every program which uses the API, which is normal net.listenForDNS() --This wont stop until it gets a message from a DNS server net.setDNS(net.foundServer.address) --Set the locked DNS to the actual address of the found server Functions: listenForDNS() : Waits for a DNS server to broadcast it's information registerURL([STRING]): Registers an URL for your modem's address (Returns true/false with an (error-) message) removeURL([STRING]): Removes the given URL from the DNS if it's yours (Returns true/false with an (error-) message) setDNS([STRING]): Set the locked DNS' address to the given one getDNS(): Get the currently locked DNS' address (returns the address of the DNS server's modem) getPort(): Get the port which the API looks for messages from the DNS server setPort([NUMBER]): Set the port which the API looks for messages from the DNS server resolve([STRING]): Try to get the modem address of the given URL (Returns true/false with the address or an error message) getURL([STRING]): The reverse of the above function (Returns true/false with the URL or an error message) getAll(): Returns a table with every URL and the associated address on the DNS server (key = URL, value = address) Download: DNS server: Pastebin net API: Pastebin NOTE: The DNS server does currently not save the DNS list on reboot and it looks like it stops broadcasting when the computer stays on when closing the server / game.
  14. Soo I was kinda bored doing basically nothing when I thought about making an OS for OC, which I wanted to do for a long time now. I got pretty far, considering that I'm pretty new to OC, up to the point where it is supposed to start up background "services" at the same time. I didn't know that computer.pullSignal / event.pull doesn't let a coroutine yield (I copied the event and keyboard api over to my OS because I thought I didn't need to rewrite these things on my own) so I quickly had to think of a solution and came up with this. Functions Currently I made it usable for normal OpenOS so that everyone can use it: createTasklist(): returns a table with premade functions which will basically contain all of your tasks createTask(tasklist [tasklist table], name [string], func [string], env [environment table], disableG [bool]): creates a task using the given name, sets its environment to the given one , modifies event.pull (yes you need to have the event library available) and adds a sleep([number]) function which is the same as os.sleep() but only for the task quit([name]): if no name is given, it stops running all the tasks. if a name is given, it stops only the specified task runAll(tasklist): This is the main function. It is the main loop which iterates through every task until it gets a quit signal tasklist:clearLog(): clears the errorLog table and the log table inside the tasklist table tasklist:killTask([name]): Kills the task with the given name. However, I don't recommend this one and you should use quit([name]) for that Short explanation Basically it modifies event.pull (and adds sleep() if you need that) so that it doesn't pull an event, but adds a filter and lets the coroutine yield until it gets an event. (or it yields until it gets the event with the given filters OR until it times out) Which allows us to quickly iterate through every coroutine over and over again. Coroutines which don't yield for a while get killed but while they're not yielding they are basically pausing the whole computer until they time out. Code Pastebin
  15. So i'm working on a super simple logs library to make outputting errors/messages to a log alot simpler in a different program i'm working on. The issue is that i am completely unable to find a way to create a new file inside of code! I remember in computercraft it was simply trying to open a file that didn't exist yet, would create a new one. but for some reason, it's not doing it in this instance. my code is roughly: local fname = "output.txt" local file, err = io.open(fs.concat(shell.getWorkingDirectory(),"/logs/",fname),w)--i've tried both w and a at this point i'm really not sure what i'm doing wrong! is there a specific function to create a new file? make directory only lets you create folders from what my experiences/documentation has said.
  16. Hello everybody i guess i am wrong here, i moved it to support, programming Well, for the first let me tell you, i'm a bloody beginner in OC and lua, so i hope to get some help here I'm trying to modify a code for my world but when i do, i just get errors So, please, can anybody help me to get this work.... The "buttonAPI" is the part in the background and the "aufzu" is the working part where the functions are told. buttonApi.lua local API = {} local button={} local component = require("component") local colors = require("colors") local term = require("term") local mon = component.gpu local w, h = mon.getResolution() local Green = 0x00AA00 local Red = 0xAA0000 local Black = 0x000000 buttonStatus = nil function API.clear() mon.setBackground(Black) mon.fill(1, 1, w, h, " ") end function API.clearTable() button = {} API.clear() end function API.setTable(name, func, xmin, xmax, ymin, ymax) button[name] = {} button[name]["func"] = func button[name]["active"] = false button[name]["xmin"] = xmin button[name]["ymin"] = ymin button[name]["xmax"] = xmax button[name]["ymax"] = ymax end function API.fill(text, color, bData) local yspot = math.floor((bData["ymin"] + bData["ymax"]) /2) local xspot = math.floor((bData["xmax"] + bData["xmin"] - string.len(text)) /2)+1 local oldColor = mon.setBackground(color) mon.fill(bData["xmin"], bData["ymin"], (bData["xmax"]-bData["xmin"]+1), (bData["ymax"]-bData["ymin"]+1), " ") mon.set(xspot, yspot, text) mon.setBackground(oldColor) end function API.screen() local currColor for name,data in pairs(button) do local on = data["active"] if on == true then currColor = Green else currColor = Red end API.fill(name, currColor, data) end end function API.toggleButton(name) button[name]["active"] = not button[name]["active"] buttonStatus = button[name]["active"] API.screen() end function API.flash(name,length) API.toggleButton(name) API.screen() os.sleep(length) API.toggleButton(name) API.screen() end function API.checkxy(x, y) for name, data in pairs(button) do if y>=data["ymin"] and y <= data["ymax"] then if x>=data["xmin"] and x<= data["xmax"] then data["func"]() return true end end end return false end function API.heading(text) w, h = mon.getResolution() term.setCursor((w-string.len(text))/2+1, 1) term.write(text) end function API.label(w, h, text) term.setCursor(w, h) term.write(text) end return API aufzu.lua: API = require("buttonAPI") local event = require("event") local computer = require("computer") local term = require("term") local component = require("component") local gpu = component.gpu local rs = component.redstone local colors = require("colors") local side = require("sides") function API.fillTable() API.setTable("Tor", tor, 10,20,3,5) API.setTable("Bahn", bahn, 22,32,3,5) API.setTable("Raus", test3, 10,20,8,10) API.setTable("Rein", test4, 22,32,8,10) API.screen() end function getClick() local _, _, x, y = event.pull(1,touch) if x == nil or y == nil then local h, w = gpu.getResolution() gpu.set(h, w, ".") gpu.set(h, w, " ") else API.checkxy(x,y) end end function tor() API.flash("Flash",0.01) rs.setBundledOutput(sides.back, colors.lime, 200) os.sleep(16) rs.setBundledOutput(sides.back, colors.lime, 0) end function bahn() API.toggleButton("Toggle") if buttonStatus == true then rs.setBundledOutput(sides.back, colors.red, 0) else rs.setBundledOutput(sides.back, colors.red, 200) end end function test3() API.flash("Flash") term.setCursor(1,25) term.write("Free Memory: "..computer.freeMemory().." bytes") end function test4() computer.shutdown(true) end term.setCursorBlink(false) gpu.setResolution(80, 25) API.clear() API.fillTable() API.heading("Was soll getan werden?") while true do getClick() end When i click on the, for example, "tor", i just get errors and that is all i get I also tried to give a redstone signal via lua, but here i also get an error, i don't know why. Computer is a Tier 3 and the restone card inside is a Tier 2 Thank you in advice
  17. Changelog: First and foremost, yes, this is a port of DW20's button API from ComputerCraft. Why do his? Because his is a rather simple API and it provided a challenge, at least for me, to learn more about OC. When I did the port, it is more or less a direct port, so any limitations, or bugs (if any) were present in it, are still there. The only change I made to his api is that I made the button flash delay configurable from your script so you shouldn't have to edit the API itself to change it. Now, for some of the issues I noticed from this API running on OC: 1. It does fully work, but due to how OpenComputers draws to the screen, its not a smooth transition (you can see the button being redrawn). Does not affect how it works, but it causes a minor delay, as noted below, and does not look very...pretty, if you care about that sort of thing. This has been corrected! 2. For things like switching the toggle-able button or while the flash button is...well...flashing, you can't press any other button until that button has finished its redrawing process. Again, not a huge deal, just a minor annoyance. That is why I made the flash delay easily configurable from your main script so you do not have to tinker around inside of the API itself. With the optimization that Molinko provided, this is no longer a major issue, but the button flash delay is still configurable to suite your personal tastes. 3. Do to how OC handles bundled cables, if you use this for working with redstone, be sure to include a short delay between switching multiple redstone outputs, or else it WILL become very upset, take your grandmother hostage, set fire to your house and kick your pets...in other words, it will crash in a spectacular fashion. Again, thanks to Molinko's help, this no longer seems to be the case. It is possible that it could vomit all over itself if the buttons are 'mashed' as fast as possible, but currently it seems unlikely (note, unlikely does not mean impossible, so use caution just to be sure!). 4. This is more or less a direct port of his API to OC. The only change I made was the flash delay. Yes, I am sounding like a broken record, but thanks to the help of Wuerfel_21 and Molinko, some optimizations have been added and some code changed to make it more efficient in OpenComputers. With that said, here is an 'old' demo of it in action (the button drawing issue has been fixed since this video was made): Here is the pastebin link for the 'main' demo script: http://pastebin.com/tW1AfDbA (save it as 'demo') NO LONGER RECOMMENDED! here is the pastebin link for the buttonAPI.lua script: http://pastebin.com/dP0bj3ck (save it as 'buttonAPI.lua') NO LONGER RECOMMENDED! Pastebin link for the corrected 'buttonAPI.lua' script: http://pastebin.com/YUPjgQmd (save it as 'buttonAPI.lua') Pastebin link for the corrected 'main' demo script: http://pastebin.com/N7ggD2CN (save it as 'demo') save them both and run demo to test it.
  18. BlocksImageAPI (Made for my project - tde-desktop as optimization for wallpapers) Example on TIER III graphics card: Example on TIER II graphic card: Example program code: defX = 80 defY = 25 term = require("term") setpos = term.setCursor dofile("tde-apis") gl.setResolution(defX,defY) wallpaper = loadImage("tde-wallpaper") setbg(0xFFFFFF) xfill(1,1,defX,defY," ") drawImage(wallpaper) setbg(0x000000) xfill(1,1,defX, 1, " ") setpos(1,1) write("[S] [Меню]") This API have 2 functions: loadImage(filepath : string) drawImage(image : array of integer) Pastebin Link (API) - http://pastebin.com/TiZPa8PN Pastebin Link (Drawing program) - http://pastebin.com/M8cTPXAV Drawing Program MAN: Translations for not russian users: [Ðовый блок] = [New Block] [Сохранить] = [Save] [Выйти] = [Quit] Выберите 1 позицию блока = choose the first position Выберите 2 позицию блока = choose the second position Цвет:_ = Color:_ Сохранение изображениÑ... = Saving... USE : tde-paint <new image name> This program is not edits old images yet and don't have "UNDO" functionality. Attention! This program at the early stage of development! It can crash or work incorrect.
  19. Rainbow Sometimes you need to write colored strings in terminal. It isn't easy in some cases, so i wrote library for colored output. Download You can download this library using this command: pastebin get J9nAzYai Also this library can be found in my oppm repository, just navigate to rainbow folder. Example Documentation ... will be here soon. Just wait. Enjoy!
  20. So, I've written my own menu API in CC, called 'Jenisis' named after what I called my software company on me and a few friends servers, (did quite well actually seeing as how I'm the only one who could code) and I ported it over to OpenComputers and then continued development on this, seeing as how IMO OC is better. Which brings me to my problem. I've been trying to add a feature where the API takes a table full of functions to run whenever an event is triggered, like for receiving modem messages whilst still in the menu's loop. I can't quite get it working and just need some new ideas on how. Here's the API: And here's the test program: This isn't really my preferred way of doing it, I'd prefer something along the lines of: handleTable = {} function handleTouch(eventInfo) -- eventInfo is passed to the function by the API. It's the table returned from the actual event. -- things that happen when you touch it end handleTable["touch"] = handleTouch cselected = jenisis.drawScreen(static, menu, handleTable) Anyways, sorry for the wall of text, and thanks in advance for any help!
  21. So, my problem occurs when trying to use this api, converted from CC: http://pastebin.com/qwt98zmj Original: http://pastebin.com/XZS4eF9Z Basically, all I am doing is: cselected = jenisis.drawScreen(static, menu) And I did this at the top (yes, before the function, and also the tables were declared as well): jenisis = require("jenisis") It's located inside the lib folder, and it's not about not finding/loading the API, because I already sorted that out. It's returning a rather unique error for an API: /jentest:17: attempt to index global 'jenisis' (a boolean value) stack traceback: /jentest:17: in main chunk (...tail calls...) Full 'test' program here: http://pastebin.com/ZfNvZ6Xk
  22. Hello everyone, I finally made the last huge step in developing my GUI-API to give you a usable BETA to play around with. And I have a tech_demo for you! It already works quite stable, as far as I tested it, and runs on top of OpenOS. I made a gif of the tech_preview on my github. Simply put the GUI.lua and shapes_default.lua in the /lib folder and the tech_demo in / and execute it to see how it is running (or use download code in update August 18). (Or you can try it on the server where I play, "Proton Colony", http://protoncolonygen2.enjin.com/) ------------- Update June 15: Now available on github: https://github.com/kevinkk525/OC-GUI-API Please report issues there. ------------- ------------- Update August 18: you can now download and install the gui easily by executing this code (you need an interent card): local component=require"component" if not component.isAvailable("internet") then print("You need a internet card, quit with any key") local inp=io.read() os.exit() end if not component.internet.isHttpEnabled() then print("Http is not enabled, please ask your admin! quit with any key") local inp=io.read() os.exit() end print("downloading GUI-API") os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/shapes_default.lua /lib/shapes_default.lua") os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/GUI.lua /lib/GUI.lua") os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/term_mod.lua /lib/term_mod.lua") os.execute("wget -f https://github.com/kevinkk525/OC-GUI-API/raw/master/tech_demo.lua /tech_demo.lua") print("download finished") ----------- usage example: gui=require"GUI" gui.initialize() button=gui.labelbox(x,y,rx,ry,layer,fore-color,back-color,clickEvent,nil,text) Its main features: - Object oriented programming: myLabel=g.label(x,y,rx,ry,....), myLabel.move(1,1),... - Private object attributes: can only be accessed by the functions provided by the object - Layer support: You can hide an object behind another object or get it to the top of all objects - Dynamic updates: If you change an object only objects below or on top of that object get updated and only in the affected area, not the complete objects --> reduces screen operations and makes the GUI very fast - Referencing system: you can easily bind an object to another one so they move together, resize together,... - Click Event support: if you click on something on the screen it will be passed to the corresponding object on the highest layer and executes the function defined in the object - Predefined shapes/form elements like label,rect - API allows simple adding of more shapes (hopefully someone contributes some^^) - New shapes can be added on the basis of the default_shapes.lua code as it already provides all functions neccessary - Change Text Color and Background Color for all objects that have not defined one (and therefore use the standard color) - Support of shapes consisting of only coordinates not areas like a rect (support included but untested and no shapes using it available by now) - No need of using component.gpu calls in your program, you can use the set/fill/getResolution/setResolution functions provided by the API What is planned: - publishing the API on github with bug tracker (if community likes the API...) - add more shapes - add possibility to use a window system - add drag events to move objects with the mouse - add a textbox to input text - write a little wiki/tutorial Changelog: Version 0.7.3b (August 11): ---------------------------------------- - removed code redundancy - minor bugfixes - updated tech_demo Version 0.7.2b (June 15): ---------------------------------------- - added a textbox shape (finally an input method) - several bugfixes for listings and labels and scrolling feature - added a file with modified term.read function preventing shifts in input line and supporting color system. - new feature: configure color per line in listing shape Version 0.7.0b (June 15): ---------------------------------------- - added shapes (listing) - added support for scroll events - modified shapes to support scroll events (label,labelbox,listing) -------------------------------------------------------------------- Changelog until 0.6.4b (or what can be done by now): - shapes: rect_full,label,labelbox (labelbox=rect_full with referenced label and expanded function range) - object functions: move, resize, toPosition, setClickEvent, removeClickEvent, setFCol, setBCol, setText, addReference, changeLayer, remove - object orientation, layer support, dynamic updates, referencing system, clickEvents, global default color system, different ram/screen optimizations -------------------------------------------------------------------- Have fun testing it! And ask if you have questions.
  23. I am having issues with a text API that I am writing and am looking for input from more experienced coders. The problem I am currently facing is with my centering method. If be used to center text to the full screen width it works great, if I am trying to center text in a smaller portion of the screen that is offset towards either edge, it fails miserably. API-in-progress below: --[[ Text utilities API by jaspercayne A collection of functions to work with text ]]-- local textTools = {} local component = require("component") local term = require("term") local text = require("text") local gpu = component.gpu local screenWidth, screenHeight = gpu.getResolution() -- Calculates appropriate amount of padding to center a string function textTools.centerText(target, fromx, tox) local calculatedPadding = ((fromx+tox)/2) + (string.len(target)/2) local centeredText = tostring(text.padLeft(target, calculatedPadding)) term.write(centeredText) end -- Aligns a string to the right of the screen function textTools.alignRight(target) local calculatedPadding = screenWidth -- string.len(target) local alignedText = tostring(text.padLeft(target, calculatedPadding)) term.write(alignedText) end -- Wraps a given string to the width of the screen function textTools.wrapToScreen(target) local wrappedText = tostring(text.wrap(target,string.len(target),screenWidth)) term.write(wrappedText) end return textTools I am certain that the main issue is from trying to pull the absolute x,y coords and derive a center point from that, but my brain just isn't putting together what the centerText function should look like... Help? Anyone?
  24. About library: This library helps you to out ComputerCraft image in diamond computer. How to use: Install: Pastebin get xUyZWrab paintutils how to connect: dofile("/path/to/paintutils/paintutils") paintutils.loadImage("/path/to/computercraft/image/file/imagefile", X : integer, Y : integer, Color) Example: dofile("./paintutils") paintutils.loadImage("./test", 1, 1, 0x000000) Output of example:
  25. PotatoLib This will be updated as I add new things version(): Returns the version of PotatoLib writeFile(path, data): Writes data to the file located at path readFile(path): Returns the data of the file located at path encode(data): Serializes data decode(data): Unserializes data getModemAddress(): Returns the modem address of the network card in the computer
  • Create New...

Important Information

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