johnv2pt0 Posted May 30, 2020 Share Posted May 30, 2020 Context: I've used the concepts from the weathermark script (Thanks!) to do the same thing to output coordinates. I've left some empty lines at the top of the newly created markpoint so the user can label it if they want. Ie. Infantry, target 1, hilltop position...etc. Is it possible to capture what is written on the initial markpoint creation to then insert into the newly created point? Keyword for the process is COORDINATE. So if someone wanted to get the coordinates and also label it in one go they could type something like "COORDINATE, target 1". That would create the markpoint and also insert into the first line "target 1". Is that possible? -------------- mark point coords -------------- env.setErrorMessageBoxEnabled(false) --Coordinate_Keyphrase = 'C' Coordinate_ID = 500 --initial CoordMarkVec3 = {} coordMarkHandler = {} function coordMarkHandler:onEvent(Event) if Event == nil or Event.idx == nil then --ignore event if not mark return true end -- Call event function when a marker has changed, i.e. text was entered or changed. if Event.id==world.event.S_EVENT_MARK_CHANGE then coordMarkChange(Event) end end function coordMarkChange(Event) if Event.id==world.event.S_EVENT_MARK_CHANGE then if Event.text ~= nil and ( Event.text:upper():find('C') or Event.text:upper():find('COORD') or Event.text:upper():find('COORDINATE') or Event.text:upper():find('COORDINATES') ) then CoordMarkVec3 = Event.pos --vec3 CoordMarkVec3Lat, CoordMarkVec3Lon = coord.LOtoLL(CoordMarkVec3) CoordMarkVec3MGRS = coord.LLtoMGRS( CoordMarkVec3Lat, CoordMarkVec3Lon ) Coordinate_ID = Coordinate_ID + 1 trigger.action.markToCoalition(Coordinate_ID, '\n\nDMS: '..mist.tostringLL(CoordMarkVec3Lat, CoordMarkVec3Lon, 2, 's')..'\nDDM: '..mist.tostringLL(CoordMarkVec3Lat, CoordMarkVec3Lon, 4)..'\nMGRS: '.. mist.tostringMGRS(CoordMarkVec3MGRS, 5), CoordMarkVec3, Event.coalition , false, 'Coordinates Added') trigger.action.removeMark(Event.idx) elseif Event.text ~= nil and ( Event.text:upper():find('HELP') or Event.text:lower():find('help') ) then --[[_cUnit = Event.initiator --not working MP _cGroup = _cUnit:getGroup() _cGroupID = _cGroup:getID()]] --trigger.action.outTextForGroup( _cGroupID, '-- CASE SENSITIVE-- \nCoordinate Mark:\n"C"\n"COORD"\n"COORDINATE"\n"COORDINATES"\n\nWeatherMark: \n"weather report" \n"weather report, metric" \n"weather report, imperial" \n"weather report, alt 1000, imperial" \n-- @ 1000 ft ASL in this example.', 20 ) --not working in MP? trigger.action.outTextForCoalition( 2, '-- CASE SENSITIVE-- \nCoordinate Mark:\n"C"\n"COORD"\n"COORDINATE"\n"COORDINATES"\n\nWeatherMark: \n"weather report" \n"weather report, metric" \n"weather report, imperial" \n"weather report, alt 1000, imperial" \n-- @ 1000 ft ASL in this example.', 20 ) trigger.action.removeMark(Event.idx) end end end world.addEventHandler(coordMarkHandler) env.info("Coordinate Mark 1.0 Loaded!") Link to comment Share on other sites More sharing options...
Recommended Posts