# Startup Boolean set to false triggers error on test

**URL:** <https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978>\
**Category:** ChoiceScript Help\
**Tags:** boolean, startup, choicescript\_stats\
**Created:** [April 12, 2025, 6:31pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978 "2025-04-12T18:31:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 6:31pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/1 "2025-04-12T18:31:52Z")

</div>

Hello all!

I’m doing a little challenge this weekend and crafting my first attempt at a game. This morning’s timesuck has been an error I’ve been getting in VSCode (with the choicescript extension) that tells me actually nothing when I attempt to run the game other than that there’s an error on the line that holds the following code:

```choicescript
*create trait_optimist false

```

Earlier in the startup file, I created the related numeric variable that will be used to trigger the above boolean at a certain threshold:

```choicescript
*comment PERSONALITY TRAIT TRACKING

*create trusting 50

*comment PERSONALITY TRAIT STAT CAPS
*if trusting >=100 
    *set trusting 100
*if trusting <=0 
    *set trusting 0

```

I reference it on the stats page as

```choicescript
*if (trusting>=80)
    *set trait_optimist true
    *comment INSERT COPY

```

Any insight would be appreciated! I’ve been reading through the available posts, but I haven’t found an exact answer.

I’ve deleted the boolean forming text, cleared the formatting, and then retyped it out - that didn’t work.

These trait booleans are set to false in the startup (and I’ve set them to trigger to true on the stats page according to numeric variables that are affected by choice in prose. Perhaps that’s the issue?)

These exist because I would like the stats page to be narrative instead of numerical. So, eg, a player with a trusting stat 80 or above would have their trait\_optimism set to true on the stats page, which would then show a sentence like “You tend to believe the best of people, and you’re not afraid of trying again if proven wrong” instead of just showing the numerical value of the trusting variable (Is there a larger issue with this, perhaps, that I’m not seeing?)

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [April 12, 2025, 6:37pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/2 "2025-04-12T18:37:02Z")

</div>

As far as I’m aware of you either can’t or shouldn’t set stats on the stats page, but I’m not sure if that’s what’s causing this issue. To test it, could you remove that code from the stats page and set it after trusting is raised instead?

Edit: The stats cap code also won’t work unless it’s run after every time the trusting stat is raised, by the way. You could put that code and the bit that’s now on the stats page in a gosub or gosub\_scene, and then refer to it every time the trusting stat is raised rather than having to type or copy the whole thing over and over.

---

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 6:48pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/3 "2025-04-12T18:48:29Z")

</div>

Thank you! I’ll absolutely be moving those caps over to a gosub or gosub\_scene then!

And re the main error: I took out the _if (trusting\>=80)_ bit from the stats page and the same error occurred on the aforementioned line. I guess I should note that these create traits and their stat page thresholds also didn’t trigger an error when I was fiddling with it last night, so I’m a bit lost.

Edit: Except!! I totally added choices that affected this variable this morning. I’ll have to dive more into that.

I’ll go read up on gosubs and see if the answer maybe also lies there!

---

<div class="post-metadata">

