Error Rules with %sysmonth%
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 4
- Joined: 30 Aug 2021, 08:05
Error Rules with %sysmonth%
Hello,
Sorry for my bad English. I’m French.
Yesterday, this rule do else (50), so false, but now, it’s 08:
on ledm1 do
if %sysmonth_0% > 03 or %sysmonth_0% < 10
asyncevent,pwm12=80
else
asyncevent,pwm12=50
endif
endon
I changer that. This morning, the new rules do right (80). But, month is 08. It’s not <= 03 or not >= 10. So this new rules is normally false.
on ledm1 do
if %sysmonth_0% <= 03 or %sysmonth_0% >= 10
asyncevent,pwm12=80
else
asyncevent,pwm12=50
endif
endon
I tried with %sysmonth% too and same error.
Where is the problem please?
Sorry for my bad English. I’m French.
Yesterday, this rule do else (50), so false, but now, it’s 08:
on ledm1 do
if %sysmonth_0% > 03 or %sysmonth_0% < 10
asyncevent,pwm12=80
else
asyncevent,pwm12=50
endif
endon
I changer that. This morning, the new rules do right (80). But, month is 08. It’s not <= 03 or not >= 10. So this new rules is normally false.
on ledm1 do
if %sysmonth_0% <= 03 or %sysmonth_0% >= 10
asyncevent,pwm12=80
else
asyncevent,pwm12=50
endif
endon
I tried with %sysmonth% too and same error.
Where is the problem please?
Re: Error Rules with %sysmonth%
Please do not use the variable with a leading 0
A value starting with a 0 (not "0x123" as in a HEX number) is often considered in octal representation.
So values 0..7 work just like in decimal or hexadecimal notation, but at "8" things start to work different.
So better use %sysmonth% instead of the version which adds a leading zero.
A value starting with a 0 (not "0x123" as in a HEX number) is often considered in octal representation.
So values 0..7 work just like in decimal or hexadecimal notation, but at "8" things start to work different.
So better use %sysmonth% instead of the version which adds a leading zero.
-
- New user
- Posts: 4
- Joined: 30 Aug 2021, 08:05
Re: Error Rules with %sysmonth%
Ok but I tried too with %sysmonth% and same problem.
Re: Error Rules with %sysmonth%
Your numbers also have a leading 0
-
- New user
- Posts: 4
- Joined: 30 Aug 2021, 08:05
Re: Error Rules with %sysmonth%
This don’t work too:
if %sysmonth% > 3 or %sysmonth% < 10
if %sysmonth% > 3 or %sysmonth% < 10
Re: Error Rules with %sysmonth%
OK, I don't really get your problem then...
Just re-read your initial post and I wonder what you try to do with this line in your rules:
Just assuming, it is not having issues with any leading zeroes.
What is stated here can be simplified to this:
X > 3 or x < 10 is always true.
If you want to match the months April ... September, then you should write:
It needs an AND and not an OR.
Just re-read your initial post and I wonder what you try to do with this line in your rules:
Code: Select all
if %sysmonth_0% > 03 or %sysmonth_0% < 10
What is stated here can be simplified to this:
Code: Select all
true
If you want to match the months April ... September, then you should write:
Code: Select all
if %sysmonth% > 3 and %sysmonth% < 10
-
- New user
- Posts: 4
- Joined: 30 Aug 2021, 08:05
Re: Error Rules with %sysmonth%
I’ve right. It’s me.
X > 3 or X < 10 it’s all ways true...
I’m stupid lol
X > 3 or X < 10 it’s all ways true...
I’m stupid lol
Re: Error Rules with %sysmonth%
Don't be too hard on yourself.... Has happened to any programmer, for sure and not just once
So consider yourself a programmer (and "just" human)
So consider yourself a programmer (and "just" human)
Who is online
Users browsing this forum: No registered users and 19 guests