[VX] Help me understand this script

I am using this script to trigger a common event by pressing a key, and it works fine! But now my question is this: is there anyway to assign a different key to trigger a different common event? (i.e: Pressing L triggers common event 7, pressing R trigger common event 8, and so on). 

This is the script:

class Scene_Map < Scene_Base # Common Event trigger key CallCommonEventKey = Input::L # Common Event ID to trigger CallCommonEventID = 7 # Frame Update alias sawnik_update :update def update sawnik_update update_common_event_trigger end # Update Common Event Trigger Check def update_common_event_trigger if not $game_message.visible and Input.trigger?(CallCommonEventKey) $game_temp.common_event_id = CallCommonEventID end endendThank you so much in advance for your time 🙂
class Scene_Map < Scene_Base CCEK = { # Key => Common Event ID Input::L => 7, Input::X => 2 # Last entry ends without comma } alias_method🙂ccek_update, :update) def update ccek_update unless $game_message.visible CCEK.each {|k, v| $game_temp.common_event_id = v if Input.trigger?(k)} end endendHello. That would be a possible solution for you. What it does? It creates a Hash that contains each key that you want to use, as the hash key, and each common event id that you want associated with that key, as its value. Then it iterates through the hash to check if the key has been triggered to set the correct common event id.
OH! It works perfectly!

Thank you so much!! 😀
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/vx-help-me-understand-this-script.21604/