ATTN Spidweb: Kink in the Machine
Author | Topic: ATTN Spidweb: Kink in the Machine |
---|---|
Shaper
Member # 22
|
written Sunday, May 2 2004 02:17
Profile
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. [ Sunday, May 02, 2004 07:57: Message edited by: Morgan ] Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Warrior
Member # 4238
|
written Sunday, May 2 2004 09:42
Profile
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? Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Warrior
Member # 4238
|
written Sunday, May 2 2004 09:46
Profile
By the way, here's the way to (probably) fix it. This is in pseudocode since I don't know Avernumscript: Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Shaper
Member # 22
|
written Sunday, May 2 2004 09:47
Profile
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. [ Sunday, May 02, 2004 10:09: Message edited by: Morgan ] Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Warrior
Member # 4238
|
written Sunday, May 2 2004 09:58
Profile
quote: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. Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Shaper
Member # 22
|
written Sunday, May 2 2004 10:14
Profile
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. [ Sunday, May 02, 2004 10:18: Message edited by: Morgan ] Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Infiltrator
Member # 169
|
written Sunday, May 2 2004 11:10
Profile
current_town_size() doesn't work? Posts: 422 | Registered: Tuesday, October 16 2001 07:00 |
Shock Trooper
Member # 4180
|
written Sunday, May 2 2004 11:11
Profile
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... -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Board Administrator
Member # 1
|
written Sunday, May 2 2004 13:37
Profile
Homepage
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 -------------------- Official Board Admin spidweb@spiderwebsoftware.com Posts: 960 | Registered: Tuesday, September 18 2001 07:00 |
Warrior
Member # 4238
|
written Sunday, May 2 2004 13:48
Profile
quote: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. Posts: 70 | Registered: Monday, April 12 2004 07:00 |
BANNED
Member # 4
|
written Sunday, May 2 2004 18:46
Profile
Homepage
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. -------------------- * Posts: 6936 | Registered: Tuesday, September 18 2001 07:00 |
Apprentice
Member # 4168
|
written Sunday, May 2 2004 19:02
Profile
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. -------------------- Guyute was the ugly pig who walked on me and danced a jig that he had learned when he was six - then stopped and did some other tricks. Like pulling weapons from his coat and holding them against my throat. He lectured me in language strange - then scampered quickly out of range. Posts: 24 | Registered: Sunday, March 28 2004 08:00 |
Triad Mage
Member # 7
|
written Monday, May 3 2004 00:28
Profile
Homepage
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. -------------------- "At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander ==== Drakefyre's Demesne - Happy Happy Joy Joy Encyclopedia Ermariana - Trapped in the Closet ==== You can take my Mac when you pry my cold, dead fingers off the mouse! Posts: 9436 | Registered: Wednesday, September 19 2001 07:00 |
Shaper
Member # 22
|
written Monday, May 3 2004 01:17
Profile
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. Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Warrior
Member # 4238
|
written Monday, May 3 2004 04:57
Profile
quote: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. Posts: 70 | Registered: Monday, April 12 2004 07:00 |
Shaper
Member # 22
|
written Monday, May 3 2004 07:06
Profile
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. [ Monday, May 03, 2004 07:08: Message edited by: Morgan ] Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Board Administrator
Member # 1
|
written Monday, May 3 2004 12:43
Profile
Homepage
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 -------------------- Official Board Admin spidweb@spiderwebsoftware.com Posts: 960 | Registered: Tuesday, September 18 2001 07:00 |
Shaper
Member # 22
|
written Monday, May 3 2004 21:29
Profile
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. Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Board Administrator
Member # 1
|
written Tuesday, May 4 2004 00:01
Profile
Homepage
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 -------------------- Official Board Admin spidweb@spiderwebsoftware.com Posts: 960 | Registered: Tuesday, September 18 2001 07:00 |
Shaper
Member # 22
|
written Tuesday, May 4 2004 05:51
Profile
Sent. Thanks for taking a look. Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |
Board Administrator
Member # 1
|
written Tuesday, May 4 2004 12:53
Profile
Homepage
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 -------------------- Official Board Admin spidweb@spiderwebsoftware.com Posts: 960 | Registered: Tuesday, September 18 2001 07:00 |
Shock Trooper
Member # 4180
|
written Tuesday, May 4 2004 13:30
Profile
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... :) -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Board Administrator
Member # 1
|
written Tuesday, May 4 2004 14:17
Profile
Homepage
"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 -------------------- Official Board Admin spidweb@spiderwebsoftware.com Posts: 960 | Registered: Tuesday, September 18 2001 07:00 |
Triad Mage
Member # 7
|
written Thursday, May 6 2004 01:23
Profile
Homepage
See Morgan, I did tell you that there was a parentheses problem. -------------------- "At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander ==== Drakefyre's Demesne - Happy Happy Joy Joy Encyclopedia Ermariana - Trapped in the Closet ==== You can take my Mac when you pry my cold, dead fingers off the mouse! Posts: 9436 | Registered: Wednesday, September 19 2001 07:00 |
Shaper
Member # 22
|
written Thursday, May 6 2004 06:15
Profile
*goes to school, relearns how to count* Posts: 2862 | Registered: Tuesday, October 2 2001 07:00 |