Title Instruction Error message


#1

Hi, I’m Quin! I’m super glad to be here, I love playing COG games :slight_smile:

So I tried out the editor and I was playing around with the code, and I keep getting this error message:

Java Script Error: Invalid title instruction, only allowed at the top of startup.txt

…but I can’t find the source of the error. If anyone could help I’d be much obliged! Here’s what I have for the mygame.js file: (If you’re confused about the content just ignore it, it’s all just random weirdness with no real method. Won’t resemble the game I have in mind.)

`
nav = new SceneNavigator([
“startup”
,“invasion”

]);

stats = {
leadership: 50
,strength: 50

};
`

Here’s what I have in the startup.txt file:

`
*title Random

Welcome to the game! :smiley:

*choice
#Play good
Happy yet limited.
*finish
#Play evil
Cruel yet fun.
*goto_scene invasion
#Play neutral
Boring yet safe.
*goto theater
*label theater
You have a lot of fun visiting a theater. Your favorite piece was the
*choice
#Siren’s Song
A hot choice. The siren’s song seduces you. You die of a boiling fever.
*ending
#Maiden’s Lament
A pure choice. The lament grieves you. You live hopefully.
*goto_scene invasion
#Warrior’s Cry
A strong choice. The cry rallies your courage. You live bravely.
*finish
#Scholar’s Observations
A wise choice. The monotonous voice drones on and on, lulling you into unconsciousness. You die of boredom.
*goto theater
`

Here’s what I have in the invasion.txt file:

There is a terrible invasion. What do you do? *choice #Fight at the front lines. #Engage in tactical strategy. #Encourage the soldiers. #RUN FOR YOUR LIFE D:

So, the following issues arise in the online test of the game:

#1 – I can get from “Play Good” to “Happy…” but then the “Next Chapter” link just gives me the error message
#2 – “Play evil” instantly gives me the error message
#3 – I can “Play neutral” no problem, but then “Maiden’s Lament” shows me the error message
#4 – Under “Play neutral”, “Warrior’s Cry” works but the “Next Chapter” link shows me the error message again

Whatever I do, I can’t seem to get to the invasion.txt file. Theoretically I could structure a game using only "goto " rather than "goto_scene " as the “goto theater” part works fine, but I’m thinking of making a pretty bulky game and it would definitely be helpful to break up the scenes.

I noticed that someone else had this problem: http://www.choiceofgames.com/forum/discussion/2254/invalid-title-instruction-error?post#Form_Body

However, there was never a response applicable to me. I retried everything while removing the *title Random from the startup.txt file, and nothing was different. It tells me every time that Line 6 is the issue, but tampering with it doesn’t seem to change anything. I’m new to coding and I’m really lost as to what’s wrong here. I did triple-check and all the indenting is correct. Any help would be much appreciated! Thank you! :smiley:

Quin


#2

You need to have something under your choice options in the invasion.txt , otherwise it’ll cause an error every time you enter that scene. That’s why your *finish and *goto_scene options don’t seem to be working.

Edit: The way you have your *title command should work without error. Are you sure you’re using the latest version of ChoiceScript?


#3

Yes, I think I have the latest version … I downloaded it from the link provided in the intro page: http://www.choiceofgames.com/make-your-own-games/choicescript-intro/

Let me try adding something under the choice options…


#4

Hi Quin, welcome to the forum.

Your no.4 doesn’t look right. The *finish command should bring up a template game over choice, without any Next Chapter button. I’d guess it has something to do with using *title + startup.txt and mygame.js at the same time.


#5

All right, I think I figured out the problem. I’ve changed the “*goto_scene invasion” to “*goto_scene Invasion” with an UPPER-case I and it seems to be working now. But I still get a different error message this time…

Per CS_Closet’s help, I changed the invasion.txt to:

There is a terrible invasion. What do you do? *choice #Fight at the front lines. You win. *finish #Engage in tactical strategy. You win. *finish #Encourage the soldiers. You win. *finish #RUN FOR YOUR LIFE D: You suck. *finish

The number of indents for each line are:
#1: 0
#2: 0
#3: 4
#5: 8
#6: 4
#7: 8
#8: 4
#9: 8
#10: 4
#11: 8

