Cougar Posted October 5, 2013 Share Posted October 5, 2013 Ok thank you guys will try that out and see if I can move foward. Link to comment Share on other sites More sharing options...
RagnarDa Posted October 6, 2013 Share Posted October 6, 2013 The # operator is fine. Oops! :) DCS AJS37 HACKERMAN There will always be bugs. If everything is a priority nothing is. Link to comment Share on other sites More sharing options...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 (edited) Do activeWeapons = {} local function addWeapon(event) if event.id == world.event.S_EVENT_SHOT and world.event.weapon then activeWeapons[#activeWeapons + 1] = world.event.S_EVENT_SHOT end end Trigger.action.outText (mist.utils.Tableshow (activeWeapons), 25) mist.addEventHandler(addWeapon) End With the above taken part from Grimes wiki, it works as I'm able to see the table appear on the screen with only { } Appearing in the message as it was an empty table.....but the table insert is there so what am I missing to add that value? Edit: maybe if I assign world event to something like shot = world.event.S_EVENT_SHOT? Edited October 7, 2013 by Cougar Link to comment Share on other sites More sharing options...
St3v3f Posted October 7, 2013 Share Posted October 7, 2013 Is the event handler triggered correctly? Is it executed when it should be? aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 Yup when I press the pickle it appears Link to comment Share on other sites More sharing options...
St3v3f Posted October 7, 2013 Share Posted October 7, 2013 Two things: First, your output command is not part of the event handler, so it is only executed when the script is loaded at which time the table is empty, never again. So it should not appear when you pickle. It did not for me. Second: There is an error in the example code. if event.id == world.event.S_EVENT_SHOT and world.event.weapon then must be if event.id == world.event.S_EVENT_SHOT and event.weapon then do activeWeapons = {} local function addWeapon(event) if event.id == world.event.S_EVENT_SHOT and event.weapon then activeWeapons[#activeWeapons + 1] = world.event.S_EVENT_SHOT trigger.action.outText (mist.utils.tableShow (activeWeapons), 10) end end mist.addEventHandler(addWeapon) end 1 aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 Ok thanks will modify and test it out ... 1 Link to comment Share on other sites More sharing options...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 Ok now items are being entered into the table....yey Now I'm not able to get #activeWeapons to show the table lenght via trigger.action.outText. I've tried tostring, print but no joy. Arrrrrghhh I feel dummy lol Link to comment Share on other sites More sharing options...
ENO Posted October 7, 2013 Author Share Posted October 7, 2013 How do you think I feel?! lol ' Speaking of which- that doubleBack script... Is it an advanced waypoint script I enter at the last waypoint of the group causing the group to double back... or do I enter the script in the as a start mission trigger and it automatically applies to the group named? "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 Better than I, headache here lpl Link to comment Share on other sites More sharing options...
Grimes Posted October 7, 2013 Share Posted October 7, 2013 Speaking of which- that doubleBack script... Is it an advanced waypoint script I enter at the last waypoint of the group causing the group to double back... or do I enter the script in the as a start mission trigger and it automatically applies to the group named? http://wiki.hoggit.us/view/GroundPatrol Run it at the start. Basically the script re-draws the route and then re-assigns it. It also attaches a do script command to the last waypoint to begin the route again. So technically the group moves to the last waypoint, stops briefly, and then gets a new route (the same route) to follow. Yes it is given its own route. You can use http://wiki.hoggit.us/view/GroundPatrolRoute to tell it to follow another groups route or pass it a completely custom route. 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...
Cougar Posted October 7, 2013 Share Posted October 7, 2013 The # operator in Lua doesn't work like that unfortunately. Write a function like this function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end and use that to get the number of items in the table. Adding this in my script....how I use it? Tablecount = tablelenght () inside my other function? The can I use trigger.action.outText (Tablecount, 10) or it need something different? Thx Link to comment Share on other sites More sharing options...
Cougar Posted October 8, 2013 Share Posted October 8, 2013 Nevermind got it :) tostring :) Link to comment Share on other sites More sharing options...
Cougar Posted October 9, 2013 Share Posted October 9, 2013 activeWeapons[#activeWeapons + 1] = world.event.S_EVENT_SHOT It will add to the table activeWeapons If I do ActiveWeapons={ Missiles={} } How I get to insert into the missile table? activeWeapons[Missiles][#Missiles + 1] = world.event.S_EVENT_SHOT Link to comment Share on other sites More sharing options...
St3v3f Posted October 9, 2013 Share Posted October 9, 2013 activeWeapons[Missiles][#Missiles + 1] = world.event.S_EVENT_SHOT activeWeapons['Missiles'][#activeWeapons['Missiles'] + 1] = world.event.S_EVENT_SHOT aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Cougar Posted October 9, 2013 Share Posted October 9, 2013 activeWeapons['Missiles'][#activeWeapons['Missiles'] + 1] = world.event.S_EVENT_SHOT Thank you again.... Link to comment Share on other sites More sharing options...
ENO Posted October 10, 2013 Author Share Posted October 10, 2013 I'm just pairing things up here- stacked the given script with the format given in the guide. mist.teleportInZone('group1', 'zone1', {disperse = true, radius =100}) mist.teleportInZone (string groupName, string zoneName, Boolean disperse, number radius) So now a new script... mist.groupToRandomZone (??? group, ??? zone, string form, number heading, number speed) So I'm plugging away at this... and I see the ??? and wonder if that means that it could either be a string, or a table? And I imagine I could either build tables with a collection of zones / groups, or name all the zones / groups in string form with '...' similar to the teleport in zone. Then when we get into optional items do we open up {form = vee, heading = 180, speed = 15} So does it look the same in the end? mist.groupToRandomZone ('group1', 'zone1', 'zone2', 'zone3' {form = vee, heading = 180, speed = 10}) "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
St3v3f Posted October 10, 2013 Share Posted October 10, 2013 (edited) I've had a look into the code and it looks like you can either give it a string or a single group. So either mist.groupToRandomZone('groupname', .... mist.groupToRandomZone(Group.getByName('groupname'), .... but not multiple groups. As for zones, it can deal with either a string, a triggerzone or a table of zone names That means you can use: 'zoneName' trigger.misc.getZone('zoneName') or just any table that looks the same, for instance: zone = {point = Unit.getByName('unitName'):getPosition().p, radius = 10000} or a table of zone names:zones = { 'zoneName1', 'zoneName2' } Edited October 11, 2013 by St3v3f aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
ENO Posted October 10, 2013 Author Share Posted October 10, 2013 Clearly I'm still not quite getting it lol but thanks for the walk through st3v3f. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
Grimes Posted October 10, 2013 Share Posted October 10, 2013 Its mostly guide formatting inconsistencies. For the PDF guide I did use "???" to indicate there are multiple entry types. At somepoint I decided to specify what each value should be by utilizing a format similar to: type1/type2/type3 desc1/desc2/desc3 The wiki itself has formating issues as I changed my mind on what sort of data should be where. Eventually I settled on specifying the input value types and the rules that go with each value. A few also have valid examples, but I tend to add the most examples to the actual example code below. For example on the wiki page of the same function... http://wiki.hoggit.us/view/GroupToRandomZone table/table/string zoneNames/zoneObject/zoneName As a point of correction to St3v3f, the zone table accepts a table of zone names. zone= table of zone name strings {'zone1', 'zone2', 'zone3'} zone = string of a zone name 'zone1' zone = zone table {point = vec3, radius = number} 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...
ENO Posted October 11, 2013 Author Share Posted October 11, 2013 Just to confirm on these "Hoggit" pages- are these works in progress or are these easily accessible with the "wiki.hoggit.us/view/ (name your function) in the browser window? I think they're really quite helpful- especially if they give examples of codes in proper format. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
St3v3f Posted October 11, 2013 Share Posted October 11, 2013 As a point of correction to St3v3f, the zone table accepts a table of zone names. zone= table of zone name strings {'zone1', 'zone2', 'zone3'} zone = string of a zone name 'zone1' zone = zone table {point = vec3, radius = number} Right, it takes a table of strings but not a table of zones aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
RagnarDa Posted October 11, 2013 Share Posted October 11, 2013 I think they're really quite helpful- especially if they give examples of codes in proper format. Yes! Let's make it an community effort to include examples on every function, including the SSE. I've requested a login for the Hoggit-wiki. 1 DCS AJS37 HACKERMAN There will always be bugs. If everything is a priority nothing is. Link to comment Share on other sites More sharing options...
Grimes Posted October 11, 2013 Share Posted October 11, 2013 Just to confirm on these "Hoggit" pages- are these works in progress or are these easily accessible with the "wiki.hoggit.us/view/ (name your function) in the browser window? Yeah every mist function has a page with all the info you could need to figure out how to use it, but the page name don't always perfectly match the mist function name. See this page for a full list of mist related pages: http://wiki.hoggit.us/view/Category:MIST Some pages are more detailed than others, so in that respect it is still a work in progress. It was quite a bit of effort to create the pages and the templates, but once they are created its pretty easy to go back and add or fix things if needed. I've noticed St3v3f has gone in there and fixed a few typos, which is quite helpful. On more than a few occasions I saw a post or question about a mist function and then checked the wiki documentation for that specific function to see if I needed to change or add anything. For the most part the only inconsistent bits of documentation on there are the valid input values and the examples. With the valid input values I changed my mind halfway through for what it should be from pure examples of values to a little description and rules for the values. Some examples are missing or could be improved, and I'd be perfectly happy for contributions in this area. Yes! Let's make it an community effort to include examples on every function, including the SSE. I've requested a login for the Hoggit-wiki. Adding and reformatting the rest of the SSE wiki is on my todo list, but so is a bunch of other stuff. What I have in mind is completely different than its setup now, but I have yet to start adding pages to it. At least adding the mist documentation taught me some stuff on wiki syntax so it shouldn't be that rough to start from scratch. There are also a bunch of concepts and examples for the SSE documentation that would be helpful in plugging into mist documentation of which I'll have to go back and add to mist stuff. 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...
ENO Posted October 11, 2013 Author Share Posted October 11, 2013 Thanks Grimes- that link is going to be a tremendous resource for me as well as a bunch of guys just like me who want to help ourselves but just can't QUITE get our heads around how. In reading over some of the description of tables I did feel a couple tumbler pins drop into place... just barely. Thanks to everyone who is or will be contributing to this effort. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
Recommended Posts