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

All Activity

This stream auto-updates     

  1. Yesterday
  2. Last week
  3. So I just tried to install this on an Enigmatica 2 server (OC version 1.7.4.153) and it failed to download the actual reactor program when trying to install. It downloads stringutils, oop, and libGUI fine, but when it gets to br_grid_control it errors out with "failed to download br_grid_control".
  4. Molinko

    Text box

    Bummer.. I guess because user input is not strictly a file it's not behaving the way I expected.. perhaps you'll have to roll your own user input with event.pull..
  5. SuperSamir

    Text box

    It's simply just io.read(2). It allows to me to keep typing past 2 characters which is what I don't want.
  6. 4/5 Very great game! Everything is handled greatly and makes a great building game overall. A smooth scrolling could be implemented with little GPU intensive activity. - Zen1th Magazine
  7. Molinko

    Text box

    I could be wrong about io.read... perhaps post your code so I can see what's going on.
  8. SuperSamir

    Text box

    I tested using io.read(2) and it lets me keep typing after meeting the threshold.
  9. I have some .ctif images downloaded but I can't find a way to view them.
  10. Earlier
  11. SuperSamir

    Text box

    But I would like to force io.read() to stop typing when it reaches 2 characters.
  12. Molinko

    Text box

    Io.read should yield the thread until enter is hit or the arg to it is satisfied ie after 2 characters. setCursorBlink will only set the blink mode of the cursor
  13. SuperSamir

    Text box

    Do these methods allow the user to keep typing even after the max characters have been reached?
  14. Molinko

    Text box

    To limit the number of characters read you can pass a number to io.read. i.e `io.read(2)` As for the cursor blinking and overwriting your input box you can either make your input box larger or turn the cursor blinking off with `term.setCursorBlink(false)`
  15. Thank you! I guess I need to do better checking lol.
  16. Zap

    OS Questions

    Hi Ocawesome101 the problem seems to be on line 36 of io.lua you're missing a "then" at the end of the line
  17. SuperSamir

    Text box

    I would like to create a text box that has a character limit of 2. I don't know how to make the input box not be cut by io.read() however, as you can type as many characters as you want.
  18. lua doesn't have preemptive threads, you have to have all threads (including the main thread) play cooperatively, everyone has to yield and place nice. plus, your code has some mistakes 1. heatget() calls heatget, it does not return a function pointer. thread.create(ptr) takes a function ptr. I think you meant thread.create(heatget) 2. heatget() never yields, you need something like os.sleep(0) in it. 3. having one thread print and a different thread read user input will cause the cursor to print over itself, and it'll look messy. you want your printing thread to be sleeping while you're taking user input. This might not be a multi-threaded program you need 4.I dont see a reason to call event.pull() before io.read() -- event.pull is going to block until ANY event, and io.read will then read key events. You could lose the first key press this way. I would just have io.read alone
  19. Hi, i tried to program a simply UI Design with Heat informations of a Fluid Reactor and a simple Toggle on/off function. but i had some problems with the refresh of the Heat display when i want the userinput. I Tried already with a thread and a new function the get the heat. but the mainprogram will still hold while it awaits the input. and when it will easier to program i normally dont want an "Input" field normaly i dont want to display the userinput and simply toggle a redstone state from 15 to 0 and backwards by simply pressing the button (number on keyboard) but i dont know to do that if anyone of you had an idea to fix that or improve that i am glad to hear from it! my code i wrote on my own attempt.. connections to the Reactor made via an Adapter and a Redstone Port -- Include local term = require("term") local component = require("component") local sides = require("sides") local event = require("event") local thread = require("thread") -- Variable local r1 = 0 local build = "0910190124" local vers = "0.0.2" local rsget = component.redstone.getOutput(sides.west) -- Boot-UP term.clear() print("Reactor Control") print("Build: "..build.." Version:"..vers) print("made by Blade") -- function Reactor status local function status1() if rsget == 15 then local r1 = 1 return "Online!" else local r1 = 0 return "Offline!" end end -- Script print("Reaktor Status beim boot:") term.setCursor(27,4) print(status1()) os.sleep(5) -- UI Design term.setCursor(1,1) term.clear() print("|================================================|") print("| |") print("| Status der Reaktoren: |") print("| Reactor-1: |") print("| Reactor-2: |") print("| Reactor-3: |") print("| Reactor-4: |") print("| Reactor-5: |") print("| Reactor-6: |") print("| |") print("|------------------------------------------------|") print("| [1-6] Toggle Reactor | [9] Exit Program |") print("|------------------------------------------------|") print("| Input: |") print("|================================================|") term.setCursor(14,4) print(status1()) os.sleep(5) local function heatget() while true do heat = component.reactor_redstone_port.getHeat() maxheat = component.reactor_redstone_port.getMaxHeat() term.setCursor(25,4) print("Heat: "..heat.." / "..maxheat) end end -- user input inclusive heat refresh thread.create(heatget()) while true do event.pull() local userInput = io.read() end thanks for the pataince and help ~ Blade8895 ps. i know my english is garbage but i try my best ;P
  20. Molinko

    Touch input

    The lib you're looking for are cursor.lua & full_cursor.lua but I'm not sure these will do what you're seeking to accomplish I just remember hearing about them... Also my example was done in a way that it could be modified to control the windows(and thus the cursors) of other processes. If you just want to access the current processes window it may be simpler with the tty lib. local tty = require "tty" local event = require "event" local kb = require "keyboard" local window = tty.window local handle = event.listen("touch", function(_, _, x, y) window.x = x window.y = y print "HI" end) while true do local ev = { event.pull("key", nil, nil, kb.keys.q) } event.cancel(handle) break end
  21. SuperSamir

    Touch input

    The method you have provided seems to work, which I thank you for. Please do tell me about this cursor library though, I can't seem to find it but it seems like a massive help for the thing I'm programming.
  22. ocCraft is a little videogame originated trough a very little OpenComputers game jam. It is currently not much more as the engine but should be easy to modify as long as you have a little practice with lua. Modding You can install/create your own texture packs (also with different resolution) as well as mods with new blocks, entities and biomes (world gen)*. *(technically you can change nearly anything at runtime because the most data are stored in a local table named global which will given to any script at loading.) GitHub: https://github.com/MisterNoNameLP/ocCraft Pastebin (installation script): https://pastebin.com/7h1xNZgt Gameplay: I hope you like the project and have a little bit fun :>
  23. Molinko

    Touch input

    Was this any help? I forgot, but there is actually a cursor library in the later versions of openos that you might want to check out.. I haven't used it and I'm not familiar with it at all but that might be a better solution.
  24. Molinko

    Touch input

    okay so its a bit tricky cause i dont know what exactly you're trying to pull but ill give it a shot... local term = require "term" local kb = require "keyboard" local event = require "event" local process = require "process" local component = require "component" local window = term.internal.open() -- # creates a full screen window. optionally provide (dx, dy, width, height) term.bind(component.gpu, window) -- # bind the primary gpu to the window we made local proc = process.info() -- # get an instance of this process' details local handle = event.listen("touch", function(_, _, x, y) -- # this is basically your 'cursor' function proc.data.window.x = x proc.data.window.y = y print "HI" -- # click around to see the effect end) while true do local ev = {event.pull("key")} if ev[4] == kb.keys.q then break end -- # quit the loop and basically the program end event.cancel(handle) -- # clear the event listener This example can be modified to control the window of another process as well. I hope this can get you started. Ask away if this isn't very clear....
  25. SuperSamir

    Touch input

    When you are able to test, can you show me an example? I'm a bit confused about what you mean by the processes window cursor.
  26. Molinko

    Touch input

    Each process in openos has its own instance of a cursor. It's stored in the window property of a process I believe.. try assigning to the processes window cursor as term.setCursor will only set the cursor of the process calling it... I can't test any code ATM so you may have some exploring to do
  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.