Water Exchange Code Check

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: Water Exchange Code Check
Warrior
Member # 1250
Profile #0
Working on getting a dialog choice to work. I understand the format now that I rooted around in the scripts from... I think it was VoDT. But I have a condition to start my dialog choice, and I think that something there is stopping the condition that regulates the actions from the choice from working...

beginstate 20;
if (has_special_item(1) >= 1) {
reset_dialog();
add_dialog_str(0,"Fill up your empty waterskins?",0);
add_dialog_choice(0,"Fill");
add_dialog_choice(1,"Leave");
water_choice = run_dialog(0);
if (water_choice == 0) {
has_special_item(1) == empty_skins;
change_spec_item(0,empty_skins);
empty_skins == 0;
print_str_color("Skins filled.",2);
}
}
Could also be the fact that I try to equate the number of special item 1 (empty waterskins) to the variable empty_skins, so I can carry the variable over for the number of special item 2 (full waterskins) to be added. Pick it apart, if you would. :-)

[ Sunday, February 13, 2005 18:06: Message edited by: Guardian of Eternity ]
Posts: 93 | Registered: Saturday, June 1 2002 07:00
...b10010b...
Member # 869
Profile Homepage #1
has_special_item(1) == empty_skins;should be

empty_skins = has_special_item(1);Don't feel too bad. Mixing up = with == is probably the single most common error in C programming.

[ Sunday, February 13, 2005 18:14: Message edited by: Sagieuleaux ]

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Off With Their Heads
Member # 4045
Profile Homepage #2
Two things:

empty_skins == 0;

This doesn't work. You need only one equals sign ("empty_skins = 0;").

has_special_item(1) == empty_skins;

This doesn't work for two reasons, one of which is described above. The other is that you can't set a short the way you can set a variable. Use an SDF or another variable to hold this value if you need to hold it.

--------------------
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
...b10010b...
Member # 869
Profile Homepage #3
I'm pretty sure he was trying to set the variable, not the short, but put them the wrong way round.

EDIT: Come to think of it, there should probably be a line in there somewhere to remove the empty skin special items, or it's possible to continue getting full skins indefinitely.

Also, there's one more problem with your script that comes from BoA's terminally brain-damaged handling of the run_dialog call. Choice number zero returns 1, choice number one returns 2, and so on.

A modified script with all suggested corrections implemented is below.

beginstate 20;
if (has_special_item(1) >= 1) {
reset_dialog();
add_dialog_str(0,"Fill up your empty waterskins?",0);
add_dialog_choice(0,"Fill");
add_dialog_choice(1,"Leave");
water_choice = run_dialog(0);
if (water_choice == 1) {
empty_skins = has_special_item(1);
change_spec_item(0,empty_skins);
change_spec_item(1,(empty_skins * -1));
empty_skins = 0;
print_str_color("Skins filled.",2);
}
}


[ Sunday, February 13, 2005 18:23: Message edited by: Sagieuleaux ]

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Warrior
Member # 1250
Profile #4
Here's what I ended up doing, synthesizing Kelandon and Sagieuleaux's suggestions...

beginstate 20;
if (has_special_item(1) >= 1) {
reset_dialog();
add_dialog_str(0,"Fill up your empty waterskins?",0);
add_dialog_choice(0,"Fill");
add_dialog_choice(1,"Leave");
water_choice = run_dialog(0);
if (water_choice == 1) {
set_flag(0,20,has_special_item(1));
change_spec_item(0,get_flag(0,20));
change_spec_item(1,(get_flag(0,20) * -1));
set_flag(0,20,0) = 0;
print_str_color("Skins filled.",2);
}
}

break;
Incidentally, my playtesting in Blades now says that I have a missing semicolon... I don't suppose you see where I need one, in there? I don't see it, but I was only working on this section, except for the variables section, where I deleted "empty_skins" in favor of that SDF.

EDIT: The missing semicolon might, for some strange reason, be in the "print" statement near the very end, since when I test, it won't print that message.

[ Sunday, February 13, 2005 18:41: Message edited by: Guardian of Eternity ]
Posts: 93 | Registered: Saturday, June 1 2002 07:00
Warrior
Member # 1250
Profile #5
All right, all right, this is me committing all sorts of etiquette breaches... I do apologize for the double post, but this is exciting and relevant, for me.

I have playtested the empty/full waterskin system. I'm using Dahak & Kelandon's dehydration routine... I've pushed my party to the point where I get damage, before, and now I've made the complete exchange, using the code I posted in this thread. I can now proceed with building the rest of my scenario, having safely navigated this key system!
Posts: 93 | Registered: Saturday, June 1 2002 07:00
Off With Their Heads
Member # 4045
Profile Homepage #6
set_flag(0,20,0) = 0;

This line's no good. Keep it as just

set_flag(0,20,0);

--------------------
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
Warrior
Member # 1250
Profile #7
My mistake. Fixed it--code works without visible errors, now.
Posts: 93 | Registered: Saturday, June 1 2002 07:00