Anyone know if there is a code character I can insert which will produce a single empty space but still show up as a code symbol when I am writing, like *line_break but for spaces.
You can use unicode empty characters. Discourse forums automatically convert them into common whitespace so I canât post it here. But take a look at this page. There are different lengths to choose from.
For what purpose, if I may ask? Trying to set up a typographical setup?
Its for two things
firstly like this:
You goâĄ
*if direction = "east"
east
*else
west
with the ⥠being a blank space so that the sentence runs properly. I know I can just leave a blank space but its good to have a visible indicvato that I remembered the space
The second thing is so I can offset things slightly, as I see there is no way to right align text. Itâs a bit of a bodge but like this:
"War, war never changes"
âĄâĄâĄâĄâĄâĄâĄâĄâĄâĄ- Fallout
I think cup_half_emptyâs method works (thanks!) since I can do this with it with the little red dots being the empty character indicators:
Another noob question - is it possible to have stat bars of custom maximum value. i.e. not as a percent (out of 100) but say a stat bar which goes from 1 to 20?
Edit: I will add in a second noob question: is it possible to customize the achievements screen, for example to split achievements up by chapter?
No, but kind of. You canât change the range of the stat bar. But you can convert what you have into a percentile value.
*stat_chart
percent (round((stat_current_value / stat_max_value) * 100)) Stat Name
So 1/20 would become 5%
Alternatively, you can just print it.
Stat Value: stat_current_value / stat_max_value
Stat Value: 1 / 20
No. Unless you tweak CS source code. Iâm not sure, but I think the achievements page is generated by ui.js
.
The percentage calculations are an interesting way to do it. thanks for the advice.
My work around for the achievements is just to call them things like:
Chapter 1: Stonebreaker
Chapter 2: Stonemender
so the chapter they can be achieved in is visible. I might see about fiddling with ui.js at a later point.
You might want to create a file to visualize the achievements and access it through an option in the stats page. Then you can customise it to your liking. Just an idea.
But a good one. Is there a way to use whether an achievement has been achieved or not in an *if conditional? or would I need to set another âachievement variableâ to true if the conditions are met for the achievement?
You can use *check_achievements. This will generate temporary variables that you can call toâwellâcheck if achievements have been achieved. Then you can display or switch information using if statements. Thatâs a cool idea.
Oh wow, I had not see that there was this command. Thanks a bunch that will make things much easier for my custom screen. Thanks!
when you open choicescript, do you have to keep all the comment stuff like *comment Permissions and Limitations under license
No for testing purposes, but when you plan to publish, itâs implied that you have to keep the license in your work. And hiding it behind a *comment
seems the proper way.
Okay, hooray for noob coding thread, I have a question:
I recently read in another thread somewhere that using multiple *ifâs is not recommended, instead itâs ideal that you use *if in tandem with *else and *elseif. Could someone explain why?
For some reason Iâve stupidly been using *if (var) and *if not (var) instead of just *if and *else, so I guess Iâll have to change that, but what about areas where the text depends on multiple variables? For example, I have a bit of flavor text that has three different variations; one if you were in the elevator, one if you took the stairs, and one where you took the stairs but took your gloves off. Is it appropriate to use multiple *ifâs there? Have I unknowingly been making things difficult for myself by using multiple *ifâsâŚ?
e.g.
*if (elevator)
beep beep
*if (lab_off)
boop boop
*if not (lab_off)
blah blah
the rest of the text....
Very aware this is somewhat unnecessary, but a good(?) example for the purpose of understanding code. Will edit later :'D
From what Iâve learned (and hopefully Iâm understanding at least a little bit of this, is that) itâs used to ensure that there will be less pesky bugs. Itâs used as a debugging aid and ensures that it doesnât come up with an error. Error: none of the conditions in Label XYZ applied, is one of them. It is also used so that the code is easier to read.
*else should never be given a specific condition of its own as it essentially means "If none of the above conditions apply, then do this " .
This is taken from the Choicescript Wiki for Else.
There a couple reasons why youâd prefere to use if/elseif/else combo in place of consecutive if.
-
First of all and probably the less interesting one is the performance issue. Granted, it is negligible. Still, when the game engine resolves as true any of the statements in a combo, it skips the rest of it. Whereas if you have consecutive isolated if statements, the engine will resolve all of them one by one. Which leads to the next problem.
-
Maybe thereâll be more than one statement than resolves as true, but you want to print only the first one. Letâs say you want to print some flavour text depending on the players personality trait stats. You include in the game a series of consecutive ifs, where the text is substancial the same but is worded slightly different for shyness, dauntless, charming and whatnot. If the character reaches more than one of the set thresholds the game would print the more than one of the sentences. In fact, in your example, both the first and the last statements could be printed at once. The result would be:
beep beep blah blah
In order to fix that, youâd have to use intricate conditionals with growing complexity the more statements you have. If/elseif/else just make your life easier.
- Finally, as I said above, it just makes your life easier and the code more readable. Sure, you can make do with consecutive ifs, but itâs just a really good practice to use the available tools. Not to mention what @whitebear said, it can also help you set some debugging warnings.
Ah okay, I definitely didnât consider the situation where multiple variables would read true without me intending, so that makes sense! Thanks very much!
I have a head-scratcher, at least for me uhhhh!
So, Iâm working on this WIP and I have a page in the stats screen that says ânotesâ
I have the player questioning an NPC where the player can ask 5 questions out of 25, and only one question per round (so 5 rounds)
I did not want to use hide_reuse because I wanted it to be more immersive
Also, each question has a unique answer so hide_reuse would have caused the player to go through all the questions and I didnât want that.
Each answer to a question is tracked with a variable per rounds and the answers are âstrings variableâ
The questioning rounds goes like this:
Questions
1: Why the sky is blue?
*set round1 âanswer1 well I donât knowâ
2: Why you did this
*set round1 âanswer2 I wanted toâ
3: what happen yesterday
*set round1 âanswer3 nothingâ
4: is this yellow
*set round1 âanswer4 no it blueâ
5: how old are you
*set round1 âanswer5 and so oneâ
conversations in between and another round of 5 new questions
6: Why the sky is orange?
*set round2 âanswer6â
7: Why you said that
*set round2 âanswer7â
8: what happen Friday
*set round2 âanswer8â
9: is this blue
*set round2 âanswer9â
10: how old is he
*set round2 âanswer10â
conversations in between and another round of 5 new questions
11: Why the sky is red?
*set round3 âanswer11â
12: Why you did that
*set round3 âanswer12â
13: what happens today
*set round3 âanswer13â
14: is this blue
*set round3 âanswer14â
15: how old is he
*set round3 âanswer15â
conversations in between and another round of 5 new questions
16: Why the sky is green?
*set round4 âanswer16â
17: Why you did this
*set round4 âanswer17â
18: what happens Monday
*set round4 âanswer18â
19: is this yellow
*set round4 âanswer19â
20: and so on
*set round4 âanswer20â
conversations in between and another round of 5 new questions
21: Why the sky is red?
*set round5 âanswer21â
22: Why you did that
*set round5 âanswer22â
23: what happens today
*set round5 âanswer23â
24: is this blue
*set round5 âanswer24â
25: how old is he
*set round5 âanswer25â
At the end of the interview, I displayed the answers to the 5 questions that the player had selected during the 5 rounds.
And asked the player to choose one, and add it to their notes.
Choice
#{round1}
*set note1 "{round1}"
#{round2}
*set note1 "{round2}"
#{round3}
*set note1 "{round3}"
#{round4}
*set note1 "{round4}"
#{round5}
*set note1 "{round5}"
Hence, the variable note1 will be displayed in the notes of the stats screen.
I did this and it worked, but⌠it created a never-ending loading bar, when I test the game, whenever I open the stats screen and canât return to the game.
I passed quicktest and random testâŚeven turn off animation between pages but still get the never-ending loading bar
So, I think the issue might be the fact that I am trying to transcribe one string variable into a second string variable lol.
So I guess the question is, is there another way I can code this? or should I bear with the never-ending loading bar lol
Thanks in advance beautiful people.
Hi! It seems like a really interesting interrogation!
Can I ask that you share the code in the format?
You can put them in a code indent for us to see the actual formatting to help try figure out the issue with three grave `
(key to the left of 1 on keyboard) before and after the code.