Jump to content

Cutscene problem


Recommended Posts

I have a problem with this cutscene I've just begun to make (code below). Whenever I test it and start the cutscene, it relocates the characters, but then ends the cutscene and gives me an error message saying,"Improper command in line 0." Now, if I've made a clumsy mistake, laugh all you want, but please just help me.

 

Code:
 begintownscript;variables;short i;body;beginstate INIT_STATE;	set_name(6,"Prophet");break;beginstate START_STATE;break;beginstate EXIT_STATE;break;beginstate 10;	if (get_flag(0,0) == 0) {	force_view_center(25,21);	relocate_character(0,23,23);	relocate_character(1,24,23);		relocate_character(2,25,23);	relocate_character(3,26,23);	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"There was once a");	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"terrible conflict between");	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"sliths and nephil.");	erase_text_bubbles();	force_instant_terrain_redraw();	pause(4);		force_view_center(33,22);	i = 7;	while (i <= 26)		{set_character_pose(i,2);		i = i + 1; }		force_instant_terrain_redraw();	pause(4);		set_flag(0,0,1);	message_dialog("What a good story!","Now leave to the south!");	end();	}	break;
Link to comment
Share on other sites

I doubt this, but maybe it's the space before "begintownscript;"

 

Honestly, I can't see what would give an Improper Command error... but here's one unrelated pointer, regarding this bit of code:

Code:
	text_bubble_on_char(6,"");	text_bubble_on_char(6,"sliths and nephil.");	erase_text_bubbles();	force_instant_terrain_redraw();	pause(4);
As is, the code will erase the new bubble before the player ever sees it. It should read:

Code:
	text_bubble_on_char(6,"");	text_bubble_on_char(6,"sliths and nephil.");	force_instant_terrain_redraw();	pause(4);	erase_text_bubbles();	force_instant_terrain_redraw();	pause(4);
Link to comment
Share on other sites

Generally such an error is due to some unmatched overlapping bracketing, weird parenthesis, or some overlapping syntax error that the engine cannot detect.

 

In your case, be sure to put a bracket { to enclose the while loop (in other words immediately after your while command). You end bracket terminates the if statement and your second one terminates the while loop which is, well, strange. See if this fixes it.

 

Also, use some spacing for every conditional/loop block. It makes your code easier to read.

Link to comment
Share on other sites

Quote:
In your case, be sure to put a bracket { to enclose the while loop (in other words immediately after your while command). You end bracket terminates the if statement and your second one terminates the while loop which is, well, strange. See if this fixes it.
There is already an end bracket. Thanks for trying though.

EDIT: Strange, it works now that I've put the same script into a new TextEdit file and changed the name of the script. Must've just been a nasty bug.
Link to comment
Share on other sites

No, what he/she (I'm sorry, but I don't know you're gender, *I) means, is that you should do the following:

 

Your code:

Code:
 i = 7;	while (i <= 26)		{set_character_pose(i,2);		i = i + 1; }	 
Your modified code by me:

Code:
 i = 7;	while (i <= 26) { // This what *I meant, i think		set_character_pose(i,2);		i = i + 1;                }
*I, this is what you eamnt, didn't you? otherwise i didn't understand it.
Link to comment
Share on other sites

Thralni is correct about what I meant:

 

Code:
begintownscript;variables;short i;body;beginstate INIT_STATE;	set_name(6,"Prophet");break;beginstate START_STATE;break;beginstate EXIT_STATE;break;beginstate 10;	if (get_flag(0,0) == 0) {	force_view_center(25,21);	relocate_character(0,23,23);	relocate_character(1,24,23);		relocate_character(2,25,23);	relocate_character(3,26,23);	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"There was once a");	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"terrible conflict between");	force_instant_terrain_redraw();	pause(4);		text_bubble_on_char(6,"");	text_bubble_on_char(6,"sliths and nephil.");	erase_text_bubbles();	force_instant_terrain_redraw();	pause(4);		force_view_center(33,22);	i = 7;	while (i <= 26) {	        set_character_pose(i,2);		i = i + 1;         }		force_instant_terrain_redraw();	pause(4);		set_flag(0,0,1);	message_dialog("What a good story!","Now leave to the south!");	end();	}	break;
This is the way I would write it and it usually works. It's also easier to see for debugging. I read through line by line, and couldn't find anything obvious, but I have a couple comments:

 

1) Avoid using flag 0,0 its use tends to be troublesome in BoE and I have suspicions about it in BoA.

 

2) A pause of 4 might be a bit too short, keep in mind that 4 means 0.4 seconds which is quite fast. I would recommend 10 for non-native English speakers. Ideal would be allowing the user to set cutscene speed. Consult the abilities of Bahssikava and some of TMs scenarios to understand the implementation.

 

3) The end() command is a bit redundant unless you have more coding you are not showing us in this state. You can probably eliminate it.

 

Oh yes, sometimes text editors will create goofy characters at the beginning of a file for purposes of keeping track of things. I would suggest using the simplest text editor you can find for this sort of stuff.

Link to comment
Share on other sites

Placement of the brackets doesn't matter. I used to put brackets in the places where Fire Shards is putting them, and it worked just fine.

 

Alint gives me nothing. I'm pretty sure the syntax here is correct, although some of the effects (erase_text_bubbles, as mentioned above) will not be the ones desired.

 

Is there more to the script than this?

Link to comment
Share on other sites

The issue I had with TextEdit was actually from mucking around with the A4 scripts rather than BoA, but it might be the same. Basically, I found that a new line in TextEdit (by hitting the "return" key) had hex value 0x0A, while the original line breaks in the scripts had hex value 0x0D. Changing the edited line breaks to the original ones (by copying and pasting) solved the issue.

 

I don't know how you can fix it, but try editing it in a different text editor, and use a find and replace to change all the original line breaks to new ones. Does that make sense? I hope I'm being clear.

Link to comment
Share on other sites

I once used Simpletext, but stopped using it as it was to unclear. tabs didn't show up right and it was a pain to use. Therefor i decided to use "BBedit lite 6.1." The best thing is, that 6.1, as its an outdated version, can be downloaded for free. You ca do that on any free software download website, like twucows (or something like that, i can't really remember what it was called). Try that.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...