stfwi / redstonepen

Minecraft mod adding a pen to draw Redstone tracks in all directions, a PLC for Redstone, and relays.
MIT License
14 stars 2 forks source link

[FABRIC v1.5.31] TPx family of functions giving pulses of incorrect length #42

Closed Delta-official closed 2 months ago

Delta-official commented 2 months ago

I have the following code in an RLC:

WAIT = TP1(G, IF(G == 14, (8 + 3) * 20, 4))
R = WAIT.FE

As shown in the screenshot, the time is correctly set to 220, but the length of the actual pulse is around 1-2 ticks, which is shown by a lamp pulsing (See picture 2) image The whole circuit looks like this. image The first RLC is simply mimicking the signal while doing a basic signal dropoff simulation after some time (The timer works perfectly fine in this case)

WAIT = TP1(G, 5 * 20)
B = WAIT.FE - 1

The modpack used to test this is Fabulously Optimized 5.4.1

stfwi commented 2 months ago

Hi, ty for the details and the images. Let's quickly double check what the behaviour you expected is, so that we know if it is a code bug or something that the documentation does not clarify.

WAIT = TP1(G, IF(G == 14, (8 + 3) * 20, 4))
R = WAIT.FE

What I read from the code:

Is that what you see, or does the behaviour differ, or did you intend something else?

Cheers,-

Delta-official commented 2 months ago

The PT update mechanic does indeed seem to have been the problem! Since I used a single tick output on the first RLC (or well, it would be the same with a button), it would set PT to 220 and then immediately switch to 4 since the signal would disappear. This is pretty confusing and the current docs are missing this, so it would be good to add it.

stfwi commented 2 months ago

Oky, ty for the feedback, I added a note for the latest mod/MC versions. Cheer's;;