Help! Non-existent variable 'love'


#1

I’ve already

*create love 0
*create compassion 0

at the start up. Then during my game, it says

  #Let her come close. 
    *set love + 10

    Your love score is: ${love} 

But it pops up saying 'Non-existent variable ‘love’

However, just a moment ago, I used:

  #Try to save her. You don't want blood on your hands.
    *set compassion + 10

    Your compassion score is: ${compassion}

And it worked fine.

I can’t figure out the problem - please help! Thank you!


#2

attempts to stop laughing at the thread title long enough to offer advice

Nope- just by what you’ve said, I don’t see what the problem is either. Unless you’ve got a typo involved in the actual coding, which is all I can think of right now.


#3

Could you copy and paste the relevant lines from your startup file, please? Maybe that’d help us catch the bug.


#4

Just a random question; did you make sure to save in the startup file?

If you did, then maybe it’s choicescript: sometimes it makes funny things that don’t have any sense, even when the code is properly written. In that kind of case, it’s better to just shut it off for a day and come back the next one.

And if not, try it like this:

In the startup file:

*create love 0 *create compassion 0

Then in the game file:

[code]
#Let her come close.
*set love +10

Your love score is: ${love}
*goto somewhere

*label somewhere [/code]

 #Try to save her. You don't want blood on your hands.
   *set compassion +10

   Your compassion score is: ${compassion}
   *goto somewhere

*label somewhere

Try to write +10 together, without spaces.


#5

Wow, from the title I assumed this was some sort of snarky commentary on love and the human condition. :wink:


#6

Oh, lol sorry! I didn’t even think of that :blush: I’ll label my titles better from now on! :sweat_smile:


#7

I’ve tried doing the +10 no spaces but it didn’t work! And now, my compassion code isn’t working … even though it worked fine just yesterday before I posted this :cold_sweat:


#8

Oooops, my bad.

It’s a strange thing, though; this is the first time I have ever seen someone use ${} for something else than pronouns or names. Usually people use the choice stats page to show the player’s stats rather than in a in-game scene.


#9

Here’s my relevant lines from my startup file:

*title My First ChoiceScript Game
*author Anonymous
*scene_list
startup

*create intelligence 0
*create compassion 0
*create love 0
*create social skills 0

Now, when I went back to it, my compassion coding isn’t working either even though it worked just fine yesterday (before I posted this) :disappointed_relieved:


#10

Thanks! When you post code, you can use <pre> and </pre> to keep your formatting, so we can see the spacing.

So, you have this:

*title My First ChoiceScript Game
*author Anonymous
*scene_list
  startup

  *create intelligence 0
  *create compassion 0
  *create love 0
  *create social skills 0 

Spaced like that? If so, you need to move the *creates to your left margins - not indented, like this:

*title My First ChoiceScript Game
*author Anonymous
*scene_list
  startup

*create intelligence 0
*create compassion 0
*create love 0
*create social skills 0

#11

Thank you so much!!! Wow, an easy fix - I feel so dumb :sweat_smile:

Everything is working perfectly now! Thank you again!! :blush::blush:


#12

You’re welcome! Please don’t feel dumb! I’ve been coding for about a year now, since the start of @Lordirish’s CS Comp last year, and I’ve discovered all kinds of fun ways of breaking my game. It did get much easier as I went along, though. ( :


#13

Also remove the space in the varible social skill, use social_skill instead.


#14

Story of my life. :disappointed: