How to calculate all possible stat combinations?

I’m not sure if this is the right category but I will ask anyway and I hope what I’m going to ask will make sense. I was wondering if anyone knows of a way to check all the possible stat amounts.

For example
I have stat 1
choice a gives +5
choice b gives +10
choice c gives -5

choice d gives +15
choice e gives -10
choice f gives +20

choice g gives +15
choice h gives -15
choice i gives +22

I want to know what the different combinations are without having to manual add up each possibility for the purposes of if and selectable if statements

If I’m understanding this correctly, you want to know how many combinations there are, right? Or do you want to know all the possible results of those combinations?

1 Like

I want to know the possible results of those combinations for instance if someone picked just the first three the stat would be at 35 but I also want to know the other combinations.

2 Likes

If you want to know the possible results, you can just add the variables together by using *set to assign a value to a specific variable and then display that variable.

*choice
    #A.
        *set var +5
    #B.
        *set var +10
    #C.
        *set var -5

*choice
    #D.
        *set var +15
    #E.
        *set var -10
    #F.
        *set var +20

*choice
    #G.
        *set var +15
    #H.
        *set var -15
    #I.
        *set var +22

Your result is ${var}.

But if you want to display every single possibility alongside the result, it might actually be easier to just manually calculate the values and write them out. Otherwise, you would need to create a process that adds all the values to separate variables and then using those variables in a formula that then sets another variable to the result for display. That would require a ton of variables since you have 27 combinations.

1 Like

This might not be by far the best method but it is what I have been using, you have to put a bit of work on it but I couldn’t come out with a better solution so far.

First, add this to the end of your game, or the place you want to test the stats.
{stat1}, {stat2},
{stat3}, {stat4},
“and so on for all the stats you want to check”

Second, run the game on the randomtest printing out all the text (set iterations to the number your computer can handle without lagging for eternity. I use 200 or 250 or 500 and run it several times) run it as much times as you want (the more the better and most accurate output will be) save all the text (preferably open it on notepad++)

Third, if you use notepad++ do the following (if not figure it out for the text editor of your choice)

hit [ctrl]+f

select “Mark” tab

check “Bookmark line”

check “Regular expression”

on the “Find what :” write \d\d, \d\d
( “\d\d, \d\d” this only works if some of your variables are digits like stat1 = 44 stat2 = 26, anyway, the main thing is to just mark the lines of all the variables you printed out with ${}, I have several 2 digit variables so it worked for me and I kept using it though you can set it to find the expression that works for you)

Click on the “Mark all” button.

Go to "“Search” “Bookmark” “Copy bookmarked lines” (I recommend to make a custom shortcut for that option if you want to)

Create a new file and paste.

Repeat the process changing the starting number of the seed on the randomtest (for example if you set the iterations to 200 on the second pass set the seed to 200, on the third pass set the seed on 400 and so on, if you do 500 iterations set the seed on the first pass to 0, second pass to 500, third to 1000)

And lastly, copy all the variable data to an excel spreadsheet where you can determine the maximum and minimum values for all of your variables and look around for the values in between (do it on the same order you set the {stat1}, {stat2}, {stat3}, {stat4}, to be displayed)

I usually run like 6000 iterations to get all the max and min possible outputs, that would vary from game to game depending on how much long and branching and how often the stats are modified, just try and see what are the best setup for your particular work.

I know it isn’t a nice thing to do but with hundreds of variables and branches and chapters I couldn’t figure out a better way than this one or start to tracking it manually from the beginning which I wouldn’t like to do.

If someone knows a better, faster and efficient way to do it I’m all ears.

Edit: I don’t know if it is possible but it would make this method much easier if you could just make the randomtest only show the last screen of text before the game ends, it would greatly reduce the word count and it would be quicker to do more iterations per run. Or may be that the randomtest just shows you the things you put in between some command or special character like
*print ( {stat1}, {stat2}, ${stat3} )
ignoring all the rest of the text and only showing what’s inside the command at the end of the run.
I would love to have some feature like that, it would make it so much easier to know all the possible values you could have on a specific point of the game.

2 Likes