If not clauses not working for me

can someone help me with my if not clause. i have a set up with a series of if(var) #option and the last one is if not(var) #option and it’s giving me an error
**Edit: Resolved. not clauses are dumb and have to have their own line so
if not (var) #option should be
if not (var)
#option

because screw how literally every other function works, not wants to be a special snowflake

@seraphimnoted
Have you tried using this?

*if not (var) #option

Because it looks like you are writing it like this:

*if not(var) #option

tried both, but neither worked

it gives me error “couldnt extract another token”

@seraphimnoted
This is from the wikia:

Invalid expression, couldn't extract another token
 
 If this error occurs, it means you've used characters that don't exist in the english language. Note that most programming languages require you to only use alphanumeric characters that exist in the english language (which means if you use the "alpha" character from the greek alphabet, you'll encounter this error).

You could also try refreshing the page, sometimes it is that simple.

#Attack the bastard!
How will you attack him?
*choice

        *if (gun) #Shoot him!
            You pull your company issued nine millimeter out of its holster and go to aim at the stranger...                    
            *goto confrontation
        *if (mace) #Pepper spray him!
            After a few of the people around you go a bit too friendly for your liking you figured this would be the best personal defense weapon. You ready your can of mace...
            *goto confrontation
        *if (taser) #Tase him!
            In your career things can get a bit chancy at times so you decided to take no chances and armed yourself with a state of the art taser! You ready the taser in your palm and prepare stun him...
            *goto confrontation
        *if (tools) #Hit him with a hammer!
            After a long days work you bring your tools home from work. You keep the set on your hip and today it seemed to work to your benefit! You pull out a hammer and ready yourself to swing...
            *goto confrontation
        *if not (weapon) #I have no weapon.
            You have no weapon.
            *goto attack

thats what my code looks like

@seraphimnoted
There we go, this should work.

How will you attack him?
*choice
  *if (gun) #Shoot him!
   You pull your company issued nine millimeter out of its holster and go to aim at the stranger...                    
   *goto confrontation
  *if (mace) #Pepper spray him!
   After a few of the people around you go a bit too friendly for your liking you figured this would be the best personal defense weapon. You ready your can of mace...
   *goto confrontation
  *if (taser) #Tase him!
   In your career things can get a bit chancy at times so you decided to take no chances and armed yourself with a state of the art taser! You ready the taser in your palm and prepare stun him...
   *goto confrontation
  *if (tools) #Hit him with a hammer!
   After a long days work you bring your tools home from work. You keep the set on your hip and today it seemed to work to your benefit! You pull out a hammer and ready yourself to swing...
   *goto confrontation
  *if not (weapon) #I have no weapon.
   You have no weapon.
   *goto attack

Formatting makes the text look weird :confused:

How are you setting weapons?

*set gun true
Or
*set weapon “gun”

That is actually a good question… I haven’t thought about that!

whats different? i want to be able to fix this by myself in the future

set gun true
set weapon true

I just tried to rewrite your code in a “cleaner” way to make sure that you got everything right about the variables. If this doesn’t work that means something is wrong with your variables.

Edit: Ninja’d by FairyGodfeather :smile:

1 Like

my variables are fine. something is wrong with the not clause. i put it in how you gave it to me and got the same error as before. i delete the word not and it works

From the wiki

N.B: *If not (var) will work correctly only if this check occupies a line of its own. For example, in the following code the 'not' will be completely ignored and would actually display that #Option text if (var) is in fact true:

*choice

  *if not (var) #This option to be displayed

    *goto next
In order to work correctly, that code should actually be written as:

*choice

  *if not (var)

    #This option to be displayed

      *goto next

Or use *if (weapon = false)

2 Likes

thanks, i should have checked the wiki, but i appreciate it! I’ll learn to read in the future i promise!

Ballmot got the answer at the exact same moment I did. (You didn’t need to delete your post, @ballmot).

The wiki’s a really good resource.

Honestly, I think I just need to spend less time here. I usually leave the forum page open on my tablet while working in my game at the same time, but it can get very distracting.

@Ballmot No! You’re doing a lot of good to help others. I didn’t mean to ninja you. Sorry.

Okay I know it does do awful things to productivity, but you’re being a lot of help.

2 Likes

This works for me:

*if (not (var)) #option

Wouldn’t it make more sense to put the “*if not (weapon)” above the choices altogether? If I don’t have a weapon, I evidently go directly to the “attack” sequence. If I do have more than one weapon, I can choose which one to use and go to the “confrontation” sequence, but it doesn’t make a lot of story sense to drop me into choosing a weapon if I don’t have one.