Integrated Dynamics question (Nested IF)

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
D

Drewlbucket

Guest
Is it possible to write a sort of nested IF statement with this mod or do I have to go another route (using Direwol20)?

Example:

if(Energy < 30)
Redstone On
If (Energy > 95)
Redstone Off
else ()
Redstone Off

Basically if an energy cell is < 30 percent, I want a red stone signal to send until I am back to 95 - then turn off until it drops back below 30 percent.

I apprecaite any help you can give.

Thanks
 

Psychicash

New Member
Jul 29, 2019
700
0
1
seems like there's a way, honestly I got really tired pulling my hair out on integrated dynamics and switched to xnet. Much easier to do what you're asking. But I'm sure there is a way.
 

SolManX

New Member
Jul 29, 2019
987
-1
1
I have set up this system with other mods (it matches the behaviour of Ender IO's power monitor).

I don't know how to use integrated dynamics so I'm not sure this is possible (ie using AND statements) but if it is then you want something like this ...

Code:
If(Redstone Off AND Energy < 30)
Redstone On
 
If(Redstone On AND Energy > 95)
Redstone Off

Note these aren't nested.

To help see why, here's a list of all possible states ...

Code:
Redstone     Energy          Result
Off          < 30            Turn Redstone On
On           < 30            Do nothing (ie keep Redstone On)
On           > 30 AND < 95   Do nothing (ie keep Redstone On)
On           > 95            Turn Redstone Off
Off          > 95            Do nothing (ie keep Redstone Off)
Off          > 30 AND < 95   Do nothing (ie keep Redstone Off)

Note you only need to act on the two I mentioned.
 

Pyure

Not Totally Useless
Aug 14, 2013
8,334
7,191
383
Waterloo, Ontario
This is a common (and fun) problem to overcome in modded MC. Basically its a toggle latch or SR latch, and its usually for ensuring power generators come on and off at appropriate times.

Not sure about ID. In RFTools Control, you need to start with the higher numbers and work your way down, and ensure you invert all the calculations so they're all in the form of GreaterThan iirc. (e.g., instead of Energy < 30, it would be 30 >= Energy)

In the original question above, this isn't really a nested-if although it might need to be reframed that way (which, again, is the case for RFTC).

At that point, assuming if/else is a thing, the logic would be more like (braces added for clarity):
Code:
if (energy > 95)
{
  signalOff
}
else
{
  if 30 > energy
     MaintainLastSignal  -- (tricky in some logic mods)
  else
     SignalOn
}
 
  • Like
Reactions: ICountFrom0
D

Drewlbucket

Guest
Okay, thanks guys for your suggestions! I will check this out. ID was just a lot of fun, so I was trying to do it with it - I may have to swap methods after all.
 

Psychicash

New Member
Jul 29, 2019
700
0
1
jRRdHTh


So I drew this up real quick. Honestly, if you push the rs read to whatever you're activating and associate it with the 30 you should be fine. The two inputs don't matter which is which as they'll flip back and forth but the outputs will be associated with one or the other. I haven't tested it with ID but it's a basic vanilla circuit I've used before.

EDIT: thanks to pyure for reminding me of the vanilla circuit. all too often we get tunnel vision with mods and only focus on what that one mod can do without remembering vanilla. And I'm sure there's probably a nested way to program the logic but I'm not sure.

edit: can't see image but it's here... https://i.imgur.com/jRRdHTh.jpg c is cobble btw lol or any block
 

Psychicash

New Member
Jul 29, 2019
700
0
1
got home to find that Direwolf20 actually solved and addressed this problem on today's episode.

he used xnet though instead of ID
 
D

Drewlbucket

Guest
Haha, Yea I saw that shortly after too. Though, I managed to do it with a logic gate setup and ID. It was a bit frustrating, but i got it working. Thanks again for your help.
 

SolManX

New Member
Jul 29, 2019
987
-1
1
I had a little play around with ID and I think it's definitely do-able using the logic programmer to build up the correct variables from simpler ones. I'd hoped to give a better explanation but my test world kept crashing so gave up :(