MantisBT - Soldat Dedicated Server
View Issue Details
0000213Soldat Dedicated ServerScripting Corepublic2012-05-19 02:022012-06-23 21:00
JotEmI 
 
normalminoralways
acknowledgedopen 
i386Debian GNU/Linux6.0
2.7.3 
 
0000213: GetKeyPress() not working properly
I've already mentioned it on the forums.soldat.pl. GetKeyPress() seems to always return false (at least for the "throw" key) when called inside OnWeaponChange event.

Quote from forums.soldat.pl:

[code]
const
Msg=$FFFF9922;

procedure AppOnIdle(Ticks: integer);
begin
    if(GetKeyPress(1,'Throw')=true)then
    begin
        WriteConsole(0,'Throw key pressed (AppOnIdle)!',Msg);
    end;
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
    WriteConsole(0,'In OnWeaponChange!',Msg);
    if(GetKeyPress(ID,'Throw')=true)then
    begin
        WriteConsole(0,'Throw key pressed (OnWeaponChange)!',Msg);
    end;
end;
[/code]

The one in AppOnIdle does seem to work but GetKeyPress() in OnWeaponChange always returns false.
I've added a little debug info to check whether pressing the throw key calls OnWeaponChange and it does.

One more strange thing. If you have no weapon (thus OnWeaponChange won't be called) and press and hold the throw key the message in AppOnIdle will spam every second, which is correct. But if you got a weapon, press and hold the throw key (calling OnWeaponChange) you will only get one or zero messages from AppOnIdle. Like somehow after OnWeaponChange() result of GetKeyPress() is set to be always false.
No tags attached.
Issue History
2012-05-19 02:02JotEmINew Issue
2012-06-23 21:00FalconStatusnew => acknowledged

There are no notes attached to this issue.