Setting the Score to the value of another variable

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.
Post Reply
devileye
Posts: 11
Joined: Mon Mar 01, 2021 4:12 pm
Points: 10
Location: Bristol, UK
Contact:

Setting the Score to the value of another variable

Post by devileye »

I have a variable %Strength% whose value is increased or decreased by performing certain tasks. A typical Action might set Strength using the expression:

IF(%Strength% < %StrengthMax%, %Strenght% + 1, %Strength%)

(%StrengthMax% might have a value of 3.) This Task would be repeatable but repeatably performing it would only allow you to raise Strength to 3. To take Strength any higher would mean undertaking a different task that would have a different expression.

This all works fine, but it occurs to me that the value of Strength is effectively the Score, and it would be nice to have it displayed as such at the bottom of the Runner window when you play the game. However this doesn't work if I substitute %Score% for %Strength% as %Score% is unusual in that it cannot be set by repeating an action. I do understand why this is, but in this case I am doing my own checking to prevent the player winning the game by simply repeating the same Task over and over again.

Is there any way around this? If not, wouldn't it be better if this 'nonrepeatability' of the Score variable could be turned on or off in the Developer options - and of course set to 'on' by default?
User avatar
P/o Prune
Site Admin
Posts: 4827
Joined: Mon Jun 24, 2002 9:18 am
Points: 133
Location: Denmark

Re: Setting the Score to the value of another variable

Post by P/o Prune »

There is already a variable called Score (and another called Max_Score) Would it be possible to incorporate that with your strength variable somehow?
D-Day in progress 86Kb (Slowly drifting)
October 31st: 93Kb (possible entry for IFComp 2021 :wink: )
devileye
Posts: 11
Joined: Mon Mar 01, 2021 4:12 pm
Points: 10
Location: Bristol, UK
Contact:

Re: Setting the Score to the value of another variable

Post by devileye »

Thanks for your response, but the trouble with Score is that, to quote the manual:

"It has a hidden 'run once' functionality built in to it which prevents a particular task from incrementing its value more than once."

As a result it wouldn't work in an expression like the above as the Task can be repeatedly performed. I am currently using another variable (Strength) to perform the same function, but it would be nice if it was displayed on the Runner screen like the Score variable.
Post Reply