All Projects → binux → ankulua-vision

binux / ankulua-vision

Licence: other
UI to help making ankulua scripts

Programming Languages

lua
6591 projects
Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

ankulua-vision

An electron app to help making AnkuLua scripts.

You need AnkuLua to use the scripts generated by this app

AnkuLua:

AnkuLua is an Android app that focus on the automation of any Android app. The basic operations are:

Download

https://github.com/binux/ankulua-vision/releases

How to use

screenshot

  1. Run the app, select your work folder for the script.
  2. Add screen capture of the game by clicking Add Screen or drag and drop into the window.
  3. Name the screen like base, battle, mission
  4. Click Add Detect Zone and drag and draw the region that can be used to identify the screen.
  • You could adjust the similarity required or search range if the position may changes.
  • If you are detecting a popup dialog that partly overlaying on another screen, make sure add more detect zones than the lower layer screen. Otherwise it may detected as the screen below the dialog.
  1. Click Add Hotspot and drag and draw the region that can be clicked, and list all possible screens it may link to.
  • You could adjust the similarity and search range like detect zone.
  • You could use them later in your lua script (see below).
  • After region created, you can double click it and jump between screens.
  1. Back and Save & Generate
  2. Start editing your script <WORK_FOLDER>/start.lua

Script & APIs

Edit the script <WORK_FOLDER>/start.lua with your favorite editor.

It's basically a AnkuLua script written in lua language. You could find more information from here or here in Chinese

stateMachine:goto(...)

Goto one or more screens/states. Example: stateMachine:goto('base', 'mission', 'battle', 'missionResult');

Return: last state

stateMachine:find([region], image, [timeout])

Find image, you could use the file generated by ankulua-vision, if you do so, find method will respect the similarity and search range you set. If timeout set, it will wait up to timeout seconds before return nil. Example: stateMachine:find('btn_base_combat', 10)

Return: Match Object or nil

stateMachine:dragFind(image, down, left)

Drag the screen and find the image. down > 0 drag down, down < 0 drag up, down = 0 drag up then down. left > 0 drag left, left < 0 drag right, left = 0 drag right then left

Return: Match Object or nil

stateMachine:click(image, [timeout])

Click on image, if image is a file generated by ankulua-vision, it will respect the setting, and try to match the image before click, you could set similarity to 0 by skip image matching and always click the region. if timeout set, it will wait up to timeout seconds before return nil.

Return: true if success

stateMachine:zoomOut()
stateMachine:checkState(state)

Return: score if match given state

stateMachine:getState()

Return: current state

stateMachine:leaveState(state, timeout=10)

Wait until leave state

Return: true if success

stateMachine:waitStates(states, [timeout])

Wait until enter state or states, example: stateMachine:waitStates({'base', 'battle'})

stateMachine:plan(state, target)
stateMachine:play(state, target)
stateMachine:register(state, target, action)

Register an action(type: function) from state to target, target could be a name of existing screen or a new screen. You can stateMachine:goto the target screen you defined here. It can be used to defined complex state transfers or short cuts. action is a function, and must return a known state name. Example:

stateMachine:register('mission', 'mission_43e_select', function ()
  stateMachine:log('select mission')
  stateMachine:click('btn_mission_mission_ep04.png', 2)
  stateMachine:click('btn_mission_emergency.png', 2)
  if not stateMachine:click('btn_mission_ep04_emergency_combatSetting.png', 3) then return end
  return stateMachine:waitStates("combatSetting")
end)

stateMachine:goto('mission', 'mission_43e_select', 'combat')
option:
stateMachine.highlightTime = 0.3
stateMachine.highlightFind = true
stateMachine.highlightClick = true

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:9080
npm run dev

# build electron application for production
npm run build

This project was generated with electron-vue@fad1966 using vue-cli. Documentation about the original structure can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].