Dorano1
December 20, 2016, 12:12am
1
I’m having difficulty with the input_text function. It’s the beginning of the game, so I’m doing the typical ChoiceGames thing and having the player input the character’s name. When I test it, everything goes fine until I click “Next” after typing in a name.
(Another note: I’ve added the name to the stats screen, and when I check it after the error comes up, the name’s in place)
So…what gives?
Gower
December 20, 2016, 12:17am
2
Can you paste in the relevant code?
3 Likes
You’re going to have to explain what the error you’re getting is.
Dorano1
December 20, 2016, 3:01am
4
The error I’m getting is: startup line 95: Invalid expression, couldn't extract another token: “$!{player_name}”
The beginning variables are coded like this:
*create player_name 0
*create Leadership 50
*create Intimidation 50
*create Reputation 60
*create Charisma 50
*create Survival 50
*create Martial 60
*create DogSaved false
and the input is coded like this:
Type your name here
*input_text player_name
*set player_name “$!{player_name}”
The error doesn’t show up until I actually type something in.
1 Like
Fiogan
December 20, 2016, 3:14am
5
I’m not positive, but perhaps it’s because you created player_name as a numeric variable but you actually want it to be a string? Try:
*create player_name ""
and see if that helps perhaps?
EDIT: Oh I lied! It’s because you’re using curly inverted commas—you want ‘straight quotes’, not ‘smart quotes’.
This:
""
Not this:
“”
3 Likes
Gower
December 20, 2016, 3:28am
6
I suspect both the curly punctuation and creating player_name as a numeric variable are the problems.
Good catch on the curly inverted commas, @Fiogan ! I would not have thought of that.
1 Like
Dorano1
December 20, 2016, 4:15am
7
Oh…TextEdit automatically turns straight quotes into curly quotes. Do you know how to fix that?
Fiogan
December 20, 2016, 4:21am
8
Try checking under edit/substitutions/ in the menu and make sure ‘smart quotes’ is not checked. That should do it, I think.
1 Like
Dorano1
December 20, 2016, 6:13am
9
Ah, that fixed it - thanks!
2 Likes