def exit(self): if (self.mode == "speech"): self.toggle_speech() self.release_hold_keys() self.mode = "regular" turn_on_sound() update_overlay_image("default") toggle_eyetracker()
def update_overlay( self ): if( not( self.ctrlKey or self.shiftKey or self.altKey ) ): update_overlay_image( "default" ) else: modes = [] if( self.ctrlKey ): modes.append( "ctrl" ) if( self.shiftKey ): modes.append( "shift" ) if( self.altKey ): modes.append( "alt" ) update_overlay_image( "mode-%s" % ( "-".join( modes ) ) )
def handle_input(self, dataDicts): super().handle_input(dataDicts) if (not self.detect("actions-muted")): self.file_skip_number = self.file_skip_number + 1 if ("X-" in self.detector.tickActions or "F-" in self.detector.tickActions): self.release('down') # Reapply the horizontal movement afterwards for key in self.hold_arrow_keys: if (key in ['left', 'right', 'down']): self.hold(key) elif ("X+" in self.detector.tickActions or "F+" in self.detector.tickActions): self.release('up') # Reapply the horizontal movement afterwards for key in self.hold_arrow_keys: if (key in ['left', 'right', 'up']): self.hold(key) # Only update the overlay file every 15 frames # For performance reasons if (self.file_skip_number > 15): self.file_skip_number = 0 x_diff = self.detector.pointerController.detect_origin_difference( 'x') if (self.detect('movement_inverted')): x_diff = x_diff * -1 x_distance = abs(x_diff) new_overlay_image = self.current_overlay_image if (x_distance < 50): new_overlay_image = 'coords-overlay' elif (x_distance >= 50 and x_distance < 200): new_overlay_image = 'coords-overlay-medium' if x_diff < 0 else 'coords-overlay-medium-right' elif (x_distance >= 200): new_overlay_image = 'coords-overlay-long' if x_diff < 0 else 'coords-overlay-long-right' if (self.detect('attack_prepared')): new_overlay_image = 'primed-' + new_overlay_image if (new_overlay_image != self.current_overlay_image): update_overlay_image(new_overlay_image) self.current_overlay_image = new_overlay_image return self.detector.tickActions
def exit( self ): if( self.mode == "speech" ): self.toggle_speech() update_overlay_image( "default" ) toggle_eyetracker()
def start( self ): update_overlay_image( "default" ) toggle_eyetracker()
def handle_sounds(self, dataDicts): disable_movement = False # MUTE actions except the unmute action if (self.detect("actions-muted")): if (self.detect('mute')): self.disable('actions-muted') self.print_key('UNMUTE') return if (self.detect('slash')): self.press('x') return elif (self.detect('spell')): self.press('f') return elif (self.detect('dash')): self.press('c') return elif (self.detect('up_slash')): # Release horizontal movement temporarily for key in self.hold_arrow_keys: if (key in ['left', 'right', 'down']): self.release(key) self.hold('up') self.press('x') self.print_key('X+') disable_movement = True elif (self.detect('down_slash')): # Release horizontal movement temporarily for key in self.hold_arrow_keys: if (key in ['left', 'right', 'up']): self.release(key) self.hold('down') self.press('x') self.print_key('X-') disable_movement = True elif (self.detect('directional_spell')): # Release horizontal movement temporarily for key in self.hold_arrow_keys: if (key in ['left', 'right']): self.release(key) # Do a spell cast depend on the location where the user is looking if (self.quadrant3x3 <= 3): self.release('down') self.hold('up') self.press('f') self.print_key('F+') elif (self.quadrant3x3 >= 7): self.release('up') self.hold('down') self.press('f') self.print_key('F-') else: self.detector.clear_throttle('directional_spell') disable_movement = True elif (self.detect('menu')): self.press('esc') self.toggle_singlepress(True) elif (self.detect('movement_modes')): self.toggle_singlepress(True) self.print_key('Stop') elif (self.detect('set_coordinate')): self.detector.pointerController.update_origin_coords() self.print_key('Point') return elif (self.detect('set_coordinate_left')): self.detector.pointerController.set_origin_coords_center_left() self.disable('movement_inverted') self.print_key('<Point') return elif (self.detect('set_coordinate_right')): self.detector.pointerController.set_origin_coords_center_right() self.disable('movement_inverted') self.print_key('Point>') return elif (self.detect("mute")): self.enable('actions-muted') self.print_key('MUTE') self.release_arrowkeys() self.current_overlay_image = 'coords-overlay' update_overlay_image(self.current_overlay_image) return elif (self.detect('dream_nail')): self.toggle('dream_nail_held') if (self.detect('dream_nail_held')): self.inputManager.keyDown('d') self.print_key('D') else: self.inputManager.keyUp('d') # Toggle the map open elif (self.detect('map')): self.toggle('tab') if (self.detect('tab')): self.inputManager.keyDown('tab') self.print_key('TAB') else: self.inputManager.keyUp('tab') elif (self.detect('inventory')): self.press('i') self.toggle_singlepress(True) # Make it possible to jump for various lengths of time regular_jump_held = self.detect('jump') inverse_jump_held = not regular_jump_held and self.detect( 'inverse_jump') if (inverse_jump_held): self.enable('movement_inverted') else: self.disable('movement_inverted') if (regular_jump_held or inverse_jump_held): if (self.detect('aerial-movement') == False): self.inputManager.keyDown('space') self.enable('aerial-movement') self.print_key('SPACE') elif (self.detect('aerial-movement')): self.inputManager.keyUp('space') self.disable('aerial-movement') self.release_arrowkeys() # If an attack was stored - Release it in the up direction self.check_attack_prepared('down') # Make it possible to charge A if (self.detect('charge')): disable_movement = True if (self.detect('charge-held') == False): self.inputManager.keyDown('a') self.print_key('a') self.enable('charge-held') elif (self.detect('charge-held')): self.inputManager.keyUp('a') self.disable('charge-held') # Make it possible to charge X if (self.detect('attack_charge')): if (self.detect('attack-held') == False): self.inputManager.keyDown('x') self.print_key('x') self.enable('attack-held') elif (self.detect('attack-held')): self.inputManager.keyUp('x') self.disable('attack-held') # Make it possible to charge S if (self.detect('hyper_dash')): disable_movement = True if (self.detect('dash-held') == False): self.inputManager.keyDown('s') self.print_key('S') self.enable('dash-held') elif (self.detect('dash-held')): self.inputManager.keyUp('s') self.disable('dash-held') if (self.detect('hold_arrowkeys')): if (self.detect('manual-movement') == False): self.enable('manual-movement') elif (self.detect('manual-movement')): self.disable('manual-movement') self.release_arrowkeys() # Prepare an attack for the future whenever movement changes if (self.detect('prepare_attack')): self.enable('attack_prepared') self.print_key('delay X') disable_movement = True # Movement types # Aerial movement if (self.detect('aerial-movement')): #if (self.detect('jump_horizontal')): self.handle_arrowkeys(dataDicts, "relative", False, 60, ['left', 'right']) #else: # if ( len(self.hold_arrow_keys) > 0 ): # for key in self.hold_arrow_keys: # self.release( key ) # self.hold_arrow_keys = [] # Manual movement elif (self.detect('manual-movement')): self.disable('precision-movement') self.handle_arrowkeys(dataDicts, "relative", True, 60, ['left', 'right']) # Precision movement - Button presses elif (self.detect('precision-movement')): if (self.detect('press_arrowkeys')): self.press_arrowkeys(dataDicts) # Regular eyetracker movement elif (not disable_movement): self.handle_arrowkeys(dataDicts, "relative", False, 200)
def start(self): super().start() self.enable('single-press-grid') self.disable('actions-muted') update_overlay_image(self.current_overlay_image)
def start(self): mute_sound() toggle_eyetracker() update_overlay_image("default")
def exit(self): self.mode = "regular" turn_on_sound() update_overlay_image("default") toggle_eyetracker()
def start(self): super().start() self.enable('single-press-grid') update_overlay_image('coords-overlay') self.toggle('play')