This would be easy in any language I have written, but I cannot get it to work in WebCore. What I would like to do is set up a piston that would lower a dimmer level by 10 each time it is pressed unless that would lower it below 10, in which case it would set it to 100.
//
/* Test Dimming */
//
/* Author : John Vowell /
/ Created : 10/22/2021, 11:43:42 AM /
/ Modified : 10/22/2021, 1:22:37 PM /
/ Build : 10 /
/ UI version : v0.3.113.20210203 */
/**************************************************************/
settings
disable automatic piston state;
end settings;
define
integer IntLampLevel = GED1's level;
end define;
execute
if
Virtual Switch for Testing Devices' switch changes to on
then
if
GED1's level is less than 20%
then
with
GED1
do
Set level to 100%;
end with;
else
with
GED1
do
Set level to {IntLampLevel - 10}%;
end with;
end if;
with
Virtual Switch for Testing Devices
do
Set switch to off;
end with;
end if;
end execute;
Edit