Having trouble with variables?

Hi. So, this is probably a really stupid question but I am having so much trouble creating variables. It constantly says that I have an invalid token. I have no idea what to put on my variables.txt and I am just totally lost. Coding is confusing to me but I’m trying to power through it. So, to get to the gist of it, how do I create gender variables and relationship percentages and make them stick? I’ve scoured through the forums to try and find an answer to my problem but everything just seems a bit over my head. If anyone could help a newbie out, I would greatly appreciate it.

Can you post an example of what you’ve written, so we can see what you’re doing and what might be wrong with it?

Here’s what I have set at the top of my startup

 *create intelligence 50
*create strength 50
*create health 50
*create reputation 50
*create gpa 50
*create mentality 50
*create male “male”
*create female “female”
*create he “he”
*create boy “boy”
*create his “his”
*create he “he”
*create man “man”
*create name “No"

Here’s what is currently in my stats.txt

*stat_chart
  percent Intelligence 
  percent Strength
  percent Reputation
  percent GPA
  percent Health
  opposed_pair Mentality
    Positive
    Negative
[b] Relationships [/b]
*stat_chart
  percent Family
  percent Unknown
  percent Unknown
  percent Unknown
  percent Unknown
  percent Unknown

And here’s what’s on my variables.txt

*set intelligence 50
*set strength 50
*set health 50
*set reputation 50
*set gpa 50
*set mentality
*set male_true

I just have no idea how to set genders and names and relationships without getting an error code. Gah, I feel so incompetent.

Hmm odd question here but are you using ” in your code or " ?

I’m using " if I’m understanding what you’re saying, haha. I just don’t understand what should be in my variables and stats pages to set genders and names. My traits are fine and they show up in the stats screen, so I’m not too worried about those or anything.

I was just wondering since the code above is showing “ ” and I’m not sure if that actually works. Wikipedia tells me those are double quotes (curly) as opposed to typewriter double quotes.

Incidentally if you’re looking for help https://forum.choiceofgames.com/t/a-basic-tutorial-on-name-relationship-and-gender-variables/

That could be what my word processor uses. I’ll try to copy and paste the " instead of curly quotes and see what happens.

Oh! No don’t use a word processor for coding. You need to use a text editor. Word processors mess things up. You’re better off using notepad than you are any word processor.

I’d suggest Notepad++ which is free and I really, really like. http://choicescriptdev.wikia.com/wiki/Notepad%2B%2B_Syntax_Highlighter

If you’re not using windows then I’ll dig up some of the alternative suggestions.

3 Likes

TextWrangler is an OK free MAC alternative. @aetheria made a syntax highlighter for it: ChoiceScript language module for TextWrangler

1 Like

I have to take the “curly quotes” out of anything I cut and paste from Word and replace with “straight quotes” or it doesn’t work right. Not sure if this is your problem but as mentioned above you probably need to take them out.

I just switched to Notepad++ and it is a billion times better than regular Notepad. :slight_smile:

@Gkkiller Thanks for that. It’s still better not to use a word processor for coding though. They’re just not built for doing code, and writing code in one can add all sorts of problems and errors. .

2 Likes