bergerhealer / SignLink

Sign framework
7 stars 7 forks source link

Add a command that can check an variable's equation with another constant or variable #17

Open fredongit opened 2 weeks ago

fredongit commented 2 weeks ago

I want to make an PIS screen that can show the earliest train's predicted arrival time in a station with the help of TrainCarts. But, when a train triggers the trigger sign, the value of the variable (of the platform of the station) would change to the predicted arrival time of the train, which is the predicted arrival time of the latest train that had triggered the sign. I don't have any ideas about it. If there is a command that can check an variable's equation with another constant or variable, then it will be much better, not only the PIS screen, but also something else. So, in this example, if the variable is equal to 00:00:00, then we can update the variable. Otherwise, we can't update it.

bergerkiller commented 2 weeks ago

You can put variables inside variables, with /var edit name set %triggervariable%. That can be put in a command block. Would it be possible to use that mechanism to toggle which variable is shown, or to replace the text with a constant?

Kind of a difficult issue to fix, so I'm just giving suggestions.

I also think the trigger sign accepts redstone input, so maybe with some sort of timer you can add a debounce to it? So if it was triggered recently in the past it doesn't activate. Could also be done with a detector sign, disabling the trigger sign if another train is up ahead already.

Possibly all of that combined with two trigger signs. One used when there is no train ahead, another when there is. And toggling between the two using the set %name% command.