I keep getting a coding error. Could anyone help me find the problem?

Yeah I figured as much. I’ll just leave them as is.

hmm…I’m getting a coding error here. Could you guys help me?
line 4: invalid expression at char 30, expected OPERATOR, was: var [true]

Ever since he was old enough to do so, you have trained him to transform into


\*temp count 0
\*temp comma false
\*if transformations_pit_viper true 
	\*set count +1
	\*if (count = 3) 
		\*set ", and a pit viper"
	\*if comma
		\*set ", a pit viper"
	\*set comma true
	A pit viper,
\*if transformations_poisonous_toad true
	\*set count +1
	\*if (count = 3) 
		\*set ", and a poisonous toad"
	\*if comma
		\*set ", poisonous toad"
	\*set comma true
	A poisonous toad,
\*if transformations_crow
	\*set count +1
	\*if (count = 3) 
		\*set ", and a crow"
	\*if comma
		\*set ", a crow"
	\*set comma true
	A crow,
\*if transformations_red_tailed_bao
	\*set count +1
	\*if (count = 3) 
		\*set ", and a red tailed boa"
	\*if comma
		\*set ", a red tailed boa"
	\*set comma true
	A red tailed boa,
\*if transformations_hound
	\*set count +1
	\*if (count = 3) 
		\*set ", and a hound"
	\*if comma
		\*set ", a hound"
	\*set comma true
	A hound,
\*if transformations_eagle
	\*set count +1
	\*if (count = 3) 
		\*set ", and an eagle"	
	\*if comma
		\*set ", an eagle,"
	\*set comma true
	An eagle,
\*if transformations_horse'
	\*set count +1
	\*if (count = 3) 
		\*set ", and a horse"	
	\*if comma
		\*set ", a horse,"
	\*set comma true
	A horse,
\*if transformations_ostrich
	\*set count +1
	\*if (count = 3) 
		\*set ", and an ostrich"	
	\*if comma
		\*set ", an ostrich,"
	\*set comma true
	An ostrich,
\*if transformations_crocodile
	\*set count +1
	\*if (count = 3) 
		\*set ", and a crocodile"	
	\*if comma
		\*set ", crocodile,"
	\*set comma true
	A crocodile,
\*if transformations_tiger
	\*set count +1
	\*if (count = 3) 
		\*set ", and a tiger"	
	\*if comma
		\*set ", tiger,"
	\*set comma true
	A tiger,
<pre/>

If you read the error it says the problem is on the line 4 character 30. That lets you pinpoint precisely where it is.

*if transformations_poisonous_toad true

You can do

*if transformations_poisonous_toad=true

or

*if transformations_poisonous_toad

Oh okay. It works now but another error is coming up. It says

line 17: invalid variable name, must start with a letter

I think it’s referring to how there isn’t specific thing that I am setting “poisonous toad,”
to when I used the code

*set “poisonous toad,”

I was trying to get it to appear after
“Ever since he was old enough to do so, you have trained him to transform into”

so that it would list the 3 transformations that the reader chose. I’m not sure how to set it to go there, though.

You always need to set something. If you want to display it instead do ${variable}.

I’d do it a very round about and convoluted way. So I won’t list out how I do it.

The easiest way would be to code up something similar to what you have for your inventory. So if you create a transformations stat, then for each form chosen, do another set with the & sign so add to your list of transformations. You’ll also need to use the code to add in commas. Then you could just do

Ever since he was old enough to do so, you have trained him to transform into ${transformations}

And it would show

Ever since he was old enough to do so, you have trained him to transform into a toad, a crow, and a viper.

Does that make sense? You’re actually more experienced than I am at using the & and comma things. Do you think you can experiment with that to achieve your desired result?

Yeah definitely! It seems a lot easier than what I was trying to do:P thanks again, @FairyGodfeather. So if I use the

${transformations}

I would still have to put this code in order to have the commas and “and” in the right place? except I wouldn’t use the
*set “a poisonous toad”
command of course.


	\*set count +1
	\*if (count = 3) 
		\*set "and a poisonous toad"
	\*if comma
		\*set "a poisonous toad,"
	\*set comma true
	a poisonous toad,
<pre/>

If you hadn’t let me know about the command then it’s a lot simpler than I’d have done too.

Try it out and see. I’m not sure since I’ve never used a system like that.

You’d do the

*set transformations &“a poisonous toad”

though since it needs to know what to set.

