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.2 for MC 1.7.10, 1.10.2, 1.11.2 & 1.12.2. 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


CptMercury last won the day on March 9

CptMercury had the most liked content!

About CptMercury

  • Rank
    Junior Member
  1. Output of Energy storage

    Well, more practical might be not the best way to put it, but it'll reduce the amount of components you need to hook up to your computer, so reading the energy consumption of a few energy cells or of hundreds doesn't really make a difference. But you need a central place to set this system up and each energy connection cannot connect with others from this point on. It also might require some more coding than using that simple approach. Basically you have an array of 2 energy cells for each base. The robot will move back and forth placing down the adapter and applying the Redstone signal to toggle the input for a second. Then it will remove the adapter again and moves to the next position. The computer then can read the energy consumption of each energy cell. Of cause this system is kinda complicated and might take some time to be set up, but it would be easy to extend that system. Biggest downside is all the energy lines cannot be interconnected after that point. You would need to run individual power lines to each base or use some means of wireless power transportation. Even though being somewhat strange looking and not that resource efficient in terms of energy cells/ cabling required it's certainly the most "practical" way I can come up with to solve your issue.
  2. Output of Energy storage

    Ok, so how is your town‘s energy supply set up? Do you have central power generation and then transfer the energy to each base? If that‘s the case I might have a different approach that would make the setup smaller and more practical.
  3. Output of Energy storage

    Hey, I hope I interpreted your question correctly. You want to monitor how much energy your base actually consumes, the rf/t that leaves your energy storage device and not the relative difference between input and output, right? I did some testing and I came up with a solution that give you exactly that, the rf/t output of the storage device (used TE energy cell), now matter how much you input. This will stop the output of the cell for a limited amount of time tho (this is needed to do the calculation), so it's best to put a small energy storage device between the actual energy storage where you do the monitoring and your grid feeding your machines. Basically what I do is the following: 1. measure the relative energy difference in the device for a given period of time, divided by the amount of ticks waited --> the DIFFERENCE between input and output ( in rf/t) 2. disable the energy output of the device by applying a Redstone signal 3. measure the energy difference again and reenabling the output again (again divided by amount of ticks) --> the TOTAL input (in rf/t) 4. getting the difference between total input and relative change in rf --> the output (in rf/t) local component = require'component' local energyCell = component.energy_device local rs = component.redstone local side = 4 -- # side where your energy storage device is (relative to redstone i/o) local wait = .5 -- # time waiting between checking the energy level function getOutput() local init_rf = energyCell.getEnergyStored() -- # rf base level os.sleep(wait) local rel_rf = (energyCell.getEnergyStored() - init_rf) / (wait + .05) / 20 -- # rf difference rs.setOutput(side, 15) init_rf = energyCell.getEnergyStored() os.sleep(wait) local tot_rf_in = (energyCell.getEnergyStored() - init_rf) / (wait + .05) / 20 -- # total rf input rs.setOutput(side, 0) local tot_rf_out = tot_rf_in - rel_rf -- # total rf output return tot_rf_out end -- # apparently it takes one tick to read the rf level in the device, that's why I added .05 seconds -- # to the time waited in the rf/t calculations -- # the rf/t values are 100% correct, at least for TE energy cell you have to set the Redstone behavior to disable output when a Redstone signal is applied
  4. Thermal expansion machines

    Ok, did some testing: You can see whats going on in a TE machine by using an adapter with an inventory controller inside, but you can not push items in/pull items out. For i/o interaction you have to use an robot equipped with an inventory controller. Then you can transfer items in and out of the machine using the robots inventory as a buffer. local component = require'component' local inv = component.inventory_controller local side = x -- #side where your inventory is attached -- #i/o stuff inv.suckFromSlot(side, slot, itemCount) inv.dropIntoSlot(side, slot, itemCount) -- #inventory checking inv.getStackInSlot(side, slot) inv.getInventorySize(side) Btw, the machine's side facing the robot/adapter must be set to the grey i/o configuration, in order to get access to all slots of the machine.
  5. Thermal expansion machines

    You might be able to manage i/o with an adapter. Just place the adapter next to the machine and put an invetory controller inside the adapter. With this you should be able to interact with the item slots in the machine. You still can not access the mashine directly, you call functions on the controller. I‘ll try it later and let you know.
  6. Create infinite thread in background and continue

    Btw if you want to speed up the drawing process, here are some tips: A gpu can only perform a small amount of tasks each tick. 4 copy, 8 fill, 16 set, 8 setBackground and 8 setForeground; if you call more of these funtions, they are delayed, and it seems that you call a ton of these funtions. For example instead of using gpu.fill in order to set a single character use gpu.set() since you can call it 16 times per tick. And if you want to fill a line in x direction with a string like "/" you can use gpu.set(x,y,string.rep("/", n)); the string "/" is replicated n times. This can also reduce the amount of fill commands and speeds up drawing. Using gpu.copy would increase your drawing speed the most. This copies one area of the screen and pastes it to a different area. So you would draw one of each objects on your screen, without the damage bar. Then you would copy the objects to all the desired locations and draw the damage bar. That way you wold be able to draw 80 objects per second, so a lot faster than you are currently be able to.
  7. get mouse position without clicking

    Yeah, i know, but pushing the event will just carry the information you gave it when calling computer.pushSignal. So using computer.pushSignal(”touch”) will not carry any information except the event name. It will just push an event called ”touch” but its not the same as the touch event pushed by the component.
  8. get mouse position without clicking

    ok, and i guess there is no way to trigger a component event other than actually performing the event, right? Would be a great feature tho, if we were able to triggee these component events with some lua coding...
  9. get mouse position without clicking

    Hey guys, I tried to get the mouse position without having to perform some kind of mouse input. But I can't figure out how this might be doable. One idea I had was looking in the OpenOS files, since some events like "component_available" are actually pushed by the code using computer.pushSignal, but I wasn't able to find something similar for the screen events like "touch" or "drag". Does anyone know if those screen events are pushed in an similar way by Lua code or knows a different approach to get the mouse position? Thank you in advance
  10. Image Display Program

    Hey, well, there is a program that might be suitable, but I'm not quite sure, haven't checked it out yet. Here's the link: There's one option that should work, it won't be using opencomputers tho. Screen by extra utilities is capable of displaying png pictures, you would have to upload it to Imgur.com.