# Difficulty inputting stats

I’m having trouble with inputting stats at the start of the game
The character starts with skill 8, stamina 17 and luck 8.You can add 6 points to these stats, skill and luck can be a maximum of 12 abd stamina can go to 24 (although only up to 23 at the start of the game if you give all 6 points to it)
I am struggling as the coding I have done allows you to add up to 4 to the skill and luck stat , but doesn’t reduce available points subsequently so you can for example add 4 skill then 4 luck, this should be 4 skill then only 2 luck

My code looks like this:

``````*label init
*set ap 6
*temp skill_limit
*temp stamina_limit
*temp luck_limit
*set skill_limit 4
*set stamina_limit 6
*set luck_limit 4
*label choose_stats
You have \${ap} AP left to spend to increase your stats. Which stat do you want to increase?
*choice
*hide_reuse #skill
How many AP will you spend to increase skill? (1 - \${skill_limit})
*input_number stat1 1 skill_limit
*set skill +stat1
*hide_reuse #stamina
How many AP will you spend to increase stamina? (1 - \${stamina_limit})
*input_number stat1 1 stamina_limit
*set stamina +stat1
*hide_reuse #luck
How many AP will you spend to increase luck? (1 - \${luck_limit})
*input_number stat1 1 luck_limit
*set luck +stat1
#I'm finished spending AP
*goto done
#Reset stats and AP
*goto init
*set ap -stat1
*if ap < 1
*goto done

*goto choose_stats
*label done
*goto_scene club
``````
``````Example
*commend
Indent
``````

Your “ap” value is going negative. And negative numbers are still numbers from which you can pluck points. You need a check somewhere there:

``````	*if ap <= 0
*set skill + ap
``````

Either move the whole thing to adjust_ap by setting a selected skill to a new temp var or do all calculations in the choice body and remove adjust_ap altogether.

1 Like

Apologies, I think I have nearly got it but not quite
I did this but have made it worse

``````*label init
*temp ap
*temp skill_limit
*temp stamina_limit
*temp luck_limit
*set skill_limit 4
*set stamina_limit 6
*set luck_limit 4
*set ap 6
*label choose_stats
You have \${ap} AP left to spend to increase your stats. Which stat do you want to increase?
*choice
*hide_reuse #skill
How many AP will you spend to increase skill? (1 - \${skill_limit})
*input_number stat1 1 (skill_limit - stat1)
*set skill +stat1
*hide_reuse #stamina
How many AP will you spend to increase stamina? (1 - \${stamina_limit})
*input_number stat1 1 (stamina_limit - stat1)
*set stamina +stat1
*hide_reuse #luck
How many AP will you spend to increase luck? (1 - \${luck_limit})
*input_number stat1 1 (luck_limit - stat1)
*set luck +stat1
#I'm finished spending AP
*goto done
#Reset stats and AP
*goto init
*set ap -stat1
*if ap < 1
*goto done

*goto choose_stats
*label done
*goto_scene club
``````

This doesn’t take a situation where remaining AP are less than stamina limit into account - in that case a player could add 6 points when only 2 or 4 remains, so ap will turn negative.

``````*if skill_limit > ap
*set skill_limit ap
``````

Do it for all stats you need.

It’s not nessesary to create temp variables and *set them separately in *label init, you can write commands like *temp luck_limit 4.

``````*input_number stat1 1 (stamina_limit - stat1)
``````

I didn’t look at it in detail but I think the issue is that on the *input_number you are allowing the maximum to be the limit that stat can receive instead of the amount of AP currently left. The maximum should be two things, at most the limit which is 4, 4 and 6 and also the remaining AP.

You might need to add a condition to check which of these is lower so then you can assign them as the maximum for the *input_number.

Thank you for the kind replies I will try again this week!

I have updated the code as follows, I cannot work out how input number can take into account the limits ( 4, 4 and 6 ) and also take into account what ap you have left. Currently you can still go into negative numbers.
I added *if skill_limit > ap , *set skill_limit ap but this didn’t work (didn’t run)

``````*label init
*temp ap
*temp skill_limit 4
*temp stamina_limit 6
*temp luck_limit 4
*set ap 6
*label choose_stats
You have \${ap} AP left to spend to increase your stats. Which stat do you want to increase?
*choice
*hide_reuse #skill
How many AP will you spend to increase skill? (1 - \${skill_limit})
*input_number stat1 1 skill_limit
*set skill +stat1
*if skill_limit > ap
*set skill_limit ap
*hide_reuse #stamina
How many AP will you spend to increase stamina? (1 - \${stamina_limit})
*input_number stat1 1 stamina_limit
*set stamina +stat1
*if stamina_limit > ap
*set stamina_limit ap
*hide_reuse #luck
How many AP will you spend to increase luck? (1 - \${luck_limit})
*input_number stat1 1 luck_limit
*set luck +stat1
*if luck_limit > ap
*set luck_limit ap
#I'm finished spending AP
*goto done
#Reset stats and AP
*goto init
*set ap -stat1
*if ap < 1
*goto done
*goto choose_stats
*label done
*goto_scene club
``````

Try this:

``````*label init
*temp ap 6
*temp skill_limit 4
*temp stamina_limit 6
*temp luck_limit 4
*label choose_stats
You have \${ap} AP left to spend to increase your stats. Which stat do you want to increase
*choice
#Skill
How many AP will you spend to increase skill? (1 - \${skill_limit})
*input_number stat1 1 skill_limit
*set skill +stat1
#Stamina
How many AP will you spend to increase stamina? (1 - \${stamina_limit})
*input_number stat1 1 stamina_limit
*set stamina +stat1
#luck
How many AP will you spend to increase luck? (1 - \${luck_limit})
*input_number stat1 1 luck_limit
*set luck +stat1
#I'm finished spending AP
*goto done
#Reset stats and AP
*goto init
*set ap -stat1
*if ap < 1
*goto done
*if skill_limit > ap
*set skill_limit ap
*if stamina_limit > ap
*set stamina_limit ap
*if luck_limit > ap
*set luck_limit ap
*goto choose_stats
*label done
*goto_scene club
``````
1 Like

It works! Thanks a million, genuinely appreciated and cheers!
Thanks Jumo and GoldenSilver too.

I am going to have a cup of tea to celebrate now!

1 Like