what_day_of_scenario()

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: what_day_of_scenario()
Master
Member # 5977
Profile Homepage #0
this call makes me wonder. I put it into a script which worked fine, but since two days ago it refuses to work proparly. I did some debugging tests, and found that the current day is day_shown_on_screen - 1. so, what we would think is day 1, is day 0 with this call. Was it like that all along?

For better reference, here are the scripts involved:

rivers.txt, START_STATE:
beginstate START_STATE;

// The things with appointment mayor of Filberton

if (get_flag(28,0) == 1) {
day1 = get_flag(250,4);

if (what_day_of_scenario() >= (day1 + 2)) {
set_flag(28,0,2);
print_str_color("You missed your appointment with mayor Arbuckle of Filberton.",3);
}
}

if (get_flag(28,0) == 1) {
if (get_flag(200,0) == 0) {
day1 = get_flag(250,4);

if (what_day_of_scenario() == (day1 + 1)) {
print_str_color("Today you have an appointment with mayor Arbuckle of Filberton.",3);
set_flag(200,0,1);
}
}
}
and t28filbertondlg.txt, one of the dialogue nodes:
begintalknode 4;
state = 3;
personality = 49;
nextstate = -1;
condition = 1;
question = "Yes please";
text1 = "She checks the book of appointments. _It seems you don't have an appointment yet. okay, the mayor will see you tomorrow._ She closes the book. _That's settled then, good bye!_";
text2 = "She checks the book of appointments. _Ah, i see you already have made an appointment. come back when you have it._ She says good bye and returns to the angry man.";
text3 = "She checks the book of appointments. _I see you had an appointment, but didn't come to it on time. You'll have to make a new one._ She crosses the old appointment out.";
code =
if (get_flag(28,0) == 0) {
remove_string(2);
remove_string(3);
set_flag(28,0,1);
print_str_color("You made an appointment to see mayor Arbuckle of",3);
print_str_color(" Filberton for tomorrow.",3);

day1 = what_day_of_scenario();
set_flag(250,4,day1);

set_flag(200,2,0);

print_num(day1);
print_num(get_flag(250,4));
print_num(get_flag(28,0));
print_num(get_flag(200,2));
print_num(what_day_of_scenario());
end();
}

if (get_flag(28,0) == 1) {
remove_string(1);
remove_string(3);
end();
}

if (get_flag(28,0) == 2) {
remove_string(1);
remove_string(2);
print_str_color("Your appointment with mayor Arbuckle was canceled.",3);
set_flag(28,0,0);
set_flag(200,2,0);
end();
}
break;
What happens is this: In t28filbertondlg.txt you make an appointment to see the mayor of that town for the next town. flag 28,0 is set to 1, to sinify that an appointment was made, 200,2 is set to 0 just to make sure it will be 0, and flag 250,4 is set to a variable: day1, according to what_day_of_scenario(), which I think is the problem here.

After that, in rivers.txt (the scenario script) the following thing are checked:

is flag 28,0 == 1? If so, then continue, as an appointment was made;
is flag 200,2 == 0? If so, then continue, as this message wasn't displayed as yet;
is day1, which is set according to flag 250,4, (day1 + 1) == what_day_of_scenario? If so, show the message that an appointment was made for today.

However, it seems as though all this isn't done. I checked this last sequence of events (in rivers.txt) by leaving out the flags 28,0 and 200,2. It still didn't work, which means that there must be something wrong with the variable day1, or the call what_day_of_scenario.

In the dialogue node I put here for you people to look at, I have added several print_num() calls. On day 1, this is what the values of the variables and calls give me:

day1 = 0 (?)
250,4 = 0 (?)
28,0 = 1 (that's okay)
200,2 = 0 (that's okay)
what_day_of_scenario() = 0 (?)

If its not the call, can anybody of you guys spot the problem? Its only now that it stopped working. before it worked perfectly. The strangest thing is, is that I can't remember changing anything about these two script (rivers.txt and t28filbertondlg.txt).

I hope anybody can help.

--------------------
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
...b10010b...
Member # 869
Profile Homepage #1
The call is behaving normally. The day given by the call is indeed always 1 day earlier than the displayed day, so the first day of the scenario is day 0.

--------------------
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
Something to add here, I suppose.

--------------------
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 #3
So, if the call is behaving normally, can anybody look at the scripts and please tell em why it doesn't work?

Thanks in advance.

--------------------
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
Shaper
Member # 3442
Profile Homepage #4
Thralni: After our talk last night, I managed to get the Mayor to see me. However, he did half-way through the day instead of at the start. My code is similar to yours, but this worked:
if ((get_flag(28,0) == 1) && (get_flag(200,2) == 0)) {
day1 = get_flag(250,4);
if (what_day_of_scenario() == (day1 + 1)) {
print_str_color("Today you have an appointment with mayor Arbuckle of Filberton.",3);
set_flag(200,2,1);
}
}

if (get_flag(28,0) == 1) {
day1 = get_flag(250,4);
if (what_day_of_scenario() >= (day1 + 2)) {
set_flag(28,0,2);
print_str_color("You missed your appointment with mayor Arbuckle of Filberton.",3);
}
}
I have no idea why though.

--------------------
And when you want to Live
How do you start?
Where do you go?
Who do you need to know?

Posts: 2864 | Registered: Monday, September 8 2003 07:00
Master
Member # 5977
Profile Homepage #5
Small update:

I continued testing, and it appears that rivers.txt is not run, at least not the START_STATE. Is there any reason for that to happen?

EDIT: And another small update:

I checked rivers.txt with alint, and it returned two errors, both errors of syntax, so I gather that there is something wrong with the +'s, -'s and such. I can't find the problem... Can you?

[ Thursday, July 06, 2006 09:19: Message edited by: Mc 'mini' Thralni ]

--------------------
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