Best approach to score when options exist

Hi,
I am using a scoring system and have an issue. There are a couple of different ways to defeat an enemy. I have points for either way set up. So when the PC clicks on the score, they see the total possible score, which includes the count for both options, which is not what I want.

I would like the total possible score to be an even 100.
I added this to the score object but I don’t think this is the best way. I’m basically removing the second option score after the score reaches 100.
Is there a better way to handle this?

modify statusLine
showStatusRight()
{
local s = libGlobal.scoreObj;
    /* if there's a score object, show the score */
    if (s != nil)
    {
        if(s.totalScore >= 100){s.totalScore = s.totalScore - 14;}
        /* show the score and the number of turns so far */
        //''Your <<aHref('full score', 'score', 'Show full score')>> has just <<delta > 0 ? 'in' : 'de'>>creased by <<spellNumber(delta > 0 ? delta : -delta)>> point<<delta is in (1, -1) ? '' : 's'>>.''
        //"<.statusscore><<s.totalScore>>/HERE CHGE TURNS:<<libGlobal.totalTurns>><./statusscore>";
        "<.statusscore><<s.totalScore>> Score<./statusscore>";
    }
}

I’m not certain I understand what you’re trying to implement here, but modifying the score when reporting it is almost certainly not what you want.

If I understand your requirements correctly, the actions the player takes can in theory total up to more than 100 points, but you want the maximum value of the score to be 100. If that’s right, then you want something like:

libScore.totalScore += 5;
if(libScore.totalScore > 100)
        libScore.totalScore = 100;

…as the mechanism for adding to the score, rather than something that runs when the score is displayed.

What I’d probably do is implement a setter method on the score object that the gamealways uses to change the score, insuring that the bounds check is applied on every update.

1 Like

I guess I wasn’t very clear in my original post or my solution. Apologies.

The problem with both of the suggestions is that if the player clicks on the in-game score link, the total possible points is shown. That value is higher than 100 because of the various ways you can accomplish the same goal.

Wondering if I can manipulate the full score to make it an even 100 in addition to the total score > 100.

>full score
In 152 turns you have scored 74 of a total 110 points. 
Your score consists of: ...

Oh, if you just want to change the reported maximum score, just set gameMain.maxScore. For example:

modify gameMain maxScore = 69105;

Note that this will not automatically enforce a limit, it just controls the reported max score. So with:

modify gameMain maxScore = 69105;

DefineSystemAction(Foozle)
        execSystemAction() {
                libScore.totalScore += 100000;
                defaultReport('Score! ');
        }
;
VerbRule(Foozle) 'foozle' : FoozleAction verbPhrase='foozle/foozling';

You get:

>score
In 0 moves, you have scored 0 of a possible 69105 points.

(To see a detailed accounting of your score, type FULL SCORE.)

>foozle
Score!

(Your score has just increased by one hundred thousand points.)

(If you'd prefer not to be notified about score changes in the future, type
NOTIFY OFF.)

>score
In 0 moves, you have scored 100000 of a possible 69105 points.

>
1 Like