It is currently April 27th, 2024, 7:06 am

3rd SetOption from IfActions?

Get help with creating, editing & fixing problems with skins
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

3rd SetOption from IfActions?

Post by Seahorse »

I am using this code to toggle a boxes colour, in short there are 12 of them and they are grey until it is their turn to light up which they do for a second before turning grey again:

Code: Select all

[CalcCounter]
Measure=Calc
Formula=(CalcCounter%12)+1

[CalcBox1]
Measure=CALC
Formula=(CalcCounter=1)
IfAboveValue=0
IfAboveAction=!SetOption Box1 SolidColor #Colour2#
IfEqualValue=0
IfEqualAction=!SetOption Box1 SolidColor #Colour1#

[CalcBox2]
..etc...etc...
This works perfectly.

What I want to do is use IfBelowValue to generate a 3rd colour which also toggles on once every 11 seconds which 'chases' the first 'lit up' box, something like IfEqualValue=(0-1) which doesn't work. Neither does changing it to =2 for [CalcBox1] 3 for [CalcBox2] etc - though it does work the first time you refresh. I've tinkered for a bit now but I am not sure if either my logic is wrong, or if I can't actually use IfBelowValue in this way?

This is how it currently looks.

Code: Select all

[CalcBox1]
Measure=CALC
Formula=(CalcCounter=1)
IfAboveValue=0
IfAboveAction=!SetOption Box1 SolidColor #Colour2#
IfEqualValue=0
IfEqualAction=!SetOption Box1 SolidColor #Colour1#
IfBelowValue=2
IfBelowAction=!SetOption Box1 SolidColor #Colour3#
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: 3rd SetOption from IfActions?

Post by Kaelri »

Code: Select all

[CalcBox1]
Measure=CALC
Formula=(CalcCounter=1) ? 2 : ((CalcCounter=0) ? 1 : 0 )
IfAboveValue=1
IfAboveAction=!SetOption Box1 SolidColor #Colour2#
IfEqualValue=1
IfEqualAction=!SetOption Box1 SolidColor #Colour3#
IfBelowValue=1
IfBelowAction=!SetOption Box1 SolidColor #Colour1#
Equivalent to:

Code: Select all

if (CalcCounter=1) then
    2
else
    if (CalcCounter=0) then
        1
    else
        0
    end
end
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: 3rd SetOption from IfActions?

Post by Seahorse »

I think I understand the logic, however I am not seeing Colour3 at all, for testing I am using:

Code: Select all

;Grey - background
Colour1=51,51,51,255

;White - Light on
Colour2=255,255,255,255

;Light Blue - Chasing light
Colour3=102,204,255,255
So everything is grey except the box that is white, and nothing is blue.

Code: Select all

[CalcBox1]
Measure=CALC
Formula=(CalcCounter=1) ? 2 : ((CalcCounter=0) ? 1 : 0 )
IfAboveValue=1
IfAboveAction=!SetOption Box1 SolidColor #Colour2#
IfEqualValue=1
IfEqualAction=!SetOption Box1 SolidColor #Colour3#
IfBelowValue=1
IfBelowAction=!SetOption Box1 SolidColor #Colour1#

[CalcBox2]
Measure=CALC
Formula=(CalcCounter=2) ? 2 : ((CalcCounter=0) ? 1 : 0 )
IfAboveValue=1
IfAboveAction=!SetOption Box2 SolidColor #Colour2#
IfEqualValue=1
IfEqualAction=!SetOption Box2 SolidColor #Colour3#
IfBelowValue=1
IfBelowAction=!SetOption Box2 SolidColor #Colour1#
So nothing is IfEqualValue=1 we get no blue? :???:
Capture.PNG
You do not have the required permissions to view the files attached to this post.
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: 3rd SetOption from IfActions?

Post by Kaelri »

That was just a demonstration of the formula syntax. You'll need to fill in your own colors and conditions accordingly. (Your CalcCounter will never equal 0, for instance.)
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: 3rd SetOption from IfActions?

Post by Seahorse »

/my bad, totally misunderstood what you were demonstrating. I have wrapped my head around it now and am fixing the conditions, thanks again. :thumbup:
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt