Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of two keyispressed conditions in an if statement causes massive weirdness in windows port of game.exe #179

Closed
ohrrpgce-bugbot opened this issue Mar 19, 2006 · 6 comments
Labels
bug Yeah... that's broken os: windows Windows-specific rel: tirgoviste Present in tirgoviste 2006-03-15

Comments

@ohrrpgce-bugbot
Copy link

[bz#179]

This is primarily a problem with the Windows port of Game.exe. If there are two
keyispressed conditions in an if statement, then the commands within the
conditional won't run even if both keys are pressed. For example:

if(keyispressed(Ctrl),and,keyispressed(Space)) then(showtextbox(1))

The script works fine in the DOS version of game.exe, but fails in the windows
port. This is indeed weird, but not yet massively weird. What really is
massively weird is that, when I used a debugging trick to check if the
keyispressed conditions, both of them come up as true! So game.exe knows that
both buttons are being pressed, but the stuff within the if conditional still
doesn't run.

I had thought it might've been a problem with the ",and," function, but it's
not, since if(true,and,true) stil works fine in the windows port. So I think
it's mostly a problem with the keyispressed function.

I attached a test file to clarify things.

From: @Spencer-Zhang
Reported version: 20060315 Tirgoviste
Operating system: Windows XP
Blocker for: bz⁠#255

@ohrrpgce-bugbot
Copy link
Author

Comment author: @Spencer-Zhang

Created attachment 74
Test case for the bug. The script used is included, and is simple enough to speak for itself.

Attached file: bugtest.zip (application/x-zip-compressed, 10855 bytes)
Description: Test case for the bug. The script used is included, and is simple enough to speak for itself.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

I've heard this bug before. I was talking about it with Cube, and I don't know what happened, probably
Cube reported his own keyispressed problems, but the testcase we ended up with for Bug bz⁠#140 wasn't
about the double keyispressed problem but was about textbox issues? and I forgot about the original
symptom, probably concluding it wan't keyispressed's fault. Actually you seem to have a textbox there.
Maybe Bug bz⁠#140 needs reopening.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @Spencer-Zhang

It's not limited to textboxes. I used textboxes here because it seemed to be
the easiest way to get results. The same problem showed up in my game, which
had nothing to do with textboxes, and which is much too complicated to use as a
test case, but which I'm going to link to as a reference anyways.
http://rmsephy.250free.com/batdemo1.zip

@ohrrpgce-bugbot
Copy link
Author

Comment author: @pkmnfrk

I tried a simple test script, since I thought I noticed similar behaviour at one
point:

while(true) do, begin
if(key is pressed(key:A)) then (alter npc(0,npc stat: palette,1)) else
(alter npc(0,npc stat: palette,0))
if(key is pressed(key:S)) then (alter npc(1,npc stat: palette,1)) else
(alter npc(1,npc stat: palette,0))
if(key is pressed(key:A), and, key is pressed(key:S)) then (alter npc(2,npc
stat: palette,1)) else (alter npc(2,npc stat: palette,0))
wait(1)
end

I made a simple game with a few "button" npcs. That script alters the palettes
of the npcs depending on the states of the respective keys (A and S) (palette 1
(a red colour) for pressed, or palette 0 (a grey colour) for unpressed). And, I
had a button with both keys on it, set to highlight if both keys are pressed.

When I ran the game (with that script set as the new game script), I got these
results:

Pressing A: A lights up, S and AS do not.
Pressing S: S lights up, A and AS do not.
Pressing A and S simultaneously: All keys light up.
Pressing A, waiting a second, and pressing S: A lights up, then S lights up. AS
flickers a bit, then lights up.

So. I'm guessing it's that flickering in the last case that is the problem. I'm
also attaching the test case, script included.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @pkmnfrk

Created attachment 75
"Key is Pressed" test case

Try keyis.rpg and see for yourself.

Attached file: keyis.zip (application/x-zip, 10740 bytes)
Description: "Key is Pressed" test case

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

Fixed. This bug is alot simpler than I thought it was (which had kept me away).

@ohrrpgce-bugbot ohrrpgce-bugbot added bug Yeah... that's broken os: windows Windows-specific rel: tirgoviste Present in tirgoviste 2006-03-15 labels Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Yeah... that's broken os: windows Windows-specific rel: tirgoviste Present in tirgoviste 2006-03-15
Projects
None yet
Development

No branches or pull requests

1 participant