terrain script problem

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: terrain script problem
Master
Member # 5977
Profile Homepage #0
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

[ Tuesday, January 10, 2006 06:59: Message edited by: Thralni, Nephil translators & co. ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
The Establishment
Member # 6
Profile #1
Try using a different variable name than "terrain". This may be an internal variable the engine uses and it does not like that.

Also, check to make sure the memory cells are set to sensical values.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Master
Member # 5977
Profile Homepage #2
I'll try that, but what do you mean with more sensical memory cell values?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shock Trooper
Member # 932
Profile #3
Sensical, i.e, making sense.

--------------------
Microsoft Patents Ones, Zeroes (March 25, 1998)
"Asians are good at Starcraft because they're always squinting, thus they can see things sharply. Remember to always squint in war." ~ Sun-Tzu
Posts: 215 | Registered: Sunday, April 7 2002 08:00
Master
Member # 5977
Profile Homepage #4
Yes, that I did understand, but how can't it make sense? for a SDF it can't be higher then 255, but a memory cell can be much higher then that, so, again: what do you mean?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Agent
Member # 5814
Profile #5
For example, make sure that cells 2,3 actually correspond to a a location in the town.

[ Thursday, January 05, 2006 09:33: Message edited by: Notty ]

--------------------
quote:
Originally written by Kelandon
Well, I'm at least pretty

Posts: 1115 | Registered: Sunday, May 15 2005 07:00
? Man, ? Amazing
Member # 5755
Profile #6
Your failure message, toward the end, should be corrected to read. It stays tight in this position. Just a little alpha testing for ya.

*this message sponsored by the grammarian*

--------------------
quote:
Originally written by Kelandon:

Well, I'm at least pretty sure that Salmon is losing.


Posts: 4114 | Registered: Monday, April 25 2005 07:00
Master
Member # 5977
Profile Homepage #7
quote:
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

[ Thursday, January 05, 2006 10:09: Message edited by: Thralni, chicken god prophet ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shock Trooper
Member # 4557
Profile #8
I don't know if this is it, but you seem to be missing a parentheses on line 55. (Where you call get_flag.)
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
...b10010b...
Member # 869
Profile Homepage #9
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.

[ Thursday, January 05, 2006 12:53: Message edited by: Thuryl ]

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Master
Member # 5977
Profile Homepage #10
It works now, at least a part of it. the problem moved now to line 67, and it gives the same error. I checked all parenthesis's (if that's the way you spell it) and they seem okay. What could it be this time?

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Shock Trooper
Member # 4557
Profile #11
Try changing the name of the flag variable.
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
Off With Their Heads
Member # 4045
Profile Homepage #12
I love Alint. It tells me that the real problem is in line 64. Your "while (x = 1) {" should read instead "while (x == 1) {".

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #13
Thanks, kelandon. I'll test it later.

it would have been nice if I could use Alint to, but I keep not understanding it, which keeps preventing me from succeding in checking files, whih keeps making me irritated, which keeps... I'll stop here.

EDIT: it works, Thanks kelandon

[ Wednesday, January 11, 2006 10:05: Message edited by: Thralni, Nephil translators & co. ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Off With Their Heads
Member # 4045
Profile Homepage #14
Thralni: Did you try following the step-by-step instructions that CPeters posted?

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Master
Member # 5977
Profile Homepage #15
Yes, I did, but got irritated when I didn't succeed. maybe I should try it again...

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00