**Author:** ![LiliArch](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/liliarch/32/120749_2.png) [@LiliArch](https://forum.choiceofgames.com/u/LiliArch)\
**Post date:** [April 12, 2025, 6:58pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/4 "2025-04-12T18:58:22Z")

</div>

> [@Cecilia\_Rosewood](#):
>
> As far as I’m aware of you either can’t or shouldn’t set stats on the stats page

You _can_, they just don’t take effect right away (if you return to the game and not just need them to show the stats page).

> [@Clover667](#):
>
> And re the main error:

What does the error message _say?_

---

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 7:14pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/5 "2025-04-12T19:14:29Z")

</div>

The error message in total reads “error on line 102,” which is what holds the create trusting boolean. For other errors, it’s been more detailed, like unexpected indent change or a variable not being defined, which is why I’m a bit more lost on how to fix this one.

Edit! TURNS OUT my coding program, though set to wrap the text before the edge of the visible window, slid the error message all the way to the right, making it only visible if I extend my typing window across two screens. BUT I found the rest of the error message, which says “invalid create instruction, only allowed at the top of startup,” so it seems @Cecilia_Rosewood’s instincts were solid!

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [April 12, 2025, 7:56pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/6 "2025-04-12T19:56:16Z")

</div>

Vague errors are often related to the line above or below where it declares the error. It might be an indentation error, but it could also be something else.

Global variables (the ones made using the create command) also need to be made at the top of the .startup file, and iirc the block of create commands can’t be interrupted (blank lines are fine as long as they’re indented the same as the create commands), so it might also be because you put a comment between two create commands, or because it’s not in the right file.

---

<div class="post-metadata">

**Author:** ![Winner87](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/winner87/32/246468_2.png) [@Winner87](https://forum.choiceofgames.com/u/Winner87)\
**Post date:** [April 12, 2025, 7:57pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/7 "2025-04-12T19:57:42Z")

</div>

> [@Clover667](#):
>
> error on the line that holds the following code:
> 
> ```choicescript
> *create trait_optimist false
> 
> ```

Did you tried to run with variations, like:

```choicescript
*create trait_optimist "false"

```

Or

```choicescript
*create trait_optimist 0

```

```choicescript
*set trait_optimist false

```

Or

```choicescript
*create trait_optimist false

```

```choicescript
*temp testbool false
*set trait_optimist testbool

```

?

---

<div class="post-metadata">

**Author:** ![LiliArch](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/liliarch/32/120749_2.png) [@LiliArch](https://forum.choiceofgames.com/u/LiliArch)\
**Post date:** [April 12, 2025, 8:09pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/8 "2025-04-12T20:09:19Z")

</div>

> [@Winner87](#):
>
> ```choicescript
> *create trait_optimist 0
> 
> ```
> 
> ```choicescript
> *set trait_optimist false
> 
> ```

You should absolutely _not_ mix up what type a variable is.

> [@Cecilia\_Rosewood](#):
>
> so it might also be because you put a comment between two create commands

Other games put \*comments between variable declarations, so I don’t think it’s _that_.

---

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 8:11pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/9 "2025-04-12T20:11:17Z")

</div>

I haven’t! I’ve steered away from turning a boolean into a string variable! I’ll have to check it out

---

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 8:15pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/10 "2025-04-12T20:15:44Z")

</div>

I’ll absolutely look around the error line a bit closer then! I tried just deleting to what happens, and the same vague error floats to the next line or the new 102.

But I have seen plenty of comments in startup text that seem to work fine when running games, and it’s such a helpful way to keep organized that I dont want to lose it

---

<div class="post-metadata">

**Author:** ![LiliArch](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/liliarch/32/120749_2.png) [@LiliArch](https://forum.choiceofgames.com/u/LiliArch)\
**Post date:** [April 12, 2025, 8:58pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/11 "2025-04-12T20:58:47Z")

</div>

I just realized, is that if-block in the middle of creates? _That_ could be a problem.

---

<div class="post-metadata">

**Author:** ![Clover667](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/clover667/32/242117_2.png) [@Clover667](https://forum.choiceofgames.com/u/Clover667)\
**Post date:** [April 12, 2025, 8:59pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/12 "2025-04-12T20:59:28Z")

</div>

I think that’s exactly what it was!! I’ve removed them, and everything is running beautifully. I’ve put them back on the stats page, and it seems fine for now!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/choiceofgames/original/3X/e/f/efe1497a762edecdb6d569a1c4abee87508bf002.png) [@system](https://forum.choiceofgames.com/u/system)\
**Post date:** [April 13, 2025, 8:59pm UTC](https://forum.choiceofgames.com/t/startup-boolean-set-to-false-triggers-error-on-test/167978/13 "2025-04-13T20:59:34Z")

</div>

Closed on April 13, 2025, 8:59pm UTC

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.
