Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ichthys

Pages: [1]
1
Scripting Corner / Re: Simulated Q Button for EOSM
« on: January 29, 2021, 10:18:41 AM »
@garry23

Variables are local. The problem is that by defining a local variable/parameter 'key' you then cannot refer to the global 'key' to do: key.press(KEY.Q).

By doing key.press(KEY.Q) you are trying to refer to the local variable 'key' and call the method .press() which doesn't exist for that local parameter.

2
Scripting Corner / Re: Simulated Q Button for EOSM
« on: January 28, 2021, 03:41:03 PM »
Reformatted the script a bit:

Code: [Select]
-- Open ML submenus with INFO
-- This script remaps the INFO button to [Q] when ML menu is active.

function remap_info_to_q(key)
  if key == KEY.INFO and menu.visible then
    key.press(KEY.Q)
    return false
  else
    return true
  end
end

event.keypress = remap_info_to_q

Changes:
- first comment line is what appears in menu
- second line appears in menu as help text (description)
- use spaces for indentation (tabs width may be different in other editors)
- renamed the event handler
- removed the shoot_task hook (discussed here)

Fixed a bug with your code. You are using 'key' as the function parameter to remap_info_to_q which overloads the global 'key' module.

Code: [Select]
-- Open ML submenus with INFO
-- This script remaps the INFO button to [Q] when ML menu is active.

function remap_info_to_q(pressed_key)
  if pressed_key == KEY.INFO and menu.visible then
    key.press(KEY.Q)
    return false
  else
    return true
  end
end

event.keypress = remap_info_to_q

Pages: [1]