So I'm updating the kid dungeon to use relays instead of multiple switches. There's a place where you can create monsters by pressing a button on the wall. After i made the changes, it creates the monsters fine if you press the button steadily, and after the rechargetime has expired. However, if you repeatedly press it very quickly, RTC bombs:
Error:
an access violation exception.
Stack Dump:
RTC.TriggerMonsterGenerator(int 312, int 1);
RTC.EmptyTriggerQueue();
RTC.UpdateDungeon();
RTC.DoFrame(int 50);
RTC.WinMain();
Here's the dungeon code for this structure:
614        WALLITEM_RELAY                                1        18        1        SOUTH        ACTION=(ACTIVATE)        TARGET=(650)
615        WALLITEM_RELAY                                1        18        1        SOUTH        ACTION=(ACTIVATE)        TARGET=(618)         DELAY=(4)
617        WALLITEM_SWITCH_GREEN                        1        18        1        EAST        OPBY=(MOUSE)        ACTION=(ACTIVATE)        TARGET=(614,615)
618        FLOORITEM_GENERATOR_MONSTER                0        19        1        GENERATES=(MONSTER_ROCKPILE)        NUMBERS=(1)        HEALTH=(25)        OPTIONS=(SOUND:SOUND_STEP_ANIMAL,RECHARGE_TIME:12)
650        WALLITEM_SHOOTER                        0        20        1        NORTH        TYPE=(SINGLE)        SHOOTS=(DUNGEON_SPELL_DESEW)        STRENGTH=(100)
Incidentally, it also crashes using my old method of lots of green switches performing the actions themselves....but only if you very quickly press the button, so it appears to be a problem with RTC keeping up, not the method used to create the effect.
Crash using v0.20 on creating monsters on demand
Moderator: George Gilbert
Forum rules
Please read the Forum rules and policies before posting. You may
to help finance the hosting costs of this forum.
Please read the Forum rules and policies before posting. You may
to help finance the hosting costs of this forum.
- Gambit37
- Should eat more pies
- Posts: 13791
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Crash using v0.20 on creating monsters on demand
Addendum:
It only crashes if the monster has not yet appeared by the time the button has been clicked for the second time. Normally, this wouldn't be a problem, but on this set-up, I have a delay of 4 for the relay controlling the generator, which I guess is messing things up.
Also, there's no crash if there is already a monster on the tile -- you can click the button as much as you like and as quickly as you like and everything is fine: no new monsters appear cos the tile is already occupied.
Seems that when the button is pressed for the first time, the relay gets fired which fires the generator 4 ticks later, creating the monster. But if you've already pressed the button again, before the 4 ticks have expired, RTC thinks the tile is still empty and tries to create another monster. Of course, then the original delayed monster appears and everything goes pear shaped... my guess is that RTC is only looking at the contents of the tile itself, and isn't taking into account any of the queued/delayed events for the tile....?
It only crashes if the monster has not yet appeared by the time the button has been clicked for the second time. Normally, this wouldn't be a problem, but on this set-up, I have a delay of 4 for the relay controlling the generator, which I guess is messing things up.
Also, there's no crash if there is already a monster on the tile -- you can click the button as much as you like and as quickly as you like and everything is fine: no new monsters appear cos the tile is already occupied.
Seems that when the button is pressed for the first time, the relay gets fired which fires the generator 4 ticks later, creating the monster. But if you've already pressed the button again, before the 4 ticks have expired, RTC thinks the tile is still empty and tries to create another monster. Of course, then the original delayed monster appears and everything goes pear shaped... my guess is that RTC is only looking at the contents of the tile itself, and isn't taking into account any of the queued/delayed events for the tile....?
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Re: Crash using v0.20 on creating monsters on demand
I've tried several times to replicate this but with no success. I think there must be something else going on (or else I've "accidently" fixed it whilst fixing something else).
Is there any chance you could please send me your complete file? If you can get it to me later today I'lll have a look over the w/e and get the fix into v0.21...
Is there any chance you could please send me your complete file? If you can get it to me later today I'lll have a look over the w/e and get the fix into v0.21...
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Re: Crash using v0.20 on creating monsters on demand
Fixed for V0.21.
This was obscure as well. The problem was nothing to do with the delay or pressing the button twice, but instead due to the interaction of a monster being generated on the same tile and at the same time as a Des-Ew spell exploding.
The code used to generate the monster, add it to the tile then set its attributes (in particular it's health). When adding to the tile, the collision detection routines (with the des-ew) were activated (but no damage was caused). On exiting the collision detection, the code noticed that the health was zero so deleted the monster from the dungeon. Then when trying to give a non existant monster some health the exception occured.
To fix it all I've done is made sure that the monsters have some health before they're added to the tile!
This was obscure as well. The problem was nothing to do with the delay or pressing the button twice, but instead due to the interaction of a monster being generated on the same tile and at the same time as a Des-Ew spell exploding.
The code used to generate the monster, add it to the tile then set its attributes (in particular it's health). When adding to the tile, the collision detection routines (with the des-ew) were activated (but no damage was caused). On exiting the collision detection, the code noticed that the health was zero so deleted the monster from the dungeon. Then when trying to give a non existant monster some health the exception occured.
To fix it all I've done is made sure that the monsters have some health before they're added to the tile!