Jump to content

Problem 'Unknown command you in line 41'


Recommended Posts

I did use () instead [], but for some reason last time I tried to posts something with ( ) in it it said HTML not enabled. Hopefully I can use UBB code correctly to post my script... I didn't see any problems the script, so maybe you could spot something.

Code:
 begintownscript;variables;int i,j,k,choice;body;beginstate INIT_STATE;	set_crime_tolerance(1);	i = 0;break;beginstate EXIT_STATE;break;beginstate START_STATE;break;beginstate 10;	message_dialog("You spot a small building, that has a very old label, that says old treasure chamber.""This looks like a good place to loot. After all, the box on the other end of the chamber readsgold.");break;beginstate 11;	reset_dialog();	add_dialog_str(0,"You notice a lever in this small hallway. Do you wish to pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	choice = run_dialog(1);		if (choice == 1);			end();		if (choice == 2);			flip_terrain(37,37);			flip_terrain(33,38);			message_dialog("You hear the sounds of metal clancking on stone.","");break;beginstate 12;	if (i < 4) {		block_entry(1);		message_dialog("You try to cross, but the rune repels you. You cant get through here now.","");		}	if (i = 4)		set_state_continue(13);	if (i > 4) {		damage_near_loc(38,23,50,4,1);		message_dialog("You set the power too high!","The floor begins spreading a sonar heat wave 4 spaces in every direction of the blue tile! Get out of there!");		block_entry(1);		}break;beginstate 13;	message_dialog("You step over the floor. Instead of blocking you, it alows you to pass, and take what is inside the crystal container. And to top it off, the gates over to the west open!","You open the container, and good lord! It is a golden pig!_To take the item, search the container and grab it.");	block_entry(0);	flip_terrain(30,22);break;beginstate 20;	reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,24);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break;beginstate 21;reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,25);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break;beginstate 22;	reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,26);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break;beginstate 23;	reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,27);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break;beginstate 24;	reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,28);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break;beginstate 25;		reset_dialog();	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);	add_dialog_choice(0,"Leave");	add_dialog_choice(1,"Pull Lever");	if (choice = 1;)		end();	if (choice = 2) {		flip_terrain(39,29);		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");		i + 1;		}break; 
Link to comment
Share on other sites

Code:
"You spot a small building, that has a very old label, that says old treasure chamber.""This looks like a good place to loot. After all, the box on the other end of the chamber readsgold."
Try putting a "," in between the two quotation marks. That's one of the things I noticed. I actually can't see anything else wrong with it although there might be something else...hmm.
Link to comment
Share on other sites

I did put the comma between the quotes, and you said nothing else is wrong.

The computer thinks differently eek

bad term in expression in line 77.

 

EDIT= I did find an expression with an ill placed semi_colon next to line 77, but I fixed, reloaded, exited and re-entered town, and the problem persist. Btw it only shows that error message when a walk over to a lever I need to turn.

Link to comment
Share on other sites

If you're counting lines and you're on a Mac, I'm guessing you're using TextEdit. My first recommendation is to stop using that program. I used to use it, and it took me ten times as long to debug. Get BBEdit Lite. There's a link around here somewhere, and you can just do a search on it, too. Jeff uses BBEdit (the real version, not Lite) and the line numbers match with that. They DON'T match with things like Word, and as far as I know, TextEdit doesn't do line counts.

 

To transfer a text document between TextEdit and BBEdit Lite, you may have to open it up in TextEdit, copy it, and then paste it into BBEdit Lite.

 

Anyway, once you've done that, this looks like a problem with a quotation mark being missing somewhere. I'd look at line 41, and if it contains a string, make sure that the quotes that begin and end it are properly placed. If it doesn't contain a string, or if the quotes are correct, check if it contains the word "you." If it does, a string above it probably doesn't have proper end quotes. Check the strings nearby and above.

 

Beyond that, I don't know.

Link to comment
Share on other sites

Now it says bad term in expression in line 78, which is...

 

Code:
 72 beginstate 21;73 reset_dialog();74 	add_dialog_str(0,"You notice a small power lever on the floor. Should you pull it?",0);75 	add_dialog_choice(0,"Leave");76 	add_dialog_choice(1,"Pull Lever");77 	if (choice = 1)78 		end();79 	if (choice = 2) {80 		flip_terrain(39,25);81 		message_dialog("You turn the lever","It appears the lever was a power control. You hear a slight electrical discharge, and the rune symbol on the blue tile sparks. You have turned up the power a little.");82 		i + 1;83 		}84 break;  
I think the reason the line counting was a problem in text_edit was because the wider the window, the more or less lines are needed to fit text, changes the line numbers. BBEdit does not do that.
Link to comment
Share on other sites

I keep geting the stuff that uses either one or two equal signs mixed up. Thanks man.

But it still shows errors, which I dont understand

Bad Expression in line 44 (Forgive me, only second day at scripting stuff. I dont understand much.)

Code:
38 beginstate 12;39 	if (i < 4) {40 		block_entry(1);41 		message_dialog("You try to cross, but the rune repels you. You cant get through here now.","");42 		}43 	if (i = 4) {44 		set_state_continue(13);45 		}46 	if (i > 4) {47 		damage_near_loc(38,23,50,4,1);48 		message_dialog("You set the power too high!","The floor begins spreading a sonar heat wave 4 spaces in every direction of the blue tile! Get out of there!");49 		block_entry(1);50 		}51 break;  
Link to comment
Share on other sites

Again, if testing equality, the format is if (i == 4)

 

So change that in line 43 and line 44 should work.

 

EDIT: Thought I should add this in- there is a difference between assigning a number (=) and checking the assigned variable for the number (==). Assigning a variable means to store a number/string/boolean in a variable. Consider the following code:

 

Code:
v = 5 //v now has a number of five.if (v == 5) { //check if v is fivev = 6 //if v == 5, then assign a 6 to it}
So if you are assigning a number into a variable, use (=). If you are checking equality, use (==).
Link to comment
Share on other sites

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