Zayets Posted August 23, 2018 Share Posted August 23, 2018 Yep, that worked a treat. Good to know that first point in the route table is not actually the initial point, at least on spawning. All is working as expected, even with On Road option. Many thanks again, drinks on me next time! [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
Montrose Posted August 23, 2018 Share Posted August 23, 2018 so I am trying to use variables to deal with some Randomization RedAir1Grp = Group.getByName('NalAir1') - this works Group.destroy(RedAir1Grp) - this works once above sets mist.respawnGroup(RedAir1Grp, true) - this does not Any thoughts? I am new to MIST so I may be off my rocker [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Chump Posted August 23, 2018 Share Posted August 23, 2018 respawnGroup() takes a string as the first argument. You are passing in a Group object. Use the group's name instead. mist.respawnGroup(RedAir1Grp:getName(), true); Link to comment Share on other sites More sharing options...
Montrose Posted August 23, 2018 Share Posted August 23, 2018 respawnGroup() takes a string as the first argument. You are passing in a Group object. Use the group's name instead. mist.respawnGroup(RedAir1Grp:getName(), true); Thanks Chump worked like a charm! :) [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Montrose Posted August 23, 2018 Share Posted August 23, 2018 Thanks Chump worked like a charm! :) Spoke to soon. it seemed to work the first time string mist.respawnGroup(RedAir1Grp:getName(),true:1 Group doesn't exist It looks like it can't pull the group name from the variable and I don't know what the actual group name is [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted August 24, 2018 Share Posted August 24, 2018 When you use mist.respawnGroup it doesn't change the name of the newly respawned group, it keeps all of the original information. So mist.respawnGroup('NalAir1') should work. Alternatively you can store the groups name while it is alive in a global variable or a local variable that is outside of the local scope which it is used. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Montrose Posted August 24, 2018 Share Posted August 24, 2018 (edited) problem is the group is randomly chosen from 4 different groups at which time I assign it the variable RedAir1Grp. I have no idea which group it is. it could be NalAir1, GudAir1, SukAir1 or AdlAir1. When I pass the variable to the group.destroy(RedAir1Grp) - RedAir1Grp being the variable it works and only kills the group that was randomly picked but the respawn does not. Edited August 24, 2018 by Montrose [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted August 24, 2018 Share Posted August 24, 2018 You can use RedAir1Grp:getName() before you destroy it. local usedGroup = RedAir1Grp:getName() RedAir1Grp:destroy() mist.respawnGroup(usedGroup, true) The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Zayets Posted August 26, 2018 Share Posted August 26, 2018 Hello there Grimes, suddenly, I get this message. I don't recall doing anything special, just desanitize the io library to export the DBs. Now I get this message and honestly I don't know how to debug it. Mind you, the group is still spawned after this message pops up 'n' times where 'n' is exactly the number of units in the group. Also, I have this message once when I quit the mission, if that helps. [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
flo57100 Posted August 26, 2018 Share Posted August 26, 2018 Hello there ! I wondered, is it possible to create a script to do the following thing: when coming back to the tarawa in my harrier, I use a radio menu and then I have a message (text on screen) that indicates me the course and speed of the ship. If I could I would do it myself, but I have absolutely zero skill regarding lua and programm language in general Link to comment Share on other sites More sharing options...
Grimes Posted August 27, 2018 Share Posted August 27, 2018 Hello there Grimes, suddenly, I get this message. I don't recall doing anything special, just desanitize the io library to export the DBs. Now I get this message and honestly I don't know how to debug it. Mind you, the group is still spawned after this message pops up 'n' times where 'n' is exactly the number of units in the group. Also, I have this message once when I quit the mission, if that helps. Might need the mission to test that one. Seems like the event handler might still be active and reacting to the mission end event. Hello there ! I wondered, is it possible to create a script to do the following thing: when coming back to the tarawa in my harrier, I use a radio menu and then I have a message (text on screen) that indicates me the course and speed of the ship. If I could I would do it myself, but I have absolutely zero skill regarding lua and programm language in general Ok. So I guess you gotta break it down for whats used. You need to get the unit object via Unit.getByName() and then getVelocity and getPosition. Then put it into a message that gets displayed with trigger.action.outText() Mist can simplify it. local function displayHeading() local u = Unit.getByName('tarawa') if u then local msg = {} msg[#msg+1] = 'Tarawa is heading: ' msg[#msg+1] = mist.getHeading(u, true) msg[#msg+1] = ' at ' msg[#msg+1] = mist.vec.mag(u:getVelocity()) * 1.94384 msg[#msg+1] = ' knots' trigger.action.outText(table.concat(msg), 30) end end Now this doesn't format the numbers at all. So there is a very real chance it displays 124.34529462 or something like that for the heading. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Zayets Posted August 27, 2018 Share Posted August 27, 2018 Might need the mission to test that one. Seems like the event handler might still be active and reacting to the mission end event. That was it basically. I was debugging it and left this snippet as a placeholder : playCommand = {} world.addEventHandler(playCommand) Not sure if lua see empty tables as nil ones but it actually fired at every event. Very annoying. All is good now. I really hate it when I can't properly debug a file. Thanks again. [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
flo57100 Posted September 1, 2018 Share Posted September 1, 2018 Ok. So I guess you gotta break it down for whats used. You need to get the unit object via Unit.getByName() and then getVelocity and getPosition. Then put it into a message that gets displayed with trigger.action.outText() Mist can simplify it. local function displayHeading() local u = Unit.getByName('tarawa') if u then local msg = {} msg[#msg+1] = 'Tarawa is heading: ' msg[#msg+1] = mist.getHeading(u, true) msg[#msg+1] = ' at ' msg[#msg+1] = mist.vec.mag(u:getVelocity()) * 1.94384 msg[#msg+1] = ' knots' trigger.action.outText(table.concat(msg), 30) end end Now this doesn't format the numbers at all. So there is a very real chance it displays 124.34529462 or something like that for the heading. Thanks for the script, but I have a question, how do you make it work in the mission editor ? I tried to make it work but nothing happened. I did the following in triggers: -1) when time >10 seconds execute script file mist and create a radio menu for my group (marker 1) 2) everytime marker 1 is true, do script, and I paste what you gave me in the ME script window Link to comment Share on other sites More sharing options...
Grimes Posted September 1, 2018 Share Posted September 1, 2018 Theres a couple different ways to do it. If you want to use a trigger with a flag, you can remove the line declaring it a function and also the corresponding end statement. So comment out the first and last line, then setting the flag will work just fine. Just remember that you will also need to set the flag to false if you wanted the command to work again. Alternatively you can just add the following below it in the code and set it up to run once at any time. missionCommands.addCommand("Get Heading', nil, displayHeading) This will add a F10 radio menu that directly calls the displayHeading function when you select it. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
flo57100 Posted September 2, 2018 Share Posted September 2, 2018 (edited) Theres a couple different ways to do it. If you want to use a trigger with a flag, you can remove the line declaring it a function and also the corresponding end statement. So comment out the first and last line, then setting the flag will work just fine. Just remember that you will also need to set the flag to false if you wanted the command to work again. Alternatively you can just add the following below it in the code and set it up to run once at any time. missionCommands.addCommand("Get Heading', nil, displayHeading) This will add a F10 radio menu that directly calls the displayHeading function when you select it. Thank you for your answer, it seems to work ! One more question, I have the message displayed with the infos, but ship course looks to be in radians instead of degrees, how to make the conversion within the script ? ***EDIT*** I just found it, thanks for your help Grimes, it works !!! :-D Edited September 2, 2018 by flo57100 Link to comment Share on other sites More sharing options...
Zayets Posted September 8, 2018 Share Posted September 8, 2018 Hi Grimes, here's a question on the getHeading function. Does this take into account magnetic deviation? Why I am asking is because I have an unit for which F10 map says heading319 wile getHeading function gives 314. [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
flo57100 Posted September 19, 2018 Share Posted September 19, 2018 Hi zayets, In the code that Grimes wrote, at line: msg[#msg+1] = mist.getHeading (u, true) replace true by magnetic, it works like a charm for me :thumbup: Link to comment Share on other sites More sharing options...
joejoegetback Posted October 8, 2018 Share Posted October 8, 2018 hallo, can someone help me.. i am looking for the newest version of the mist file and ctld someone can send it to me or make a link ???? ThX :joystick::pilotfly::music_whistling: Link to comment Share on other sites More sharing options...
joejoegetback Posted October 8, 2018 Share Posted October 8, 2018 mist file hallo, can someone help me.. i am looking for the newest version of the mist file and ctld someone can send it to me or make a link ???? ThX :helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie::helpsmilie: :joystick::pilotfly::music_whistling: Link to comment Share on other sites More sharing options...
doodenkoff Posted October 9, 2018 Share Posted October 9, 2018 The first page of each discussion thread about those tools has links to the latest version. Win 10 | i7 4770 @ 3.5GHz | 32GB DDR3 | 6 GB GTX1060 Link to comment Share on other sites More sharing options...
joejoegetback Posted October 9, 2018 Share Posted October 9, 2018 ok so the last version is from 2016 ???https://github.com/mrSkortch/MissionScriptingTools/releases but its very old. my dcs says i need a newer version .. when i use this old mist file .. can you help me ??? thx ?? :joystick::pilotfly::music_whistling: Link to comment Share on other sites More sharing options...
Grimes Posted October 9, 2018 Share Posted October 9, 2018 Yeah I've been somewhat lazy/distracted with other stuff. I was working on a 4.4 release but never released it. You can grab it from the development branch. Since I'm making missions again I might add some stuff and push a release. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Zayets Posted November 18, 2018 Share Posted November 18, 2018 Hi Grimes, Not sure why this stuff is not working anymore. See the snippet below local zonesClone = mist.utils.deepCopy(mist.DBs.zonesByName) env.info('mistDBZone size = ' .. #mist.DBs.zonesByName) env.info('cloneZone size = ' .. #zonesClone) Both of them return 0. I am loading mist at time 1 second and this script at 10 seconds after. When I dump DB's I see all zones in the dump file. Funny stuff is that in another script I made they work just fine. [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted November 19, 2018 Share Posted November 19, 2018 #table has limitations in lua. It only works if items are indexed numerically. It will return a correct value on the mist.DBs.zonesByNum table but not mist.DBs.zonesByName. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Zayets Posted November 19, 2018 Share Posted November 19, 2018 Thanks Grimes. Very strange as I have yet another set of zones which are not indexed numerically yet the result of #table is correct. I will switch to zonesByNum, see what gives. Most probably it will work. [sIGPIC]OK[/sIGPIC] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now