Line 13: Non-existent command 'selectable_if'


#1

The Error: line 13: Non-existent command ‘selectable_if’
I am using Tabs. I am assuming that what you’ll see is not spaced right.

NOTE:
The // comments is NOT in my text file, but I’m only putting it in here, so you’ll know how many tabs I used. :smiley: Thanks!

The Code:

Walmonty - This is a sample Store to see what works. // 0 tabs

*label store //0 tabs

This is the store. You have ${pounds} pounds. Would you like to buy, sell or leave? // 0 tabs

*choice // 0 tabs

#Buy  // 1 tabs

	You have ${pounds} pounds . // 2 tabs

	\*selectable_if ((storee = true) and (pounds >= 20)) #Cloak (£20) // 2 tabs

		\*set pounds - 20 // 3 tabs

		\*set cloak +1 // 3 tabs

		You bought Cloak for £20. // 3 tabs

	\*goto store // 2 tabs

	#Nevermind // 2 tabs

	\*goto leave // 2 tabs

#Sell // 1 tabs

	You have ${pounds} pounds. // 2 tabs

	\*if (cloak) #Cloak (£15) // 2 tabs

		\*set pounds + 15 // 3 tabs

		\*set cloak -1 // 3 tabs

		You sold your cloak for £15. // 3 tabs

		\*goto store // 3 tabs

	#Nevermind // 2 tabs

	\*goto leave // 2 tabs

#Leave // 1 tabs

	\*goto leave // 2 tabs

*label leave // 0 tabs


The mygame.js file (part of)

stats = {
leadership: 0 //finished a project, took control of project
,strength: 20 //working out with weights
,pounds: 500000 //money made in investments, businesses
,cloak: 0 //Cloak (because you can’t title a book.)
,storee: true //dummy variable for select_if
};

Thanks in advance! :smiley:


#2

You cant use *selectable_if with two vars only one but you can do two if you just use *if
I hope this helps below


Walmonty - This is a sample Store to see what works. 
*label store 
This is the store. You have ${pounds} pounds. Would you like to buy, sell or leave? 
*fake_choice
  #Buy 
    You have ${pounds} pounds.

    *selectable_if (pounds >= 20) #Cloak (£20) 

      *set pounds - 20 

      *set cloak +1 

      You bought Cloak for £20. 

      *goto store 

    #Nevermind

      *goto leave

  #Sell 
    You have ${pounds} pounds. 

    *if (cloak) #Cloak (£15) 

      *set pounds + 15 

      *set cloak - 1 

      You sold your cloak for £15. 
      *goto store
    #Nevermind 
      *goto leave 
  #Leave 
    *goto leave

*label leave 


#3

@2Ton
Are you sure you can’t use as many conditions for *selectable_if as with regular *if? It’s working fine for me.

@velvelajade
You’re missing a few choice commands in there, as well as some indentation issues. Corrections in line after the "=="s:


Walmonty - This is a sample Store to see what works.
*label store
This is the store. You have ${pounds} pounds. Would you like to buy, sell or leave?
*choice
    #Buy // 1 tabs 
        You have ${pounds} pounds . // 2 tabs 
        *choice == need a choice here
            *selectable_if ((storee = true) and (pounds >= 20)) #Cloak (£20) // 2 tabs ==should be three tab
                *set pounds - 20 // 3 tabs == should be four tabs
                *set cloak +1 // 3 tabs == should be four tabs
                You bought Cloak for £20. // 3 tabs == should be four tabs
                *goto store // 2 tabs == should be four tabs
            #Nevermind // 2 tabs == should be three tabs
                *goto leave // 2 tabs == should be four tabs
    #Sell // 1 tabs 
        You have ${pounds} pounds. // 2 tabs 
        *choice == need a choice here
            *if (cloak) #Cloak (£15) // 2 tabs == should be three tabs
                *set pounds + 15 // 3 tabs == should be four tabs
                *set cloak -1 // 3 tabs == should be four tabs
                You sold your cloak for £15. // 3 tabs == should be four tabs
                *goto store // 3 tabs == should be four tabs
            #Nevermind // 2 tabs == should be three tabs
                *goto leave // 2 tabs == should be four tabs
    #Leave // 1 tabs 
        *goto leave // 2 tabs 
*label leave // 0 tabs 


#4

@CS_Closet

Oddly for me it freaks out and it says something about not expecting extra operation for me :confused: I wonder if its just me or do other people have this problem


#5

@2Ton, you probably have issues with concatenation. You can do as many you like, though all conditions have to fit within one set of parenthesis, grouped by ones or twos.

E.G.


*selectable_if (president)

// One variable - must be president. Easy.


*selectable_if ((president) and (leadership>=25)) 

// Two variable requirements, grouped using ‘and’, but both contained in the outermost parenthesis.


*selectable_if ((not(president)) or ((president) and (leadership<25))) 

// Two kinds of requirements - one has a singular condition (not president), and other requires two conditions (is president, but leadership isn’t high enough) - in the end though, all of them are in a single set of parenthesis.

If your using N++, it’ll help keep track of which each opening parenthesis corresponds to a closing one.


#6

@Caddmuss

OH! I see!

this is what i was doing

*selectable_if (president) and (leadership>=25)

without the needed additional parenthesis! Okay so I learned something new and very useful today thank you Caddmuss!


#7

Also, they can only be in groups of two, technically. You can do an unlimited number, but they each have to be grouped in pairs using an and… It’s confusing to say…

WRONG:
((president) and (leadership>=) and (awesome))
//It’s hard to explain why, but this is just wrong.

RIGHT:
(((president) and (leadership>=)) and (awesome))
// This is right because there’s technically only two requirements, though the former requirement has two of it’s own requirements to be met as well.

You can probably do as many requirements as you like, they just have to be done in pairs.


#8

@2ton and @CS_Closet Thanks!

I changed \*if (cloak) ... to \*if (cloak > 0) ... so I don’t get a neither true nor false error. :wink:

How are you getting the yellow “this is code” box? thanks!


#9

@velvelajade

`

*choicescript here

`


#10

I want to offer a huge thankyou. I’ve been having so much problems with if statements and selectable ifs. I think that this might help me a bit too.


#11

@FairyGodfeather

IKR? this will save alot of time on the extra coding I was doing


#12

Thanks! I’ll use The PRE tag. I’m so used to using code tags. lol