However, I keep getting this error message when I reach the “invasion” page:

line 2: increasing indent not allowed, expected 0 was 4

…Except it’s 0, not 4 O_o And I’ve reloaded the page several times so it’s not out of date.


#6

@FcA
You can combine altering the mygame.js with *title and have it work fine. That’s not the problem.

@Quintessence
You need *goto, *goto_scene, *finish, or *ending at the end of each of your *choice options. See if that fixes it.


#7

@FcA
Thanks for the welcome! :slight_smile: Should I not be using the mygame.js and startup.txt at the same time? The intro on the site was not very lucid to me so I used this tutorial, people in the forums said it was good, but perhaps it’s out of date: http://countersongscloset.webs.com/tutorial


#8

That tutorial is a bit outdated, as I haven’t figured out exactly how the new commands work and what will and won’t break them, but I have tested using *title with with that method and it’s worked fine for me.


#9

@CS_Closet
Yeah, I fixed that, changed the invasion.txt to:

There is a terrible invasion. What do you do? *choice #Fight at the front lines. You win. *finish #Engage in tactical strategy. You win. *finish #Encourage the soldiers. You win. *finish #RUN FOR YOUR LIFE D: You suck. *finish

but I still get the same error message.


#10

@Quintessence I think the link was his tutorial :smiley:

But yeah, no @CS_Closet I have never tried using both. If anyone’s tested that and it does work without problem, good to know that’s not the case.


#11

#CS_Closet
Oh, cool xD Yeah, I should have noticed by your username. It’s a really well-written tutorial!


#12

#CS_Closet
So I tried deleting the invasion.txt file and just rewriting it, changing the title etc., and I still get the same error :confused: Do you know what I’m doing wrong?


#13

@Quintessence
Glad it was of some assistance. :slight_smile:

That is the old method of declaring scenes and stats, but there’s nothing in the new version of ChoiceScript to prevent it from working. My own game still uses that method without problem. There’s a supposedly easier method now that doesn’t require messing with mygame.js, but I don’t have much experience in using it.

As for the code that you’ve listed, I don’t see anything immediately wrong. I’ll set it up in a game and see if I can track down the issue.

Edit:
I ran what you listed on this thread in a test game and it worked perfectly fine, so I’m sorry to say I don’t really know where the problem lies unless it’s somewhere with the indention.

Here’s the exact code I used, using your standard 4 spaces:

startup.txt

*title Random

Welcome to the game! 

*choice
    #Play good
        Happy yet limited.
        *finish
    #Play evil
        Cruel yet fun.
        *goto_scene invasion
    #Play neutral
        Boring yet safe.
        *goto theater
*label theater
You have a lot of fun visiting a theater. Your favorite piece was the
*choice
    #Siren's Song
        A hot choice. The siren's song seduces you. You die of a boiling fever.
        *ending
    #Maiden's Lament
        A pure choice. The lament grieves you. You live hopefully.
        *goto_scene invasion
    #Warrior's Cry
        A strong choice. The cry rallies your courage. You live bravely.
        *finish
    #Scholar's Observations
        A wise choice. The monotonous voice drones on and on, lulling you into unconsciousness. You die of boredom.
        *goto theater

invasion.txt

There is a terrible invasion. What do you do?
*choice
    #Fight at the front lines.
        You win.
        *finish
    #Engage in tactical strategy.
        You win.
        *finish
    #Encourage the soldiers.
        You win.
        *finish
    #RUN FOR YOUR LIFE D:
        You suck.
        *finish

mygame.js

nav = new SceneNavigator([
	"startup"
	,"invasion"
    
]);

stats = {
	leadership: 50
	,strength: 50
};

If you want, you can copy and paste that, or throw a copy of your startup.txt and invasion.txt file’s contents on this thread between some `

 

` tags to show the indention and I’ll see if I can help you work it out.


#14

Thanks so much for your help! I just deleted everything and then re-pasted what you provided, and it worked like clockwork :3 Super excited to get started :smiley:


#15

You’re very welcome. Have fun with ChoiceScript, and good luck with your coding!