Help setting names (RESOLVED)


#1

Currently working on a script and I am having difficulty with the user setting their name. I have 2 problems.

  1. I can’t seem to create a name variable without inserting a value, otherwise it shows me an error message. Below is my code:

Page: startup.txt
*create Name “”
*create Surname “”

Page: choicescipt_stats.txt
{b}CHARACTER{/b}:
*stat_chart
text Name
text Surname
opposed_pair Morality
Ruthlessness

ERROR: startup line 29: Invalid expression, couldn’t extract another token: “”

If i remove the speech marks and set the value to 0:
Page: startup.txt
*create Name 0
*create Surname 0

Then I don’t receive any error message, however it looks like this:

How do I input a name without having to insert a value?

  1. I can allow a user to create their own name using input_text Name, however i can’t seem to give them the choice to choose their own.

Page: name.txt
What is your name?
*choice
#Michael
*set Name Michael
Hi {Name} *page_break *goto surname #None of these. *input_text Name *page_break *goto surname *label surname What is your surname? *input_text Surname Hi {Name} ${Surname}
*finish

The second choice “none of these” works fine, however with the first choice I can’t set my name to Michael. I have tried creating Michael as a variable, but that also does not work.

Thanks a lot for any help! I really want to get back to just writing, but these little hiccups are frustrating. I’ve already got to grips with a fair bit of using choicescript, i feel like this is an easy problem, but i just can’t wrap my head around it.
Thanks again.


#2

For one, it looks like you’re using curly inverted commas, otherwise known as ‘smart quotes’, like so:

*create Name “”
*create Surname “”

You need straight ones, or your code will break:

*create Name “”
*create Surname “”

Like that instead!

You also want to use

*set Name "Michael"

Again with the straight inverted commas.

If you just type Michael, the code will assume that Michael is another variable. The “” around it tells the game it is a data field (I might not be using the right technical language here, but I think that’s the general idea.)

What application are you using to code? You’ll want a text editor, not a word processor, or you’ll probably find that you’ll continue to have odd formatting errors here and there.


#3

Hi, in the stats screen, if you want the name to be displayed, you have to code it like in the other scene: ${name} :slight_smile:


#4

Hey, thanks for the quick reply.

I thought it might be the font. I am currently using textedit for mac.

Could you recommend a font to use, please?


#5

When I’m using a text editor, I generally use TextMate on the Mac because I find it generally does fewer annoying things to my formatting. (Otherwise I use @CJW’s ChoiceScript IDE, which will be released publicly soonish I think! Good news all around.)

Anyway, the ‘smart quotes’ is a formatting problem—it would happen regardless of font. You’ll want to look at your settings and make sure ‘change straight quotes to smart quotes’ is disabled. Check under edit/substitutions/ and make sure ‘smart quotes’ is not checked. That should do it, I think.


#6

@Fiogan, thanks a lot it was the speech marks that were causing an issue! I’ll try your advise and change the settings.

Thanks again, much appreciated. !


#7

@Fiogan is a true Lady isn’t she. Thanksgiving is the day I give thanks for friends like her - and @Snowpanther - kitty is always so helpful.

ok. Back to the family - talk to everyone tomorrow.