Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lua [2017/07/05 12:26]
alex_curran
lua [2020/07/24 11:32] (current)
alexcurran1
Line 141: Line 141:
 You are recommended to keep Tap Action scripts shorter e.g. by running functions in the main script file, as Tap Action scripts are stored in the XML file and not the separate script file. You are recommended to keep Tap Action scripts shorter e.g. by running functions in the main script file, as Tap Action scripts are stored in the XML file and not the separate script file.
  
-===== Run Lua Function Every Second or Millisecond =====+===== Run Lua Function Every Hour, Minute, Second or Millisecond ===== 
 + 
 +    function on_hour(h)           - every hour (h = hour) 
 +    function on_minute(h, m)      - every minute (h = hour, m = minute) 
 +    function on_second(h, m, s)   - every second (h = hour, m = minute, s = second) 
 +    function on_millisecond(dt)   - every millisecond (dt = delta time)
  
 If you have some custom variables that update every millisecond, you can create an //on_millisecond(..)// function in your script file. This function will be called every millisecond. In the example below this will move points around a circle (co-ordinates stored in var_ms_posx and var_ms_posy) : If you have some custom variables that update every millisecond, you can create an //on_millisecond(..)// function in your script file. This function will be called every millisecond. In the example below this will move points around a circle (co-ordinates stored in var_ms_posx and var_ms_posy) :
Line 204: Line 209:
 WatchMaker extends the Lua commandset. Just use the wm_action() or other functions anywhere in your script or tap actions : WatchMaker extends the Lua commandset. Just use the wm_action() or other functions anywhere in your script or tap actions :
  
-    wm_action('sw_start_stop'      -- start or stop the stopwatch +    wm_action('sw_start_stop'         -- start or stop the stopwatch 
-    wm_action('sw_reset'           -- reset stopwatch +    wm_action('sw_reset'              -- reset stopwatch 
-    wm_action('m_update_weather'   -- update weather +    wm_action('m_update_weather'      -- update weather 
-    wm_action('m_task:MyTask'      -- run Tasker task 'MyTask' +    wm_action('m_task:MyTask'         -- run Tasker task 'MyTask' 
-    wm_action('color_switch_next'  -- Color Switch: next color +    wm_action('color_switch_next'     -- Color Switch: Next Color 
-    wm_action('color_switch_prev'  -- Color Switch: previous color +    wm_action('color_switch_prev'     -- Color Switch: Previous Color 
-    wm_action('color_switch_select') -- Color Switch: select color +    wm_action('color_switch_select'   -- Color Switch: Select Color 
 +    wm_action('tap_launcher'          -- Launch Tap Launcher 
 +    wm_action('widget_weather'        -- Launch Weather Widget 
 +    wm_action('widget_health'         -- Launch Health Widget 
 +    wm_action('widget_calendar'       -- Launch Calendar Widget 
 +            
     wm_schedule('...'    -- schedule an animation or event (see Scheduling Animations / Functions)     wm_schedule('...'    -- schedule an animation or event (see Scheduling Animations / Functions)
     wm_unschedule_all()    -- unschedule all animations or events     wm_unschedule_all()    -- unschedule all animations or events
     wm_vibrate(d, r)       -- vibrate for duration d (milliseconds) and repeat r times      wm_vibrate(d, r)       -- vibrate for duration d (milliseconds) and repeat r times 
 +    wm_sfx('sfx_file'    -- play MP3 file with name sfx_file.mp3 (needs to be in /BeautifulWatches/sfx) - supported watches with speaker only
     wm_transition('...'  -- run a transition (see Transitions)     wm_transition('...'  -- run a transition (see Transitions)
 +    wm_anim_set('layerName', 'anim_in', 'Typewriter"    -- set animation in for 'layerName' to Typewriter
 +    wm_anim_set('layerName', 'dur_in', 1.0)     -- set duration in for 'layerName' to 1.0 (or use -1 for default)
 +    wm_anim_start('layerName'   -- start animation on 'layerName'
     wm_tag('...'         -- ONLY use for dynamic variables otherwise will break     wm_tag('...'         -- ONLY use for dynamic variables otherwise will break
                                 return a value of a WatchMaker tag, e.g. wm_tag("{c"..var_myvar.."bp}")                                 return a value of a WatchMaker tag, e.g. wm_tag("{c"..var_myvar.."bp}")
lua.1499250373.txt.gz · Last modified: 2017/07/05 12:26 by alex_curran