whats wrong with this?
clamp(global('Spaceship - EnergyTotal'),global('Spaceship - EnergyTotal')*0.6,global('Spaceship - EnergyTotal')*0.69)[/code:1v2oqfvx]
There's nothing wrong with it. It just doesn't make sense. The returned value of this expression will always conform to global('Spaceship - EnergyTotal') * 0.69.
clamp returns a bounded value. But, if you make the bounds relative to the value, it will always return the highest or lowest value, depending on the relation. Just replace global('Spaceship - EnergyTotal') with a value to see the problem. Let's say, global('Spaceship - EnergyTotal') equals 100:
clamp(100,100*0.6,100*0.69)
You're now ordering Construct to return 60, if the original value is lower than 60, to return the original number, if it is between 60 and 69, and to return 69, if the original value is greater than 69. But the original value always is 100, and so you are always getting 69.
And now think of all the different values, global('Spaceship - EnergyTotal') may have. They all will be greater than global('Spaceship - EnergyTotal') * 0.69
clamp(50,50*0.6,50*0.69) will return 34.5 (always and only)
clamp(260,260*0.6,260*0.69) will return 179.4 (always and only)
So, if you are comparing global('Spaceship - EnergyCurrent') with clamp(global('Spaceship - EnergyTotal'),global('Spaceship - EnergyTotal')*0.6,global('Spaceship - EnergyTotal')*0.69), you are comparing global('Spaceship - EnergyCurrent') with global('Spaceship - EnergyTotal')*0.69
This comparison will only be successful, if global('Spaceship - EnergyCurrent') conforms exactly to global('Spaceship - EnergyTotal')*0.69, and not to a range of values.
Don't make the bounds of clamp relative to its value. And, if you want global('Spaceship - EnergyCurrent') to be in a certain range for the condition to become true, do this:
+ Is global variable 'Spaceship - EnergyCurrent' greater or equal global('Spaceship - EnergyTotal') * 0.6
Is global variable 'Spaceship - EnergyCurrent' less or equal global('Spaceship - EnergyTotal') * 0.69
[/code:1v2oqfvx]
That's two conditions in one event, meaning they both need to be true for the action to be performed. And they are both true for [i]every[/i] value between global('Spaceship - EnergyTotal') * 0.6 and global('Spaceship - EnergyTotal') * 0.69