Coding Help Please


#1

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””


#2

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.


#3

Thanks so much! All fixed.


#4

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?


#5

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.


#6

@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

#7

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?


#8

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

#9

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?


#10

Very carefully. :smile_cat:


#11

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


#12

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 )