Displaying a percentage in a custom pane

s.manghani
20 May 2020, 12:35

Can someone help: Can I move the following code from the status pane to a custom pane (or, more simply to remove the score from the status pane and only show the progress percentage from the code):

game.changedscore => {
  this.percentscore = 100 * this.score / 90
}
do (game, "changedscore")
dictionary add (game.statusattributes, "percentscore", "Progress: !% of Chapter 1")

At the moment this code generates a progress percentage that is currently displayed in the status pane, but that also shows the score (if I switch off score the status pane is removed). I would like to display just the progress. I presume a custom pane is the answer, but I don't know how to render this kind of code in a custom pane. Any help most welcome!


mrangel
20 May 2020, 16:26

The "score" feature automatically includes the score in the status attributes, immediately before running the start script.

So to remove the score, I think you should be able to put:

dictionary remove (game.statusattributes, "score")

in your start script.


s.manghani
23 May 2020, 17:54

Thank-you so much, both for your promptness in response and the for the perfect solution! ...the elegant solutions always seem so simple (when you know how!)