YOLOing the cooling rack

Vorg

Well-known endo
Joined
Jul 3, 2021
Messages
56
#1
I want to limit the use of the cooling rack when the radiator is enough and undamaged. My guess is watch "RadiationRate" and when it reaches 100 or gets very close, start increasing "CoolerUnitRateLimit" towards 100. And When "RadiationRate" drops, decrease "CoolerUnitRateLimit" toward 0?

I came up with this:
[CODE
R=:RadiationRate C=:CoolerUnitRateLimit
ifR>=99 thenif C<100 thenC++ endelse ifR<99 then ifC thenC-- end end
:CoolerUnitRateLimit=C
[/CODE]

but it needs more end's on the second line which would make the line longer then 70
 
Last edited:

Askannon

Veteran endo
Joined
Feb 13, 2020
Messages
147
#2
you can cut down the ifR<99 since that is already covered in the else part ifR>=99then else end and the rates are capped at 0 and 100 so it can't go over or lower:
if R>=99 then c++ else c-- end
And if you're really hurting for space look at goto (and maybe test for R<99 and switch THEN and ELSE code)
 
Joined
Dec 9, 2020
Messages
2
#3
I think this would do the same thing, with operators adding or subtracting 1 depending on the comparisons.

Code:
:CoolerUnitRateLimit+=:RadiationRate>=99-:RadiationRate<99 goto 1
 

Vorg

Well-known endo
Joined
Jul 3, 2021
Messages
56
#4
Not finding enough info from google to understand how that line works. Think I got it, but it's a bit of a brain twister.
 
Joined
Aug 9, 2019
Messages
2
#5
Not finding enough info from google to understand how that line works. Think I got it, but it's a bit of a brain twister.
The comparison operators evaluate to either 1 or 0 for true or false.
Take the case for :RadiationRate>=99
The line would read: :CoolerUnitRateLimit+=1-0
In effect, it would add 1 to CoolerUnitRate.
If :RadiationRate<99
:CoolerUnitRateLimit+=0-1
It would subtract 1.

You can do all kinds of shortcuts and cool things by exploiting this. For example, with a button, do
if :Generator then ...
Instead of if :Generator==1 then ...
 
Last edited:
Joined
Aug 19, 2021
Messages
6
#6
Can't you simply set the :CoolerUnitRateLimit = ( :RadiationRate-90 ) * 10 ?

Result Examples:

RR= 100 -> URL= 100
RR= 95 -> URL= 50
RR= 90 -> URL= 0

I'm not sure what will happen for values below 90. If it doesnt work, then add a: IF :RadiationRate >=90 THEN.
 

Vorg

Well-known endo
Joined
Jul 3, 2021
Messages
56
#7
My original code was trying to watch for it producing numbers over 100 or less then 0 to avoid errors
 
Top