Error message: something about it having to be true or false, string, or valued

#Stay quiet and mind your buisness
You stay quiet and mind your buisness, no matter how many people tried to talk to you.
*goto teacherarriv
*selectable_if (Ambitious) #I need to learn something. I want to be the best!
While studying, you learn more about Taijutsu.
Your taijutsu skill increases slightly
*set Taijutsu %+5
*goto teacherarriv
*selectable_if (confident) #Join a conversation
*goto teacherarriv

The “Ambitious” and the “Confident” are the personality trait that the player has chosen. The traits they choose unlocks different choices and can change their story completely.
BUT, everytime I choose and option it says this: Non-existent variable ‘ambitious’.
Then, once I *create ambititous it says something about it having to be true of false, string, or valued.


when you create a variable you need to set it no matter what basically with the way you have it set up
if its a trait they picked you would do

*create Ambitious false
*create Confident false

Then give them a choice in which one they want if they select confidence then have it set to true and if they chose ambitious that variable gets set to true.


*create ambitious false

at the beginning (the “false” tells ChoiceScript that you want the variable to be true/false, also known as a Boolean).

It’s also good practice to keep your variables lower-case (e.g. ambitious, taijutsu) – CS can usually swallow a capitalized variable, but apparently sometimes it causes problems.

Edit: @faewkless, you bloody sneaky ninja, you.

getting to ninja you along with being able to make a game makes learning choicescript 150% worth it. :laughing:

1 Like

I did it to a few just to test it out because i have ALOT of traits, but it still says the “must be true/false, valued, etc” thing

when you created it?

you made sure you created the stats before you put any of the choices and actual story right.
making the create stat is the third command you should use after title and author.

*title something
*author somebody 
*create ambitious false
*create confident false
game story stuff
 #I am confident
  *set confident true
 #I am ambitious
  *set ambitious true

Kinda like that right?

I did it after I created it it, but the results shouldn’t be any different

In choice-script you have to make all the permanent stats before you make any choices or write the game. the only exception would be using the *comment command to write something that only someone actually looking at the coding can see.


permanent variables
everything else

In choicescript thats ordering you have to follow (except for the comments command like I said but only people that read the code can see what you write after it)
Choicescript is relatively simple to learn but very picky. (its also why you cant use both spaces and tabs it gives you an error)

so you have to create the variable and give it a value before you can use or change its value.

so set the variables then give a choice that changes them like in the example from my previous post.

AHHHH CRAP. So…Im screwed

you’re gonna have to create all the traits variables (and set them) before you write the story or put choices and then set them then you can actually start putting the story and such down.
It’s tedious yea…

So do I need to startover??!!

Basically yes but if you follow the correct order and put (title,author,scene_list,permanent variables,story) then this kind of thing will most likely never happen again.

I suspect not.

No – you just need to add something to your startup file. That’s not the same thing – it shouldn’t require tossing out anything you’ve already written, which is what I think of when I read “startover”.

You won’t know at the outset all the variables you’re going to need. But as you write, whenever you find the need for a new variable in your story, just open up your startup.txt file and *create it back at the beginning.

When you *create it, you’ve got to *create it with some value which lets ChoiceScript know what kind of variable it is. If you say

*create ambitious true

the game knows “ambitious” is a Boolean (true/false) variable. If you say

*create money 1

it knows “money” is a numeric value. And if you say

*create name "Jasper"

it knows “name” is a string – a string of letters or numbers, like a word.

If you just *create without giving the variable some value, CS will cough up the error you’ve been seeing, where it tells you it doesn’t know if “ambitious” is supposed to be true/false, a number, or a string.

But when I did the *create ambitious false, I came up with that error

Want to share the code – both of where you’re creating the variable, and where you’re using it? That might help. (I know you shared a snippet above, but it’s the *create point where seems to be where things are falling down.)

Cant. I deleted it. Not the entire thing, just the *create. I wanted to start from scratch.

Well, if you have the problem again and can’t fix it, post the code here before you delete it.