KeyPress gets stuck

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 440
Joined: Sat Feb 15, 2014 9:54 am
Contact:

KeyPress gets stuck

Post by rrTea » Tue Dec 22, 2020 12:42 pm

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnUpdate>
    <KeyPress Keys="1">
      <OnPressed>
        <ZExpression>
          <Expression>
<![CDATA[trace ("Exit");
quit();]]>
          </Expression>
        </ZExpression>
      </OnPressed>
    </KeyPress>
  </OnUpdate>
</ZApplication>
Run it from Preview, press "1" after starting it.
Now try running it again. It'll quit by itself.

This is bad because for example if your game crashes during playtesting, the next time you launch it the KeyPress component will act as if you're still pressing whatever it was you were pressing at the moment of the crash. This can result in some truly bizarre ingame behavior.

The only way to "revive" the KeyPress component is to press the key (that it thinks you're still holding down) again.

User avatar
VilleK
Site Admin
Posts: 2152
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: KeyPress gets stuck

Post by VilleK » Tue Dec 22, 2020 2:26 pm

Hi,

This should now be fixed: http://www.zgameeditor.org/files/ZGameEditor_beta.zip

This version is now built with the latest Delphi 10.4 version so please let me know if anything behaves odd.

About your other thread with the OnClose not calling that is not so easy to fix. The quit() function is a bit special and it executes differently at runtime compared to in the designer.

Hope you have a nice Christmas holidays :)

User avatar
rrTea
Posts: 440
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Re: KeyPress gets stuck

Post by rrTea » Tue Dec 22, 2020 6:06 pm

Great, it works – thanks so much!!! Hope you have nice Christmas holidays too :)

I did notice a few things, for example some descriptions are garbled (admittedly this is my fault because I was using Unicode characters) but also some projects that used to run perfectly are now throwing strange errors:
剪贴板图片 (8).png
Same project runs perfectly in Preview, but when launched it's not working.
剪贴板图片 (8).png (1.04 KiB) Viewed 3481 times

User avatar
VilleK
Site Admin
Posts: 2152
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: KeyPress gets stuck

Post by VilleK » Wed Dec 23, 2020 9:47 am

Is is with this specific project only? Does it work to launch a simple project?

I'll make a new build later if this is a problem for you.

User avatar
rrTea
Posts: 440
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Re: KeyPress gets stuck

Post by rrTea » Wed Dec 23, 2020 6:27 pm

It seems it's affecting quite a few projects, everybody else who tested it (only one person but still :D maybe we'll hear from him later) was also unable to build a working exe. Simple projects seem to work. I noticed some other things, still investigating.

User avatar
Kjell
Posts: 1756
Joined: Sat Feb 23, 2008 11:15 pm

Re: KeyPress gets stuck

Post by Kjell » Thu Dec 24, 2020 3:43 pm

Hi guys,

A good number of the example projects also crash immediately ( including CleanseCube, Steering, TripleE, YakYakReader, ZPong ). Here's the error message for ZBlast.zgeproj

Image

K

User avatar
rrTea
Posts: 440
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Re: KeyPress gets stuck

Post by rrTea » Thu Dec 24, 2020 8:38 pm

Some projects can't be opened, for example when opening GLES2Demo, I get:
剪贴板图片 (9).png
(Haven't tested it on my other computers.)
剪贴板图片 (9).png (6.45 KiB) Viewed 3444 times
Edit 1: Actually to be precise it can be opened, it just crashes immediately.

Edit 2: While we're at the topic of official example files: the FPS demo (at least the version I have) also doesn't work out of the box, there's an extra ";" in the code.
Last edited by rrTea on Sun Dec 27, 2020 10:55 am, edited 1 time in total.

User avatar
VilleK
Site Admin
Posts: 2152
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: KeyPress gets stuck

Post by VilleK » Fri Dec 25, 2020 9:38 am

Ok I think I know why this is happening. I need to rebuild player.bin. I made some optimizations to how global variables in ZLibraries are accessed and currently that change is in the IDE only and not the runtime. I'll fix it on Monday.

User avatar
VilleK
Site Admin
Posts: 2152
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: KeyPress gets stuck

Post by VilleK » Mon Dec 28, 2020 8:56 am

I rebuilt player.bin and now everything seems to work here again: http://www.zgameeditor.org/files/ZGameEditor_beta.zip

User avatar
rrTea
Posts: 440
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Re: KeyPress gets stuck

Post by rrTea » Mon Dec 28, 2020 9:06 am

Works here too (at least the projects I tried), excellent! Thank you :!: :!: :!:

Post Reply