Hey guys, I have some more questions. The title describes it all. I wanted to know how to have long-standing decisions, like if it’s an if thing, but how to write it. To expand on it, I wanted to know how, say, if someone decided to kill a character that another person did NOT choose to kill, how to write that. Do I say *if killed blahblah, then blah? I haven’t written this out but it’s for future reference.
Then, for money, all I’ve been able to figure out is to do it as a percentage. But in Heroes Rise money isn’t even on a bar. It’s just there and then it decreases. How do I code that and then inform the player when they lose or gain money?
Finally, I wanted to know how to grey out options, like if you don’t have enough of certain stats or you’ve already done the thing. Ie, say the character visited a palace and now is visiting a graveyard. I don’t want them to visit the palace once they already have. How do i code that?
I think that’s all the questions I have, for now. Thank you for your help!
With that last one: the way your stats are displayed (as a percentage, opposed stats on a bar, just a number, etc) depends on what’s in your choicescript_stats.txt file.
You use the command *stat_chart to start displaying stats, and then use terms like “text,” “opposed_pair,” and “percent” to display the stats the way you want to.
Awesome! Thank you guys so much. I did have some more questions: I recently learned how to name names and make genders a thing, but how do I go about making those stats (maybe not stats, but to make them show up on the stat screen?), and in terms of the name, making others say it? Is it similar to when people input their own name? I know I could simply do “*set name vincent” in the proper way, but I’d rather know if there’s a basic way to do it. Does that make sense?
It can be a little hard to put it all together for the first time, so here’s a basic example of how to set and display name and gender in a tiny complete game (try running it, if you like).
In startup.txt:
*comment It's a good idea to create these variables in advance
*create my_name "Unknown"
*create my_gender "unspecified"
*comment Create some sample stats
*create strength 10
*create intelligence 20
What's your name?
*choice
#Vincent
*set my_name "Vincent"
*goto pick_gender
#Alice
*set my_name "Alice"
*goto pick_gender
#Something else.
Please enter a name:
*input_text my_name
*goto pick_gender
*label pick_gender
Nice to meet you, ${my_name}. And what's your gender?
*choice
#Male.
*set my_gender "male"
*goto wrapup
#Female.
*set my_gender "female"
*goto wrapup
#None of your business.
*comment Sometimes you may not actually want to set a new value!
*goto wrapup
*label wrapup
Okay, so your name is ${my_name} and your gender is ${my_gender}.
*finish
In choicescript_stats.txt:
*stat_chart
text my_name Name
text my_gender Gender
percent Strength
percent Intelligence
More questions! Is there a way to combine if statements? Like I had two requirements being fulfilled and wanted to combine them, or do I just need to type them each out separately?
I don’t recommend greying out options. Not many people know this, but Inspect Element (of F12 Developer Tools) allows you to bypass them. Making them hidden removes the options from the HTML code to be tampered with, since choices act as a temporary redirect.
@Hikaru
Even on official apps, not just WIPs on browsers?
Either way, I like greyed out options more because they let the reader know how many options they’re actually given, and that if they did something differently, they’d be able to choose that option.
@Hikaru Good to know that’s possible, but since it’s already just about as easy to view the entire source of most Choicescript games in a browser, I wouldn’t think that authors should be too concerned about that.
@Hikaru I’d have to disagree as well. As Sam points out, greying out select options can serve a useful purpose in a game. Moreover, being a solo experience, if a player chooses to ‘cheat’ in any way then, well, they’re really only cheating themselves… *shrug*
@Hikaru
You can also use the browser console to update your stats to any value you like.
As said, people are always going to find ways to cheat, if it’s a single-player game, I say leave them to it. If that’s what they enjoy.