Is there a way to make a leader board in Choice of Script?

I’m writing my own IN and I was playing around with a few Ideas and I thought about putting in a leader board.
So like if Jim gets 3 Points, Greg 2 Points and Many 1 Point:
#1 Jim 3
#2 Greg 2
#3 Many 1
and then say Many wins 2 Points, Greg wins 3 and Jim wins 1 so then the leader board changes:
#1 Greg 5
#2 Jim 4
#3 Many 3
Is this at all possible?
And how would I do it?

For players or npc’s?

It’s definitely possible… sort of… It can just get a little complicated, so you might decide to leave it out. Let’s say you have this:

*create jim_points 0
*create greg_points 0
*create many_points 0

You could create a whole crazy cascade of *if, *elseif, and *else (it would probably have to be a subroutine, too) like:

*if (jim_points > greg_points)
    Jim is #1!

etc. etc.

I think a simpler way to do it would just have the leaderboard rankings be text variables, and then have story cues change the potential rankings.

For example:

*create number_1 ""
*create number_2 ""
*create number_3 ""

Who scores the most points in the game?
*choice
    #Jim.
        *set number_1 "Jim"
        *goto number_2_check
    #Greg.
        *set number_1 "Greg"
        *goto number_2_check
    #Many.
        *set number_1 "Many"
        *goto number_2_check
*label number_2_check
Who came in second place?
*choice
    #Jim.
        *set number_2 "Jim"
        *goto number_3_check
    #Greg.
        *set number_2 "Greg"
        *goto number_3_check
    #Many.
        *set number_2 "Many"
        *goto number_3_check

etc. etc.
1 Like

Yourself (Reader) and NPC’s
So Like on the stats screen it changes as events occur.

1 Like

@Writing_Fever, your answer seems to have been cut short?

2 Likes

Kinda looks like a case of premature postulation. No shame in it, happens to everyone now and then.

5 Likes

Haha yeah, I accidentally hit “tab” when I was typing the code, and it highlighted the “reply” button too early. So, when I hit “enter” to give myself a paragraph break, it posted the comment, instead!

You should see a doctor if your postulation lasts more than three to six hours, though.

5 Likes

it’s a fun challenge, so I’m writing my own solution as well! :smile:

1 Like

Thanks, This helps quiet A bit. I’ll play around with this :slightly_smiling_face:

1 Like

You’re welcome! I’m always happy to help! (:

personally, I think I would do it like this:

*create jim_points 0
*create greg_points 0
*create many_points 0

*if (jim_points > greg_points)
    *if (jim_points > many_points)
        nr.1 Jim ${jim_points}
        *line_break
        *if (greg_points > many_points)
            nr.2 Greg ${greg_points}
            *line_break
            nr.3 Many ${many_points}
        *if (many_points > greg_points)
            nr.2 Many ${many_points}
            *line_break
            nr.3 Greg ${greg_points}
        *if (many_points = greg_points)
            nr.2 Many ${many_points} & Greg ${greg_points}

And then a similar *if for the other possible 1st places, or shared 1st.
But it’d get tiresome with many contestants.

EDIT: the two first *if should probably be combined…

Please what does ‘nr’ in your code mean?

It is short for number. In Germany number, Nummer, is shortened to Nr. In Denmark it seems to be similar

1 Like

Ah, I forgot. :sweat_smile:
It just makes so much more sense than no. ! :laughing:

1 Like

Think I’ll just have a standing leader board:
Jim 2
Greg 5
Many 3
To much coding :dizzy_face: if I want a changing leader board and I like simplicity :sweat_smile: But I’ll find a way to make a changing leader board and incorporate the ideas here :thinking: just a matter of how…

Not sure if it will help, or if you’re interested, but you could take a look at the code I posted in the following Topic that sorts stats.

https://forum.choiceofgames.com/t/seeking-simple-code-to-rank-a-series-of-stats/29751

This might actually be a good solution, I think I can make it work. Change a few bits here and there but I think It’ll work :slightly_smiling_face: Thx.