Chittering Clawbug Lancer Posted June 11, 2006 Share Posted June 11, 2006 Hello everyone. It seems like it would be real easy but I have had no luck in telling BoA to execute events on a given day.. For example, say I want on Day 30 for a message alert to appear saying "Month: Nuwmont." Day 30 would arrive and no message will appear on the text window. I have been writing statements such as: beginstate LOAD_SCEN_STATE; force_start_day(-1); what_day_of_year(); if (what_day_of_year() == 30) print_str("Month:Nuwmont"); break; The above and variations thereof have given me little success. On another unrelated note.. Is there something wrong with the "print_big_str_color" call? The other versions of print_str seem to work just fine for me, save for that one. Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Put the second half of your code ("if (what_day_of_year() == 30)" and "print_str("Month:Nuwmont");") in the scenario's START_STATE. Also, it's worth taking a look at Spidweb's Bugs page , which lists the problem with the call you're talking about ("The call print_big_str_color is actually called print_big_str_num"). Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Oooh... that documentation on bugs is helpful, Thank you! By Kelandon's suggestion I put the second half of the code in the START_SCEN_STATE. The following is exactly what I have: beginstate LOAD_SCEN_STATE; force_start_day(-1); what_day_of_year(); break; beginstate START_SCEN_STATE; if (what_day_of_year() == 2) print_str("Month:Nuwmont"); break; ----------------------------------------------- So, on "Day 3" there is supposed to be a text string that displays as "Month:Nuwmont.." Oddly, I am still not getting anything to show up on the text window. I am assuming that the program knows to display this as soon as it is Day 3, or on the first tick of Day 3? Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Quote: Originally written by Lancer:By Kelandon's suggestion I put the second half of the code in the START_SCEN_STATE. Uh, not quite. The scenario's START_STATE, not the scenario's START_SCEN_STATE. Two different things. And come to think of it, the first half of the code should be in the START_SCEN_STATE, and the second half should be in the START_STATE. And you really don't need the second line of the first half (the what_day_of_year). Quote: So, on "Day 3" there is supposed to be a text string that displays as "Month:Nuwmont.." I don't know how you figure. The code says, "if (what_day_of_year() == 2)" — if the day of the year is 2, then it does the print_str. Note that this will print the string all during the second day. Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Ok.. I've made some ammends and it is still not working.. Logically, I don't understand why: beginstate START_SCEN_STATE; force_start_day(-1); break; beginstate START_STATE; if (what_day_of_year() == 2) print_str("Month:Nuwmont"); break; Quote: Originally written by Kelandon: I don't know how you figure. The code says, "if (what_day_of_year() == 2)" — if the day of the year is 2, then it does the print_str. Note that this will print the string all during the second day. I just thought that since BoA nearly always starts with "zero" being the first in most circumstances, that what_day_of_year(0) would correspond to Day 1 and what_day_of_year(1) would be Day 2 so on... Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Eliminate the force_start_day and see what happens. You could be right about the first day being day 0, but that would be very odd (given what the calendar shows). I haven't mucked with time much. Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Eliminating the force_start_day(-1) call just brings back the standard calendar... The strange thing, Kelandon, is that if I were to use the following code, the print_str works just like I expect it to... beginstate START_STATE; print_str("Month:Nuwmont"); break; In this case, of course, the text string "Month:Nuwmont" is displayed every tick onto infinity... However, as soon as I put in that "if" statement, it stops doing what I want it to do. It doesn't like something about that if statement... It doesn't understand it or I don't know what.. beginstate START_STATE; if (what_day_of_year() == 2) print_str("Month:Nuwmont"); break; Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Yes, but does it work if you eliminate the force_start_day? It's possible that using force_start_day(-1) screws up the call what_day_of_year and makes it always 0 or something. Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Quote: Originally written by Kelandon:Yes, but does it work if you eliminate the force_start_day? It's possible that using force_start_day(-1) screws up the call what_day_of_year and makes it always 0 or something. It just doesn't like me for some reason..lol. I did try eliminating the force_start_day call but it didn't seem to have any bearing on the what_day_of_year call. I still get the same problem. Is it possible that the "Passage of Time" calls just don't like if/while type statements for some reason? Or is there something syntactically fundamental that I've missed? Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Try putting this in the scenario's START_STATE: print_num(what_day_of_year()); This should tell you what the value of the call is every turn. By the way, these are all basic debugging techniques that you'll want to keep in mind whenever anything doesn't work the way that you expect in Avernumscript: isolate the problematic call, test the call as best you can, and return it to the context that you had it in originally. Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted June 11, 2006 Share Posted June 11, 2006 Kel was on the right track, using the call force_start_day() causes it to return zero for the day of the year. If you want to use this call then you must use what_day_of_scenario() to find out the day. And, oddly enough, a quick test shows that day 1 does return 0. I put in a call if(day_of_scenario() == 2), and it only works on day 3. Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Thanks Kelandon!!!! Along with the print_num(short num) debugging trick I learned (as you had said) that force_start_day keeps num at 0 if used along with the what_day_of_year_call... So, instead, I used the what_day_of_scenario call instead and it works! Thanks again. I am definitely going to make a note of that! Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 Thanks Lazarus, I just figured it out right before you posted! Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted June 11, 2006 Share Posted June 11, 2006 Quote: Originally written by Lazarus.:And, oddly enough, a quick test shows that day 1 does return 0. I put in a call if(day_of_scenario() == 2), and it only works on day 3. Now that I've referred back to the docs, this makes sense to me. Apparently, what_day_of_scenario gives "how many days have passed since the current scenario began" — that is, on day 1, zero days have passed since the start of the scenario (since BoA rounds down). However, the weird behavior above seems as though it ought to be documented — it's not too hard to guess that the day of the year will be non-functional if the dates are off, but it should be stated explicitly, especially if the other call does work. I'll put this in the bugs thread at some point. Link to comment Share on other sites More sharing options...
Chittering Clawbug Lancer Posted June 11, 2006 Author Share Posted June 11, 2006 So, the question that remains is the following: Is there any way to print the string "Month:Nuwmont" only on the first tick of the day called rather than after every tick? Link to comment Share on other sites More sharing options...
Well-Actually War Trall Niemand Posted June 11, 2006 Share Posted June 11, 2006 Yes; use a SDF to keep track of whether the message has been displayed. If it already has, don't display it again. Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Lilith Posted June 11, 2006 Share Posted June 11, 2006 If you expect some players to spend more than a year in the scenario, you'll want to reset the SDF after the month is over (probably by setting it back to 0 in the code for the start of the next month). Link to comment Share on other sites More sharing options...
Recommended Posts