I need help! Problems with coding for the stat screen


#1

I’m studying about codes right now.

But *break_line made me mad!
When I opened the stat in the game, so it didn’t work!
For example:

*stat_chart
  text Name
  *line_break
  percent blah blah

What will I do?

Is it ok to ask about the codes in this post if I have more problems?


#2

For starters I think your indenting isn’t right. There shouldn’t be any indents.

secondly I"m not sure why you’re setting it out like that. Shouldn’t it be more like

*label stats
[b]Name:[/b] $!{name} 

*line_break

It always helps if you post the exact error you’re getting :slight_smile:
(By the way I’ve edited the post so people know what you’re asking about and you can get help.)

Edit: Actually misread it. Ok do look at the spacing because I don’t think you should continue to use spaces after text name, but if that doesn’t work the problem might be in the set up of the stat_chart. To me it looks like you’re missing a value.

for example

*stat_chart
	text health_text [b]Health[/b]	

You then need to define the health_text in further coding. Do you have that? An error code would be helpful here.


#3

Let’s see what’s wrong in your code :eyeglasses:

Umm… In *stat_chart, you don’t need a *line_break command
Other than that, looks fine. But explaining what’s wrong will surely help


I thought *stat_chart requires following lines to be indented (nested) :confused:
My choicescript_stats have indents on it


#4

Yes it does (If you check the example I put up), but anything after that (like line_break) shouldn’t have the indent. I think you can use line_break between stat_chart commands if you want to spread them out but then would probably need to use the stat_chart command again before the next one.

Quickest option is to use the testers built into the program to see which line the problem is on.


#5

No, it doesn’t work, and it says choicescript_stats line 7: invalid line; this line should start with ‘percent’, ‘text’, or ‘opposed_pair’


#6

The texts are fixed, BUT the percents are problem!

*stat_chart
        text name_text [b]Name[/b]
*line_break
        percent blah blah

No percent-symbols are in the stat, just text!


#7

*stat_chart doesn’t like anything indented below it other than ‘percent’, ‘text’ or ‘opposed_pair’. Just use two, with a *line_break between if desired:

*stat_chart
        text name_text [b]Name[/b]
*line_break
*stat_chart
        percent blah blah

#8

You can turn above code into -> below code

*stat_chart
        text name_text [b]Name[/b]
        percent blah blah

#9

I didn’t understand any goto commands when I wrote *choice. How to make them?

What is different of set and temp? Give me any examples!

@Szaal Yes, but the problem is solved.


#10

*set assigns a value to properties, you can also make *set [property] +1 to add one to numerical values, or use - to subtract. You can only *set properties that have been created. Both *create and *temp can do this, but with caveats.

*create makes it so that that property lasts throughout the whole game, but can only be done at the beginning of the game. *temp can be done anywhere. However, *temp only creates that property for the scene in question, it won’t last past that scene, and will be deleted if you leave that scene via *finish or *goto_scene.

*goto and *goto_scene function somewhat similarly. *goto tells the system to skip to wherever the label name is.

For example:
*label loop
*goto loop

would create an infinite loop where the system is told to read starting from loop, whereupon the first command is to read starting from loop. *label is something like a pointer, it marks down locations you can use the *goto command to find, note that *goto only functions within the scene itself, so no worries if you set the same label name so long as all are in different scenes. *goto_scene instead moves you to the beginning of the scene specified. If you want to move to a specific label in the scene, use *goto [scene] [label].

I think there’s a wiki somewhere, check it out.


#11

I’m studying about codes right now in wiki. But I only have hard to understand different codes.


#12

Ok, did you understand what I wrote?


#13

Yes, but I have to test to play. Can you wait?


#14

I finally understand a part of them.

How to write in *stat_chart and startup.txt, for example, man or woman?


#15

You would have to have variables set up in the startup text. For example:

*create gender "man"
*create gender "woman"

Then In your choices, you would have the player choose the option of man or woman.After that, in your stat_chart code, you would put:

*if gender (man)
     ${gender}
*if gender (woman)
     ${gender}
*goto wherever
    

Remember that for the stat chart to display man or woman, you have to create the variables for them in the startup file and either set them true or false later on in the code.


#16

note that you should only create the property once.

*create gender “male”

for instance, and when a choice confirms it, use

*set gender "male"
or
*set gender “female”

I normally do

*create gender “undefined”

instead.

Edit: Because I like it tidy, and just in case I do something that needs me to debug whether they actually made the choice.

In stat chart you can then write

Gender: ${gender}

as ${gender} tells the game insert the value for that property. Or alternatively

*stat_chart
text Gender

Edit2: Remember to add an indent for the second command.


#17

I can’t indent properly one my phone. :sweat:

I didn’t know that you couldn’t just assign two things to one property. The more you know, I guess. In my text, I labeled gender as “Unknown” and went off from there.


#18

Eh, I still don’t understand the codes. *create and *stat_chart isn’t working for me with gender.


#19

First, what exactly is the problem you’re hitting?

Does copying this into a game work for you?

*create gender "unknown"
*choice
  #Male
    *set gender "male"
    *goto gender_test
  #Female
    *set gender "female"
    *goto gender_test
  #Decline to state/Other
    *set gender "decline to state"
    *goto gender_test
*label gender_test
*stat_chart
  text gender


#20

How do we indent in comments?