Key Grave Missing? (DEF-2573) (SOLVED)

Is there a KEY_GRAVE for input? There is a key for tilde ~ but I can’t see for grave `. Does this exist and I’m just not seeing it? The reason is I’m making an extendable console and want to use it as the toggle key for it.

Speaking of KEY_TILDE I couldn’t get it to work either. Might be busted on Windows? Holding shift and the ` key doesn’t appear to work. I tested with other shift keys such as KEY_PIPE and it doesn’t work either. Something I’m missing about detecting these for input?

2 Likes

Reviving because this key would still be useful to have easy access to.

Just testing KEY_TILDE again and realized (or forgot) that on Windows none of the keys which require shift to be held down to press work? For example, KEY_HASH. Do they work on Mac but not on Windows? Very required for typing in passwords into online games.

I’ll look into this and get back to you. Added issue: DEF-2573

2 Likes

Posting again in this thread to say it is possible to detect ` in Vanilla Defold (and probably some other keys) but only through text_trigger actions

text_trigger {
  input: TEXT
  action: "text"
}
	if action_id == hash("text") and action.text == "`" then
		toggle_console(self)
	end
2 Likes

Shouldn’t those keys just be removed from the list? I mean there is no hash key on the keyboard, it’s just the 3 key. Just like there aren’t keys for capital letters.

The grave/tilde key is there, it’s called “backquote”.

Just tested and this works! Better solution for `

I’m not sure if it was there when the original OP was posted but it might have been.

Maybe ~ should be removed. It can be detected with the text_trigger method too but using a shift flag is better.

key_trigger {
  input: KEY_BACKQUOTE
  action: "key_backquote"
}
key_trigger {
  input: KEY_LSHIFT
  action: "shift"
}
key_trigger {
  input: KEY_RSHIFT
  action: "shift"
}
function on_input(self, action_id, action)

	if action_id == hash("shift") then
		self.shift = true
		
	end
	if action_id == hash("shift") and action.released then
		self.shift = false
	end	

	if self.shift == true and action_id == hash("key_backquote") and action.released then
		toggle_console(self)
	end

end
1 Like