So would it look this like this?

*create transformation_tiger $(tiger)

Probably something like this. Not tested though. A little rusty with the ampersand mechanic, find out which part needs adjusting and you’re good to proceed.


*temp form_count
*set form_count 0

*label choose_forms

*choice
    *hide_reuse #Viper.
        *set form_count +1
        *if (form_count = 3)
            *comment When form_count equals the max # of selection allowed, split out of the *choice.
            *set trans &" and viper"
            *goto narrative
        *if (form_count > 0)
            *set trans &", viper,"
        *if (form_count = 0)
            *set trans "a viper"
        *goto choose_forms
    *hide_reuse #Crow.
        *set form_count +1
        *if (form_count = 3)
            *set trans &" and crow"
            *goto narrative
        *if (form_count > 0)
            *set trans &", crow,"
        *if (form_count = 0)
            *set trans "a crow"
        *goto choose_forms
    *hide_reuse #Toad.
        *set form_count +1
        *if (form_count = 3)
            *set trans &" and toad"
            *goto narrative
        *if (form_count > 0)
            *set trans &", toad,"
        *if (form_count = 0)
            *set trans "a toad"
        *goto choose_forms
    *hide_reuse #Hound.
        *set form_count +1
        *if (form_count = 3)
            *set trans &" and hound"
            *goto narrative
        *if (form_count > 0)
            *set trans &", hound,"
        *if (form_count = 0)
            *set trans "a hound"
        *goto choose_forms
    *hide_reuse #Tiger.
        *set form_count +1
        *if (form_count = 3)
            *set trans &" and tiger"
            *goto narrative
        *if (form_count > 0)
            *set trans &", tiger,"
        *if (form_count = 0)
            *set trans "a tiger"
        *goto choose_forms


*label narrative

Ever since he was old enough to do so, you have trained him to transform into ${trans}.

EDIT
All \*if (form_count > 0) should be >1 instead of >0 and the same goes for the check below, form_count=1 instead of =0.

No.

Create is only used in startup.txt. It’s to say to the game “this variable exists”.

Set adjusts the value of a variable, be that making it a line of text, a word, a true/false, or a number.

@FairyGodfeather
so could you explain to me how I’d implement the

$(text)

code into the sentence? I get what I’m supposed to do but I don’t get how to do it.

The sentence being “Ever since he was old enough to do so, you have trained him to transform into”

That’s just displaying the information held in the variable. Like if you do

*create name

*set name Bob

or

*set name Bill

Then code-side you can do

Your name is ${name}

And the player will see what the picked as their name. So if you picked Bob as your name you see

Your name is Bob

And if you picked Bill you see

Your name is Bill.

I looked through the forum and wiki but I can’t find anything on the

${}

command so I’m still confused. My goal is to list the 3 transformations that Beckham is able to perform in the sentence
“Ever since he was old enough to do so, you have trained him to transform into”

so @FcA, your code would work but only if I wanted to add the nouns like “poisonous toad” to the transformation stat, but I’ve already done that along with a description.

${} is just used to show a variable that can change (i.e names, gender pronouns etc)

For example in startup.txt

*create name “Matt”
*create heshe “he”
*create himher “him”
*create hisher “his”

would let me write this during the game.

{name} is {hisher} name, {heshe} is quite popular and people like {himher}.

and it’ll appear in game as

Matt is his name, he is quite popular and people like him.

If I change those variables by a choice

*set name “Claire”
*set heshe “she”
*set himher “her”
*set hisher "her

would change it to

Claire is her name, she is quite popular and people like her.

Oh gotcha.

And I finally figured it out…I use the code


Ever since he was old enough to do so, you have trained him to transform into ${transformations}
\*temp count 0
\*if transformations_pit_viper 
	\*set count +1
	\*if (count = 3) 
		and a pit viper
	a pit viper,
\*if transformations_poisonous_toad
	\*set count +1
	\*if (count = 3) 
		and a poisonous toad
	a poisonous toad,
\*if transformations_crow
	\*set count +1
	\*if (count = 3) 
		and a crow
	a crow,
\*if transformations_red_tailed_boa
	\*set count +1
	\*if (count = 3) 
		and a red tailed boa
	a red tailed boa,
\*if transformations_hound
	\*set count +1
	\*if (count = 3) 
		and a hound
	a hound,
\*if transformations_eagle
	\*set count +1
	\*if (count = 3) 
		and an eagle
	an eagle,
