Axe Software Forums
  Quest Developer Forum
  Found another QDK Bug ;-)


Author Topic:   Found another QDK Bug ;-)
Tyrant posted 10-11-2001 04:55 GMT     
In QDK v3.04, I found a bug when copying commands or procedures. Here's a snippet of coding from the area of error:

define procedure <rockcreature>
{
set numeric <rockcreatureattack; $rand(1;2)$>
set numeric <enemyhitchance; $rand(1;4)$>
if ( %rockcreatureattack% = 1 ) then {
msg <|n|b#enemy#|xb launches itself at you with its small, rock body... |xn>
if ( %enemyhitchance% = 1 ) then {
pause <600>
msg < |b|cgMISS!|cb|xb>
}
else {
pause <600>
msg < |b|cr-1 HP|cb|xb>
set numeric <hp; %hp% -1>
}
}
else {
msg <|n|b#enemy#|xb summons a small blizzard of stones... |xn>
if ( %enemyhitchance% = 1 ) then {
pause <600>
msg < |b|cgMISS!|cb|xb>
}
else {
pause <600>
msg < |b|cr-1 HP|cb|xb>
set numeric <hp; %hp% -1>
}
}
pause <1900>
set numeric <turn; 0>
do <battleproc>
}
end define


This procedure happens to be the attack of a creature called "Rock Creature". The creature has two possible attacks (The Rock Launch or the Stone Blizzard), so the first thing the procedure does is set the attacks to occur randomly.

1 = Rock Launch
2 = Stone Blizzard

The game then sets the %enemyhitchance% to a random of 1, 2, 3, or 4. If it turns up 1, then the enemy's attack will miss. Anything else and the attack will hit, so it has a 25% chance of missing you.

Finally, the game checks which attack is going to happen. If %rockcreatureattack% is 1, then it does the Rock Launch procedure along with checking whether it will miss or not. If it is not 1 (therefore it must be 2), then the enemy attacks with the Stone Blizzard.

What had happened was I did the Rock Launch procedure first as it was in the THEN box. Then, since both attack procedures are pretty much the same with minor adjustments, I just copied the Rock Launch commands and put them in the Else box, then modified them to fit the Stone Blizzard attack.

THE ERROR happens here. Whatever I change in the Stone Blizzard procedure, which is the copied and pasted one, the same changes automatically copy over to the Rock Launch procedure, and vise versa. It seems QDK doesn't know that I copied, so it changes both procedures as if it were one!

Again, this will have to be done in QDK as I'm sure it probably doesn't do this with pure coding. Simply make a procedure, copy it, paste it, then change the procedure to see if the changes copy over to the pasted one. Hope this helps.

Wow, my 3rd bug. I'm on a role!

Alex posted 10-11-2001 11:30 GMT          
Cheers for pointing this out. I've got a pretty good idea what must be happening here so I'll take a look at it.

Cheers
Alex

Pikaflare posted 10-11-2001 17:09 GMT          
Good for you. Lol, I found thatone too, but I just put it aside and forgot about it. it only happened to me once so I thought it was something I did.

Maxpowr