Script call Input.isTriggered/Pressed Help

Hey All!

My inventory screen is a separate map to which the player is transferred and returned- creating an 'opening' and 'closing' effect. For now I'm using 'tab' as the key that will transfer the player (open/close the inventory screen.) I've got everything working fine with the transfer and the return with one frustrating exception- for some reason the *very first* time tab is pressed, nothing happens. On the second keypress it works perfectly and with no delay/lag, and from then on any subsequent times it works perfectly as well- including returning from the Inventory screen map using the same call. I've tried swapping between Input.isTiggered and Input.isPressed, and they both operate the same way precisely, meaning they work as intended every other time except the very first time.

It seemed likely to me that one of the other events on the map might be causing this initial delay, so I also tried it from an entirely clean map (event-free) to test it, and it still behaves exactly the same way. First time tab is pressed nothing happens, then every other time it works fine. It needs to run parallel (for the record it does the same thing set to autorun even though the player can't move otherwise) but I tried switching around the priority, and it acts the same way.

Anyone had any similar issues, or have any thoughts? I know it's very likely I could be missing something simple, so I appreciate your patience in advance if that is the case!! Thanks so much, all, for your time/help!!
I think you should completely restructure the event, because as it is it has a very big disadvantage:

you would need a map event to transfer the player to the inventory on every map, and that is very error prone.


the better way to do this would be to have a common event running as that wouldhandle every map.
however as said that will require some restructuring because it would also run on the inventory map as well.

I would use it with a switch for "player on inventory ON/OFF" and a conditional branch inside the keycheck to see if the player should be trnasferred to inventory (if off) or to the last stored position (if on).

This change in the structure alone might solve your problem, because currently you are using two different scripts for the key check, scripts that have a different behaviour.

so make the changes, test again and report back here with the changed events if there are still problems.
I think you should completely restructure the event, because as it is it has a very big disadvantage:

you would need a map event to transfer the player to the inventory on every map, and that is very error prone.


the better way to do this would be to have a common event running as that wouldhandle every map.
however as said that will require some restructuring because it would also run on the inventory map as well.

I would use it with a switch for "player on inventory ON/OFF" and a conditional branch inside the keycheck to see if the player should be trnasferred to inventory (if off) or to the last stored position (if on).

This change in the structure alone might solve your problem, because currently you are using two different scripts for the key check, scripts that have a different behaviour.

so make the changes, test again and report back here with the changed events if there are still problems.

This, is such an amazing idea!! And makes a TON of sense. This is my first game, and although I've come very far with it, sometimes it takes me a while to deduce the smartest way to go about things- which I'm sure is true of all programming!

Thank you so much for this incredibly helpful response, I feel instinctively I will be successful with this method- but I will definitely let you know.

🙂
Also, "tab" might be an odd case given its usual functionality (moving focus through elements of the document). There's no default gamepad button mapped to that input, either...it'd be nice to allow players to use a gamepad/controller if they like~

I'd consider one of these, since I don't think they're used on the map by default (?):
  • "pageup" - represents Q, PageUp, or gamepad LB; or
  • "pagedown" - represents W, PageDn, or gamepad RB.
However, in those cases you can just use the built-in checks, no scripting required.
Also, "tab" might be an odd case given its usual functionality (moving focus through elements of the document). There's no default gamepad button mapped to that input, either...it'd be nice to allow players to use a gamepad/controller if they like~

I'd consider one of these, since I don't think they're used on the map by default:
  • "pageup" - represents Q, PageUp, or gamepad LB; or
  • "pagedown" - represents W, PageDn, or gamepad RB.
However, in those cases you can just use the built-in checks, no scripting required.
This is absolutely an option and was 100% my fallback. I just really like the idea of using tab, but in the end of course functionality will be the priority. Thanks so much for your help! 😀
[edit] too slow! xD

Hi there!
I did try it on a clean project here, and indeed there is this issue with the TAB button.
But when I switched it to "ok" instead of "tab" it worked fine.
So maybe it's better if you use one of the keys that are already mapped on the conditional branch?
1652975606069.png
[edit] too slow! xD

Hi there!
I did try it on a clean project here, and indeed there is this issue with the TAB button.
But when I switched it to "ok" instead of "tab" it worked fine.
So maybe it's better if you use one of the keys that are already mapped on the conditional branch?
View attachment 226785
Definitely an option- thank you so much for your help!! 😀
I think you should completely restructure the event, because as it is it has a very big disadvantage:

you would need a map event to transfer the player to the inventory on every map, and that is very error prone.


the better way to do this would be to have a common event running as that wouldhandle every map.
however as said that will require some restructuring because it would also run on the inventory map as well.

I would use it with a switch for "player on inventory ON/OFF" and a conditional branch inside the keycheck to see if the player should be trnasferred to inventory (if off) or to the last stored position (if on).

This change in the structure alone might solve your problem, because currently you are using two different scripts for the key check, scripts that have a different behaviour.

so make the changes, test again and report back here with the changed events if there are still problems.

It works!!!!! (Of course!) Many, many thanks!

Original thread: https://forums.rpgmakerweb.com/threads/script-call-input-istriggered-pressed-help.147742/