I’m totally guessing, but it’s probably semi-random and not something you can control, like the order of messages, init functions, etc. What are you trying to do?
Ah, so you have actions of different priority? If I understand correctly, can’t you just run your code, in order, in one on_input call? As in something like:
function on_input(self, action_id, action)
if action_id == hash("click") and action.pressed then
if isPositionWalkable(action.screen_x, action.screen_y) then
walk()
elseif self.mouse_colliding_object then
use_object()
elseif self.mouse_colliding_folder then
open_folder()
elseif . . .
You’d have to make a count within the on_input function. Input triggers act like a baseball player. They catch it from outfield (Your devices, mouse, keyboard, etc) and throw it back to the pitcher (The input function). Not much else besides the positioning (for mouse inputs) and etc.
So, you’d have to do this within the on_input function, for just one action; the mouse_click.
function init(self)
msg.post("." "acquire_input_focus") -- This tells the game to send input information to this script
function on_input(self, action_id, action)
if action_id == "mouse_click" then
mouse_presses = mouse_presses + 1
if mouse_presses == 3 then
object_move = true
mouse_presses = 0
end
end
end
This is just an example to show you along what lines to go. You’d have to design the script yourself to your personal needs.
P.S: I notice you’re trying to use the triggers as different object presses. It doesn’t work that way. The triggers only receive the information coming from your devices, not the game. You’d have to then use that information to see if a folder, cabinet, chair, cup, or use was underneath the pointer at that point.
I think count mouse clicks not good idea, because it 3 click not one. I need one click for different actions.
And about incoming information from my device - I understand it, but different order created depending on triggers name and I think it not problem add for it ID, not only name, and create right order by user.
PS: I think it simple LUA table in Defold, but I can make mistake.
You should not rely on the order in which the actions are defined in the input bindings. As others have pointed out, you need to handle this in your game logic.