\*if transformations_horse
	\*set count +1
	\*if (count = 3) 
		and a horse
	a horse,
\*if transformations_ostrich
	\*set count +1
	\*if (count = 3) 
		and an ostrich
	an ostrich,
\*if transformations_crocodile
	\*set count +1
	\*if (count = 3) 
		and a crocodile
	a crocodile,
\*if transformations_tiger
	\*set count +1
	\*if (count = 3) 
		and a tiger
	a tiger,
<pre/>

I don’t think that would. personally I’d do something like this.


*create form_one "None."
*create form_two "None."
*create form_three "None."

in startup.txt then when it comes to deciding Beckhams forms...

*temp count 0
*label form_choice
*if (count = 3)
  *goto next_scene
*choice
  #Poison Toad.
    *if count = 0
      *set form_one "Poison Toad."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Poison Toad."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Poison Toad."
      *set count +1
      *goto form_choice

  #Pit Viper.
    *if count = 0
      *set form_one "Pit Viper."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Pit Viper."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Pit Viper."
      *set count +1
      *goto form_choice

  #Tiger
    *if count = 0
      *set form_one "Tiger."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Tiger."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Tiger."
      *set count +1
      *goto form_choice

"Ever since he was old enough to do so, you have trained him to transform into a ${form_one}, a ${form_two} and a {form_three}."

It did work though:P the only thing that I need to fix is that it includes the

*if (count =3)

code along with the original effect of the choice. So for example it’d say

“Ever since he was old enough to do so, you have trained him to transform into an eagle, a tiger, and a horse a horse.”

Instead of

"“Ever since he was old enough to do so, you have trained him to transform into an eagle, a tiger, and a horse.”

@dj_cuty
Variable declaration is tempting and it’s easy to go overboard. What is the supposed value of the “transformations” variable again? I mean if you’re to layout the sentence with the last snippet you posted anyway then all you need is the booleans for each respective form when the player is prompted the selections.

I did actually have a reason for not doing things Nocturnal Stillness’ way. I believe that the way he’s coded it means that you’ll need to check 3 times to see if you know a form.

How I’d do it.

In startup


*create transform_toad false
*create transform_crow false
*create transform_viper false
*create transformations ""

Then in your transformations selection.


*disable_reuse

*temp count 0
*label form_choice
*if (count = 3)
	*goto transformations

*choice
	#Toad.
		*set transform_toad true
		*set count +1
		*if count < 3
			*set transformations &"a toad, "
		*if count=3
			*set transformations &"and a toad"
		*goto form_choice

	#Viper
		*set transform_viper true
		*set count +1
		*if count < 3
			*set transformations &"a viper, "
		*if count=3
			*set transformations &"and a viper"
		*goto form_choice

	#Crow
		*set transform_crow true
		*set count +1
		*if count < 3
			*set transformations &"a crow, "
		*if count=3
			*set transformations &" and a crow"
		*goto form_choice 

*label transformations

Ever since he was old enough to do so, you have trained him to transform into ${transformations}.


@FairyGodfeather

the way I did it. you choose a first form, then it goes back to the choice of forms where you pick the second form and again to pick a third form. It skips the whole needing to use *set comma and “,&” etc.

I’ve altered it slightly and ran it through CJWs online tester and it seems to work fine.


*create form_one "None."
*create form_two "None."
*create form_three "None."

in startup.txt then when it comes to deciding Beckhams forms...

*temp count 0
*label form_choice
*if (count = 3)
  *goto next_scene
*choice
  *hide_reuse  #Poison Toad.
    *if count = 0
      *set form_one "Poison Toad."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Poison Toad."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Poison Toad."
      *set count +1
      *goto form_choice

  *hide_reuse  #Pit Viper.
    *if count = 0
      *set form_one "Pit Viper."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Pit Viper."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Pit Viper."
      *set count +1
      *goto form_choice

  *hide_reuse  #Tiger
    *if count = 0
      *set form_one "Tiger."
      *set count +1
      *goto form_choice

    *if count = 1
      *set form_two "Tiger."
      *set count +1
      *goto form_choice

    *if count = 2
      *set form_three "Tiger."
      *set count +1
      *goto form_choice

*label next_scene
"Ever since he was old enough to do so, you have trained him to transform into a ${form_one}, a ${form_two} and a ${form_three}."

run it through this.

https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/online-cs-tester/mygame/input.html