Coding Help Please

EDIT: I’ll be posting all coding issues I have here from now on.
Some help would be appreciated, as I don’t know what I am doing wrong.

I tried to play through my game to see how everything was going and there was an error.

This is the whole screen right now.
Some more help would be appreciated.

And line 19 says “*set boy “boy””

As the error states, you’ve mixed up spaces and tabs. Best thing to do is remove all your indentation and re-indent every line manually one-by-one. It’s a pain but it’ll work.

1 Like

Thanks so much! All fixed.

1 Like

One more thing before I go, I have a question about stats.

So, for example, the player eats a large meal and gains a %5 weight increase. What code would need to be used to do this?

The first step would be to set a variable.
The second would be to add the variable to the stat chart.
The third would be to add the *set weight +5% increase in the code.

You may want to experiment with [Tool] Chronicler - ChoiceScript Visual Code Editor if you are hitting some snags. I feel like using this visual flow chart has helped me keep my game organized as it is very easy to create variables - and then manipulate them. CJW is also working on creating a program that will allow easier building of your stories - CSIDE.

@ScatteredA Something like this…

*temp playerweight 123
*temp weightgain 0

*label myweight
Player currently weighs ${playerweight}
*line_break
How much weight does the player gain?

*choice
 #Five Percent
  *gosub gain5
  *goto myweight
 #Ten Percent
  *gosub gain10
  *goto myweight
 #Fifteen Percent
  *gosub gain15
  *goto myweight


*label gain5
*set weightgain (playerweight * 0.05)
*set playerweight (playerweight + weightgain)
*set playerweight round(playerweight)
Player gained 5 percent weight.

*return

*label gain10
*set weightgain (playerweight * 0.10)
*set playerweight (playerweight + weightgain)
*set playerweight round(playerweight)
Player gained 10 percent weight.

*return

*label gain15
*set weightgain (playerweight * 0.15)
*set playerweight (playerweight + weightgain)
*set playerweight round(playerweight)
Player gained 15 percent weight.

*return
2 Likes

I think I asked the wrong thing. How do you make it so that when the player chooses a certain choice, they get an increase in a certain stat?

If you wanted to increase by 5, for example (and not talking about increasing by percent)…
You would put something like

*set yourstat + 5

under your choice,

Example:

*choice
 #increase my str
  *set str + 5
 #increase my agi
  *set agi + 5

One of the things in my game are dragons, and the MC gets one. They get to choose certain things about it, like it’s name, species, gender, etc. How do I set this up in startup.txt and choicescriptstats.txt, since the variable name already exists?

Very carefully. :smile_cat:

1 Like

I actually think I got it down. I guess I’m learning!

Actually you could have used replace command to replace four spaces with tab
As it is solved better using this in future
( solved many probs with that one - really cool command )