- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
Michael
-
Content Count
3 -
Joined
-
Last visited
Posts posted by Michael
-
-
7 hours ago, Fingercomp said:
Well, this means the ic2_te_mfsu component doesn't have the getMaxEnergyStored method. The reason the crash occures after click is that you fetch the values after pulling a touch event (before the first update, the default value is used, i.e. 0).
To get a list of available methods, run the following command in the OpenOS shell:
components -l ic2_te_mfsu | less
Thanks for the response, as suggested I ran this code and was displayed this output
So i changed my code based on this, as seen bellow
but unfortunately
-
Hello everyone,
I'm trying to set up a Opencomputers energy monitoring system that will control the energy level of an Industrialcraft2 mfsu by turning on 1 to 6 reactors but I'm having problems at the energy reading part.
Here is my code so far: https://pastebin.com/654kRYaf (ignore that getEnergyStored is commented out, I was testing something and uploaded to pastebin wrong version), but here is an abbreviated version with comments:
-------------start of script---------- local fill = 0 --predefine variable fill local cap = 0 --predefine variable capacity require 'normal' things (event, component, term, colors, sides) local rs = component.redstone --Redstone I/O block local mfsu = component.ic2_te_mfsu ---as shown when components is run ----------create writing------------------ ---create writing and boxes ----------reset redstone (just in case) ---- set colors used to 0 ------------------------------------------- ------------------------------------------------------------------------ while true do local _,_,x,y = event.pull("touch") -----works up to this point fill = mfsu.getEnergyStored() --find amount of energy in mfsu cap = mfsu.getMaxEnergyStored() --find capacity of mfsu print(fill, cap) ---print it (temp) --------check user clicks squares and set redstone outputs-------- --//insert computer turn on reactors here (to do later)\\-- end ---end of script---
I plan to implement code that will turn off and on the reactors depending on the amount of energy in the mfsu but I havent been able to read the amount of energy in the mfsu to be able to make the calculations.
(the big empty space on the left of the screen is for a progress bar that is currently hidden, which depends on the amount of energy in the capacitor)
As you can see (bellow) the code works fine until the user clicks the screen, at which point it errors, the Max energy or current energy "returns a nil" and the code discontinues running. to my understanding this means that this doesn't exist therefore what is the current terminology?
I could find one that works but I wanted to make one myself.
Minecraft v. 1.10.2
Age Of Engineering v. 1.1.2 (Twitch modpack)
OpenComputers v. 1.7.1.150
Energy Stored
in Programming
Posted
ow wops thanks!