Skip to content

Instantly share code, notes, and snippets.

@boq
Last active October 24, 2019 01:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boq/9a098b89ee102cbf1b2b to your computer and use it in GitHub Desktop.
Save boq/9a098b89ee102cbf1b2b to your computer and use it in GitHub Desktop.
OpenPeripheral Addons terminal glasses events
All events have same first three arguments: <1:source peripheral> <2:player name> <3:player uuid>
State events:
glasses_attach - player started wearing glasses
glasses_detach - player stopped wearing glasses
glasses_capture - player initiated capture mode (used keyboard)
glasses_release - player exited capture mode (exited gui screen)
Chat events:
glasses_chat_command <1:source peripheral> <2:player name> <3:player uuid> <4:command> - player wearing glasses typed text starting with '$$' in chat (note: this line will not be visible in global chat)
glasses_chat_message <1:source peripheral> <2:player name> <3:player uuid> <4:message> - player wearing glasses typed text into chat ('$$' messages are not included)
Keyboard event (available only in capture mode)
glasses_key_down <4:key code> <5:key character> <6:is repeated event>
glasses_key_up <4:key code>
Mouse events (when cursor wasn't over any component)
glasses_mouse_scroll <4:wheel distance>
glasses_mouse_down <4:button>
glasses_mouse_up <4:button>
glasses_mouse_drag <4:dx> <5:dy> // OpenPeripheralAddons > 0.4, dx, dy - distance from last drag or mouse down event
Mouse component events (when cursor was over any component) //NOTE: x and y are in component coordinates, so they include rotation
glasses_component_mouse_wheel <4:component id> <5:is private surface> <6:x> <7:y> <8:wheel>
glasses_component_mouse_down <4:component id> <5:is private surface> <6:x> <7:y> <8:button>
glasses_component_mouse_up <4:component id> <5:is private surface> <6:x> <7:y> <8:button>
Note: x and y are relative to component top left corner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment