Jump to content

terrain script problem


Recommended Posts

So it took about two hours, not one, since my last question was solved. Again I'm dumping a problem on your plates. the code below has a small problem:


 // flaglever.txt// version 1.0.0// by Thralni// You can alway use this script freely, but put my name (Thralni) in the acknowledgements.// flaglever.txt -  completely changed version of doorlever.txt. Similair to my selfmade walllever.txt.// With this version you have to ALWAYS set a SDF (otherwise it wouldn't work), which gets set to 1 when you pull the lever. Also, a terrain at a certain// spot turns into a terrain of your choice. This script is needed when you would want to pull a lever, but a certain thing has to be done first.// Memory Cells - //   0,1 - The coordinates of a SDF. If that SDF is 1, will do everything in the script, if it is 0 does nothing.//   2,3 - The x,y coordinates of a terrain this lever replaces by a terrain number defined in memory cell 4. If both are left at 0, doesn't//     do anything.//	 4   - the terrain of location (memory cells 0 and 1) to change in.//   5   - a sound to be played//	 6,7 -  Coordinates for a stuff done flag. If these are 0 and 0, ignored. Otherwise,//     when the lever is pulled, if the stuff done flag is 0, it becomes 1, and if the flag//     is non-zero, it becomes 0.//     If a flag is assigned here and is set to when, when the party enters this town later,//     this script will open the gates.// NOTE: be sure to not use flags 299,0 - 299,29. These are used by this script!beginterrainscript; variables;short choice,terr,flag,x;	body;beginstate INIT_STATE;break;beginstate START_STATE;break;beginstate SEARCH_STATE;break;beginstate STEP_INTO_SPOT_STATE;reset_dialog();add_dialog_str(0,"This lever is big and made of steel. would you like to pull it and see what it does?",0);add_dialog_choice(0,"Leave it");add_dialog_choice(1,"Pull and see what happens");choice = run_dialog(0);if (choice == 1)	end();if ((get_memory_cell(0) > 0) || (get_memory_cell(1) > 0))		if (get_flag(get_memory_cell(0),get_memory_cell(1)) == 1) {					if ((get_memory_cell(2) > 0) || (get_memory_cell(3) > 0) || (get_memory_cell(4) > 0)) {				terr = get_terrain(get_memory_cell(2),get_memory_cell(3));								flip_terrain(my_loc_x(),my_loc_y());				set_flag(299,28,terr / 256);				set_flag(299,29,terr % 256);								x = 0;								while (x = 1) {					if (flag >= 27)							flag = 0;					set_flag(299,flag,terr);					flag = flag + 1;					x = 1;					}								if ((get_memory_cell(6) > 0) || (get_memory_cell(7) > 0)) {						if (get_flag(get_memory_cell(6),get_memory_cell(7)) == 0) {								set_terrain(get_memory_cell(2),get_memory_cell(3),get_memory_cell(4));								play_sound(get_memory_cell(5));								set_flag(get_memory_cell(6),get_memory_cell(7),1);								end();								}							terr = get_flag(250,28) * 256 + get_flag(250,29);							set_terrain(get_memory_cell(2),get_memory_cell(3),terr);							play_sound(get_memory_cell(5));							set_flag(get_memory_cell(6),get_memory_cell(7),0);							end();							}						}				}					message_dialog("Apparently, you didn't do the right thing to be able to pull this lever. It stays tight in this position.","");break; 
It says "Bad term in expression in line 58." The the linbe where it says "terrain = get_terrain(get_memory_cell(2),get_memory_cell(3));"


what is the bad term? i don't understand what the problem is, or is it again soemthing which is in another line, but the program gives me another line because the error occured later then it should have occured.


EDIT: replaced code with newer version

Link to comment
Share on other sites

Originally written by Notty:
For example, make sure that cells 2,3 actually correspond to a a location in the town.
That is something that isn't wrong in the script then, but it is something you do wrong while designing with the editor. I can assure you that is something I do without mistakes.

Thanks, salmon. extra help is always welcome.

EDIT: it still doesn't work
Link to comment
Share on other sites

He's right. That line should read:


if (get_flag(get_memory_cell(0),get_memory_cell(1)) == 1) {


That could easily be causing an error that's reported as being in line 58; BoA isn't good at working out the line number of an error due to a missing right parenthesis.

Link to comment
Share on other sites

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