Conflicting code?


#1

Hello!

I’m trying to insert a name variable, with the code

 *create Name "Unknown"

For the user to select their name later on. However, when I put this, it says “Invalid Expression; Can’t extract another token”. So I take out the quotation marks and it says it need to be a quoted string. Assistance please?


#2

Where did you put this? Is it in your startup.txt? The *create command is only valid in startup.txt (although you can use *temp in other scenes, but the *temp variable is reset if you leave that scene).

Also it’s generally encouraged to use lowercase for all variables, because variables are case sensitive. It’s easy enough to *create Name "Unknown" and then, later, type *set name "Audrey" or ${name}, which would return an error.

I hope that helps!


#3

It is in startup.txt, and that’s exactly what I’m doing, but it says it can’t extract another token. @Flogan


#4

What program are you using to code? Is it possible you’re accidentally using ‘smart quotes’, which are curvy, instead of straight quotes?

Also, can you copy the relevant passage? Are you having trouble with any of the other variables?


#5
> *title Monsters
> *author Shawn Reed
> *scene_list
>   startup
>   indoctrination
>   ending

> *create name "unknown"

Just to show you an example… this is the beginning of my story, which works fine. Do you have the title, author, and scene list at the beginning? Followed by the *create variables? Also, do try Fiogan’s suggestion- copy/pasting from an old word processor document into notepad could cause trouble such as the curly parens Fiogan mentions.


#6
 *title My First ChoiceScript Game
 *author Guess who. It me.
 *scene_list
   startup
   animal
   variables
   gosub
   ending
   death

 *create Name "Unknown"
 *create Leadership 50
 *create Strength 50
 *create Honesty 50

 Welcome to your very first ChoiceScript game!

This is the EXACT coding.


#7

That worked, thank you very much!


#8

From curiosity, which solution worked for you?


#9

Changing it from the “Smart Quotes”.