Jump to content

Recommended Posts

Posted

Inside the event:

Event OnKeyUp(Int code,Float HoldTime)

I have this:

ElseIf  code == inventory_key && !Utility.IsInMenuMode()	&& HoldTime < 1			;default key is 51, this is the ',' key
		dz_inventory_hotkey()
		Return
ElseIf  code == inventory_key && !Utility.IsInMenuMode()	;secondary use for this key, hold for longer than one second
		dz_inventory_open_hotkey()
		Return
.................

This works, but if I alter it to this:

ElseIf  code == inventory_key && !Utility.IsInMenuMode()	&& HoldTime < 1			;default key is 51, this is the ',' key
		dz_inventory_hotkey()
		Return
ElseIf  code == inventory_key && !Utility.IsInMenuMode()	&& HoldTime >= 1 && Holdtime < 5		;secondary use for this key, hold for longer than one second
		dz_inventory_open_hotkey()
		Return
ElseIf	code == inventory_key && !Utility.IsInMenuMode()	&& HoldTime >= 5
		dz_open_container()
		Return
  ........................................

Then no matter how long I hold the key the third elseif doesn't fire but the second does, is the comparison:

&& Holdtime < 5

is the second elseif not being assessed?

Should this work?

 

diziet

Posted

In theory what you have looks like it should work, but try reversing the order that they are in.  See if that helps in any way.

ElseIf HoldTime > 5
  ; do stuff
ElseIf HoldTime > 1
  ; do stuff
Else
  ; do stuff

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...