Easygoing Eyebeast Morgan Posted May 2, 2004 Share Posted May 2, 2004 I just discovered a lovely little, if utterly fatal, bug in BoA. beginstate 20; if(char_ok((char_on_spot(char_loc_x(0)), (char_loc_y(0) - 5))) == 1) { message_dialog("Is this working?", ""); } break; Essentially, this piece of code checks to see if there are any monsters of any type five spaces north of the first member of the party. The code works fine, and if there is, the dialog "Is this working?" is displayed. However, once the piece of code is run, and the player then reloads his save game, BoA crashes and quits itself. I thought this might simply be a problem in my machine, so I mailed it over to Drakey, and he has exactly the same problem. If anybody would like to try it for themselves, to see if this is an across the board problem and not just limited to myself and Drakey's machines, then I would be grateful. Comments from Spidweb would be very helpful. Link to comment Share on other sites More sharing options...
Chittering Clawbug Nasarius Posted May 2, 2004 Share Posted May 2, 2004 Looks like it's probably an "array index out of bounds" type of error. Have you tried walking to the north edge of the town and seeing if it crashes there? Link to comment Share on other sites More sharing options...
Chittering Clawbug Nasarius Posted May 2, 2004 Share Posted May 2, 2004 By the way, here's the way to (probably) fix it. This is in pseudocode since I don't know Avernumscript: Code: y = char_loc_y(0) - 5;if (y < 0){ // do nothing...}else if(char_ok((char_on_spot(char_loc_x(0)), y)) == 1){ message_dialog("Is this working?", "");}break; Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 2, 2004 Author Share Posted May 2, 2004 I'm pretty sure it does that. Let me check. Yeah, it does. For the less technologically savvy of us, what does this type of error mean? Is it a specific fault of BoA's engine, or a scripting limitation? Yeah, that translates pretty well into Avernumscript. I'll try it. Link to comment Share on other sites More sharing options...
Chittering Clawbug Nasarius Posted May 2, 2004 Share Posted May 2, 2004 Quote: Originally written by Morgan:I'm pretty sure it does that. Let me check. Yeah, it does. For the less technologically savvy of us, what does this type of error mean? Is it a specific fault of BoA's engine, or a scripting limitation? Basically, a town in Avernum is a big grid, with the upper-left corner being (0, 0). As you move to the right, x increases. As you move down, y increases. Therefore, there are only positive numbers in the grid. You're trying to ask Avernum about a spot that's off the grid. It would be nice if the Avernum engine handled this cleanly, but apparently it doesn't. You'll very likely get the same error if you check too far in any direction. Is there any simple way to get the size of the town? If not, that could be a problem. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 2, 2004 Author Share Posted May 2, 2004 As far as I know, there isn't a way of checking town size (at least not cleanly). What you say may be true, but I've used the same sort of calls to check if certain types of terrain and floors are five spaces in front of the character, and not experienced similar problems. Unfortunately, your solution produces the same results. Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody Namothil Posted May 2, 2004 Share Posted May 2, 2004 current_town_size() doesn't work? Link to comment Share on other sites More sharing options...
Garrulous Glaahk spyderbytes Posted May 2, 2004 Share Posted May 2, 2004 Actually, I think it might be Jeff's string handling that has some bounds checking problems. I had the same problem (crashing after load from a save) in one script where I was using string constants defined at init (then putting them in dialog by var name). As soon as I cut and pasted the strings directly into the message_dialog() call, the problem went away. Try doing something like play_sound(-57) instead of the message_dialog() and see what happens. I was thinking the problem was the string constants, but it could be something slightly screwy with message_dialog() itself, I guess... Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted May 2, 2004 Share Posted May 2, 2004 Some of the calls bounds check everything the designer does, and some don't. In general, though, you shouldn't be checking the terrain for non-existant spaces, modifying the inventory for non-existant characters, and so on. - Jeff Link to comment Share on other sites More sharing options...
Chittering Clawbug Nasarius Posted May 2, 2004 Share Posted May 2, 2004 Quote: Originally written by Morgan:Unfortunately, your solution produces the same results. Strange. Try printing out the x and y coordinates you're checking first (or maybe use a message box). Then you should be able to pinpoint which coordinate is making it crash. Good luck, N. Link to comment Share on other sites More sharing options...
Magnificent Ornk Donald Hebb Posted May 3, 2004 Share Posted May 3, 2004 Another thing- terrains with special ability 7 (party cannot rest) will not allow the party to enter the town. This is irritating, since my desert terrains cover whole towns, and the party is forced onto solid stone beyond the town's edge from time to time. Bah. Link to comment Share on other sites More sharing options...
Curious Artila philstrek Posted May 3, 2004 Share Posted May 3, 2004 Couldn't you just create another identical desert floor type without the special ability and put it into the areas where you want to allow the party to rest? To be able to differentiate between the two, you could put a red dot or something on the small icon dispayed in the editor window. That way you would be able to tell the difference between the two when editing. Link to comment Share on other sites More sharing options...
Magnificent Ornk Drakefyre Posted May 3, 2004 Share Posted May 3, 2004 It's not an array out of bounds error, at least in the cases he describes, since it does work fine, except a reload crashes BoA. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 3, 2004 Author Share Posted May 3, 2004 I tried that spyderbytes, but to no avail. I was personally thinking that it might be something to do with me calling a call within a call within a call. Maybe that's just one of the bounds of BoA. Jeff - I'm not sure I quite understand you - I'm doing all this within the bounds of a town. It works perfectly (I get the message fine), until I reload the save game. Link to comment Share on other sites More sharing options...
Chittering Clawbug Nasarius Posted May 3, 2004 Share Posted May 3, 2004 Quote: Originally written by Morgan:Jeff - I'm not sure I quite understand you - I'm doing all this within the bounds of a town. It works perfectly (I get the message fine), until I reload the save game. As I said, print out the coordinates you're checking before you check them. This will allow you to figure out when and why it crashes. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 3, 2004 Author Share Posted May 3, 2004 The co-ordinates print out at 24, 15, in range of the town's grid. This is not an out-of-bound error. This, originally, was being called from an item, so it's been used in a variety of places, all different co-ordinates. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted May 3, 2004 Share Posted May 3, 2004 I just fixed a bug which might have something to do with this. If a script had an error in which a call wasn't getting passed enough parameters, BoA would crash the next time a saved game was loaded. Double check to make sure your script isn't giving you any errors. I know they can be easy to miss in the scrolling text. - Jeff Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 4, 2004 Author Share Posted May 4, 2004 The code works fine - no errors whatsoever (I don't think Drakey encountered any either, when he tried it) in the scroll bar. As I said, the code works as it should, only causes the game to crash on reload. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted May 4, 2004 Share Posted May 4, 2004 Compress the scenario, a save file I can use to repro the bug, and precise instructions for how to repro the bug, and E-mail it to spidweb@spiderwebsoftware.com. I'll take a look and see if I can fix it. - Jeff Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 4, 2004 Author Share Posted May 4, 2004 Sent. Thanks for taking a look. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted May 4, 2004 Share Posted May 4, 2004 Got and processed. The crash is, indeed, the one I fixed yesterday. It happens when a call gets passed too few integers. The game will handle this error much more gracefully in the future. If you look at this line hard: if(char_ok((char_on_spot(char_loc_x(0)), (char_loc_y(0) - 5))) == 1) you will see a subtle error in the parenthesis. One call is not getting as many integers as it wants ... - Jeff Link to comment Share on other sites More sharing options...
Garrulous Glaahk spyderbytes Posted May 4, 2004 Share Posted May 4, 2004 Hehe... as such things go, once you point it out, it practically jumps off the page at you, no? But that begs the question... how the heck did it work as expected up until the game was saved and reloaded? Inquiring minds want to know... Link to comment Share on other sites More sharing options...
Well-Actually War Trall Spidweb Posted May 4, 2004 Share Posted May 4, 2004 "Hehe... as such things go, once you point it out, it practically jumps off the page at you, no? But that begs the question... how the heck did it work as expected up until the game was saved and reloaded?" It's a good question. I am not sure how the script engine will work on the boundary conditions. I think that random data was being put into some of the internal variables, and that data happened to make it work. Stranger things have happened. - Jeff Link to comment Share on other sites More sharing options...
Magnificent Ornk Drakefyre Posted May 6, 2004 Share Posted May 6, 2004 See Morgan, I did tell you that there was a parentheses problem. Link to comment Share on other sites More sharing options...
Easygoing Eyebeast Morgan Posted May 6, 2004 Author Share Posted May 6, 2004 *goes to school, relearns how to count* Link to comment Share on other sites More sharing options...
Recommended Posts