I have tried to create my own function for key presses where it will detect only once if a key has been pressed and released. All seems fine with it however when i try to get it to work with more than one key it fails. It will only work if the same key that was last pressed is pressed again before another key can used. I'm still a newbie with PB so forgive my mistakes

Code: Select all
Global press=1
Procedure KeyboardPressed(KeyID)
If press=1
If KeyboardPushed(KeyID)
press=0
ProcedureReturn 1
EndIf
ElseIf press=0 And KeyboardReleased(KeyID)
press=1
EndIf
EndProcedure
If Camera\move=0
If Inventory\pause=0
If KeyboardPressed(#PB_Key_Return)
Inventory\pause=1
EndIf
ElseIf Inventory\pause=1
If KeyboardPressed(#PB_Key_Return)
Inventory\pause=0
EndIf
EndIf
If Inventory\pause=1
DisplaySprite(#Inventory,0,16)
DisplayTransparentSprite(#Selector,Inventory\x,Inventory\y)
If KeyboardPressed(#PB_Key_Right)
Inventory\x+32
EndIf
EndIf
EndIf