Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function update_table()
- stepslat=wm_tag("{tmapsteplat()}")
- stepslon=wm_tag("{tmapsteplon()}")
- var_s_stepslat={}
- var_s_stepslon={}
- for lat in string.gfind(stepslat, "[-]?%d*[\.][-]?%d*")
- do
- table.insert(var_s_stepslat, lat)
- end
- for lon in string.gfind(stepslon, "[-]?%d*[\.][-]?%d*")
- do
- table.insert(var_s_stepslon, lon)
- end
- end
- update_table()
- function setmapvars()
- distance = wm_tag("{tmapdistance}")
- eta = wm_tag("{tmapeta}")
- startloc = wm_tag("{tmapstartloc}")
- endloc = wm_tag("{tmapendloc}")
- startadd = wm_tag("{tmapstartadd}")
- endadd = wm_tag("{tmapendadd}")
- steps = wm_tag("{tmapsteps}")
- var_s_distance = tostring(distance)
- var_s_eta = tostring(eta)
- var_s_startloc = tostring(startloc)
- var_s_endloc = tostring(endloc)
- var_s_startadd = tostring(startadd)
- var_s_endadd = tostring(endadd)
- var_s_steps = tonumber(steps)
- end
- end_loc = {}
- start_loc = {}
- function mapcoords()
- for endloc in string.gfind(var_s_endloc, "[-]?%d*[\.][-]?%d*")
- do
- table.insert(end_loc, endloc)
- end
- for startloc in string.gfind(var_s_startloc, "[-]?%d*[\.][-]?%d*")
- do
- table.insert(start_loc, startloc)
- var_start_lat = start_loc[1]
- var_start_lon = start_loc[2]
- var_end_lat = end_loc[1]
- var_end_lon = end_loc[2]
- end
- end
- setmapvars()
- mapcoords()
- tweens.map_lat = var_start_lat
- tweens.map_lon = var_start_lon
- length = 1
- var_run = 0
- function tweenmap()
- if var_run == 0 then
- wm_schedule
- { action='tween', tween='map_lat', from=var_start_lat, to= var_s_stepslat[var_run+1], duration=length, easing=linear }
- wm_schedule
- { action='tween', tween='map_lon', from=var_start_lon, to= var_s_stepslon[var_run+1], duration=length, easing=linear }
- var_run = var_run + 1
- elseif var_run <= var_s_steps then
- wm_schedule
- { action='tween', tween='map_lat', from=var_s_stepslat[var_run], to= var_s_stepslat[var_run+1], duration=length, easing=linear }
- wm_schedule
- { action='tween', tween='map_lon', from=var_s_stepslon[var_run], to= var_s_stepslon[var_run+1], duration=length, easing=linear }
- var_run = var_run + 1
- elseif var_run > var_s_steps then
- wm_schedule
- { action='tween', tween='map_lat', from=var_s_stepslat[var_run], to=var_end_lat, duration=length, easing=linear }
- wm_schedule
- { action='tween', tween='map_lon', from=var_s_stepslon[var_run], to=var_end_lon, duration=length, easing=linear }
- var_run = 0
- end
- end
- function new_directions()
- -- This can be ignored, it's a lazy formula to auto update steps and doesn't work LOL
- if math.floor((math.rad(var_s_stepslon[1]))*1000)/1000 == math.floor((math.rad({alon}))*1000)/1000 and math.floor((math.rad(var_s_stepslat[1]))*1000)/1000 == math.floor((math.rad({alat}))*1000)/1000 then
- wm_action('m_task:WMDirections')
- wm_vibrate(100,3)
- end
- end
- function on_second(h,m,s)
- if {abright} then
- setmapvars()
- if var_run == 0 then
- tweens.map_lat = {alat}
- tweens.map_lon = {alon}
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement