# Action\_id cannot handle multiple inputs

**URL:** <https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350>\
**Category:** Questions\
**Created:** [February 13, 2022, 2:19pm UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350 "2022-02-13T14:19:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [February 13, 2022, 2:19pm UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/1 "2022-02-13T14:19:35Z")

</div>

For my game, I am trying to implement a 4 way cardinal attack, similar to hollow knights slashing, however In the process I cannot attack and full hop (holding a jump input) simultaneously due to action id having trouble reading multiple inputs, any advice about how I could go about implementing this would be appreciated.

---

<div class="post-metadata">

**Author:** ![Dzuvan](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dzuvan/32/11275_2.png) [@Dzuvan](https://forum.defold.com/u/Dzuvan)\
**Post date:** [February 13, 2022, 2:25pm UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/2 "2022-02-13T14:25:36Z")

</div>

I would make a variable

```lua
-- in init
self.is_jumping = false
-- on input
--code for reading input
if action.pressed then self.is_jumping = true
else if action.released then self.isjumping = false
end

```

And then in place where you do attack check if self.is\_jumping is true alongside input

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 13, 2022, 9:31pm UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/3 "2022-02-13T21:31:38Z")

</div>

> [@Stale](#):
>
> due to action id having trouble reading multiple inputs

I don’t quite understand this.

Each key or other input event ([mapped in input bindings](https://defold.com/manuals/input/#setting-up-input-bindings)) that is triggered in a frame will generate a call to the on\_input() lifecycle event. This means that you may get multiple calls to the on\_input() function in a frame. Use `action_id` to determine which event it is and apply the appropriate game logic.

---

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [February 14, 2022, 9:56am UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/4 "2022-02-14T09:56:47Z")

</div>

as a print of my action\_id in use, while holding up and right

> DEBUG:SCRIPT: hash: [Right]  
> DEBUG:SCRIPT: hash: [Up]  
> DEBUG:SCRIPT: hash: [Right]  
> DEBUG:SCRIPT: hash: [Up]  
> DEBUG:SCRIPT: hash: [Right]  
> DEBUG:SCRIPT: hash: [Up]  
> DEBUG:SCRIPT: hash: [Right]  
> DEBUG:SCRIPT: hash: [Up]  
> DEBUG:SCRIPT: hash: [Right]

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 14, 2022, 10:00am UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/5 "2022-02-14T10:00:07Z")

</div>

Yes? It looks like you are getting both Right and Up, one after the other, exactly as expected.

---

<div class="post-metadata">

**Author:** ![Stale](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/stale/32/32618_2.png) [@Stale](https://forum.defold.com/u/Stale)\
**Post date:** [February 14, 2022, 10:40am UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/6 "2022-02-14T10:40:29Z")

</div>

Oh I thought every print line was a frame

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [February 14, 2022, 10:43am UTC](https://forum.defold.com/t/action-id-cannot-handle-multiple-inputs/70350/7 "2022-02-14T10:43:24Z")

</div>

No.  
Put a print in your update() function, and you’ll see.
