Jeremy will correct it for you. If he does his IQ is 120+
Already did...down to 38 lines. But since nobody else can read it, decided not to post it...and didn't use select case. Those numbers aren't linear, but they're close enough to do some math on to get the desired results...thereby resulting in a simple single if/then/endif 3-line statement to handle all those if/then's.
That's a shame Jeremy, I was going to expose you to the world as border line genius.
Last edited by T.Jackson; - 19th June 2008 at 17:37.
One possible "improved" solution is as follows ...
That code will do exactly the same job as ...Code:Select Case b1 Case Is < 219 timerN = 3 timerAc = 120 timerBc = 60 Case Is < 243 timerN = 2 timerAc = 180 timerBc = 60 Case Is <= 255 timerN = 1 timerAc = 600 timerBc = 180 End Select
BUT, it'll probably compile to half the size, run twice as fast, be more readable, easier to comprehend and definitely far easier to maintain.Code:If (b1 <= 255 And b1 >= 243) Then timerN = 1 timerAc = 600 timerBc = 180 End If If (b1 <= 242 And b1 >= 219) Then timerN = 2 timerAc = 180 timerBc = 60 End If If (b1 <= 218 And b1 >= 193) Then timerN = 3 timerAc = 120 timerBc = 60 End If
Regards,
Trent Jackson
Last edited by T.Jackson; - 20th June 2008 at 17:44.
What
is
so
hard
to
read
with
colons
?
I
think
they
help
make
the
code
MORE
readable
if
used
in
the
right
place.
It
makes
it
more
like
reading
a
book.
![]()
Dave
Always wear safety glasses while programming.
Bookmarks