Can variables in the define section reference each other?


#1

I think the answer is “yes”, but I would just like to confirm that.

Example:
time dawn = $sunrise
time sunup = ({addMinutes(dawn,-60)})

My question is more so sparked by not being able to move variables. Does the order matter? In other words, could sunup be defined before dawn?

I think the answer is again “yes”. Which led me to wonder if the expression gets evaluated each time it is used. For example if sunup was referenced and then the value of dawn was changed… The next time sunup was referenced would it contain a new value?

If I pack just one more question in here :)…

To define a piston state, “disable automatic piston state;” must be set. Any side effects of “disable automatic piston state;” How is the default value used? Thanks.


#2

For the variables referencing each other question, the answer is they can… but I don’t know if they execute in sequence or not… you’ll have to experiment with that one.

I’m assuming your example in the question was just an example? Obviously in the case shown you could just place it all into a single variable / expression.

The piston state can be used for the cancellation policies (Cancel on piston state change), so sometimes it’s useful to controll piston state manually. But generally it’s only really used to change the text shown on the main dashboard, for quick reference.


#3

When experimenting like that what is your favorite way to “debug”. That is, what is the easiest way to examine values in the middle of the run?


#4

I use Logging quite extensively when creating something new. It’s just a few commands and I can see how everything is set quite easily that way.


#5

@Mike1616, at first I was thinking you were just looking at the log files. Is there a way to write to the log?


#6


#7

Yep. The various “Log types” are just different colors… Which can in handy at times.


#8

Really like the logging. Looks like it logs even when “logging level” is set to none.