# Long-standing decisions, money, and greying out options

#1

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!

#2

For the first, you create a variable:

*create jack_killed 0

If they choose to kill Jack,

*set jack_killed 1

And thereafter, at any point in the game,

*if jack_killed = 1

you give them text or choices that depend on having killed Jack.

#3

to grey out something, you put

*selectable_if (blablabla) #lalala

so for example, if you wanted to pick a lock, you could put

*selectable_if (lock_pick) #Pick the lock with my lock pick

#4

For money you simply create a numerical variable and use *set command to increase or decrease the amount of money.

*create money 400

When you want the player to get money, you do this:

*set money +33

When you want the player to lose money, you do this:

*set money -33

#5

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.

#6

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?

#7

Whenever you set something with “” you can use the \${ } anywhere, whether it’s a word or number.

So and so’s strength is at \${strength}. If you had set strength as
*set Strength 1

Same as if you used a word. Or name for that matter.

*set stat “strong”

Then when using it-
So and so is \${ stat}

#8

To input a text there is the command *input_text Example

``````
*input_text name
Hello \${name} Welcome.

``````

#9

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

*choice
#Vincent
*set my_name "Vincent"
*goto pick_gender
#Alice
*set my_name "Alice"
*goto pick_gender
#Something else.
*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
*comment Sometimes you may not actually want to set a new value!
*goto wrapup

*label wrapup

*finish

``````

In choicescript_stats.txt:

``````*stat_chart
text my_name Name
text my_gender Gender
percent Strength
percent Intelligence

``````

#10

Awesome. Thank you, all of you.

#11

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?

#12

*if ((bla) and (bla))

You just have to make sure each requirements has a unique set of parenthesis.

#13

I have some examples in an earlier message I sent you specifically the one about the palace and graveyard

#14

Thank you again, my friends!

#15

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.

#16

@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.

#17

@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.

#18

@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*

#19

@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.