Announcement

Collapse
No announcement yet.

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by chromium View Post
    ok the last question (than I will leave you at work ):

    How do I load a function by file? I have to copy & paste (notepad ++) the function text in a new .lua file named as I want (es. functionLOS.lua)?
    Yes, this is part of why I prefer using DO SCRIPT instead of DO SCRIPT FILE. Also, you're probably aware of the rare "crap, my mission lost all its attachments" bug. DO SCRIPT FILE may also be affected by this bug; DO SCRIPT is immune to it. So yea, I like using DO SCRIPT instead. However, Grimes often prefers using DO SCRIPT FILE... to each his own, I guess.

    If I have to send the mission to other people, do this loaded file will be stored in the .miz archive? Or I have to send also the .lua files to be loaded?

    thanks a lot
    Yes, the Lua file is included in the zipped .miz archive, just like any sounds or pictures your mission might also use.
    Intelligent discourse can only begin with the honest admission of your own fallibility.
    Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/
    Lua scripts and mods:
    MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616
    Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979
    Now includes remote server administration tools for kicking, banning, loading missions, etc.

    Comment


      #17
      Perfect... ehm... to be onest I'm not aware of that attachment problems, but I'll find my way using it .

      The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

      Comment


        #18
        The attachment problem often happened to me when I saved the mission withou actually changing anything within it. You know, you alt tab out for a long time, then alt tab back in and you're not sure whether you saved the mission or not. So you just save it one more time. That's when I lost my files within the mission.

        I believe it is enough to move a unit a little bit to make the mission "changed".

        Speed, have you gotten this bug WITHOUT not having changed it between saves?
        sigpic
        System specs:
        Spoiler:
        2500k @ 4.6 GHz
        8GB RAM
        HD7950 OC'd
        Win7 x64
        Posting tracks to make your DCS better - attention bump incoming!

        Comment


          #19
          Originally posted by Megagoth1702 View Post
          You know, you alt tab out for a long time, then alt tab back in and you're not sure whether you saved the mission or not. So you just save it one more time. That's when I lost my files within the mission.
          sounds like the story of my editing life: I suffer a compulsive "PRESS SAVE BUTTON" syndrome. I'll definitely go thrugh the DO SCRIPT if it's like you told.

          The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

          Comment


            #20
            Awesome, no SLmod but pretty much the same functions, haha.

            Speed, looking at the mist manual I can not find anything like "unitsFiring", that sets a flag to true once a unit has fired something. Am I overlooking something?

            Thanks.
            sigpic
            System specs:
            Spoiler:
            2500k @ 4.6 GHz
            8GB RAM
            HD7950 OC'd
            Win7 x64
            Posting tracks to make your DCS better - attention bump incoming!

            Comment


              #21
              Maybe is on work... I miss the POS & PTS... they're almost necessary to me

              The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

              Comment


                #22
                The only attachment issue I've had is that sometimes an attachment fails to be added to the .miz. I haven't really experienced it in a while, but I could never fully diagnose the cause. But part of the reason I've been using "Do Script File" is because my mission scripts are nearly approaching the size of Mist itself and more than a few times I've failed to completely copy over the old code with the new


                PS: Speed, Grimes, would you like to see a "script wish list thread" to let the mission builder to tell you what functions could be intersting to be added?
                Thats a good question. A thread in the mission builders corner would likely work. Eventually I hope a moderator adds a sticky for scripts to be posted in.

                In terms of Mist vs SLMod, my understanding is that Speed is going to implement as much of Slmod into Mist as possible. Really the only things we can't use the scripting engine for that Slmod can do are related to the network lua environmental. Stuff like getting player names, reading chat, etc. I'm sure you will see more of slmod ported into mist, this is version 1 after-all, and we wanted to get it out there for people to start using asap.

                I have two missions that are waiting to be release once some bugs get fixed. I was hoping to show them off in their entirety once Mist was released, however it will have to wait for the bugs to get fixed. However I've attached below a script segment that I am using in both of the missions. I sort the client list by a generic type: Fighters, strike aircraft, and helicopters. I've done this so I have an easy to work with table of units and so that the mission will automatically adjust for any changes made to it. Anyone can add or delete client aircraft without an issue. Also Unit.getAttribute() only works on alive units and client aircraft are 'nil' until a player spawns in. Its not the most optimized code but it works

                Spoiler:

                Code:
                do
                possible_client_list = mist.utils.deepCopy(mist.DBs.humansByName)
                	client_aircraft = {
                	['blue'] = {
                		['fighters'] = {}, -- add unit names to this list for testing purposes.
                		['strike'] = {},
                		['heli'] = {},
                		},
                	['red'] = {
                		['fighters'] = {}, 
                		['strike'] = {},
                		['heli'] = {},
                		},
                	}
                end
                
                function buildclientDB()
                 mist.scheduleFunction(buildclientDB, {}, timer.getTime() + 5)
                	for acName, acData in pairs(possible_client_list) do
                		if Unit.getByName(acName) then
                			punit = Unit.getByName(acName)
                			if type(acData) == 'table' then
                				if acData.coalition == 'red'  then
                					if punit:hasAttribute('Fighters') then
                						table.insert(client_aircraft['red'].fighters, acName)
                					elseif punit:hasAttribute('Battleplanes') then
                						table.insert(client_aircraft['red'].strike, acName)
                					elseif punit:hasAttribute('Attack helicopters') then
                						table.insert(client_aircraft['red'].heli, acName)
                					end
                				elseif acData.coalition == 'blue' then
                					if punit:hasAttribute('Fighters') then
                						table.insert(client_aircraft['blue'].fighters, acName)
                					elseif punit:hasAttribute('Battleplanes') then
                						table.insert(client_aircraft['blue'].strike, acName)
                					elseif punit:hasAttribute('Attack helicopters') then
                						table.insert(client_aircraft['blue'].heli, acName)
                					end
                				end
                				possible_client_list[acName] = nil
                			end
                		end   
                	end
                	--mist.debug.writeData(mist.utils.serialize,{'client_list', possible_client_list}, 'client_list.txt')
                end
                Last edited by Grimes; 12-05-2012, 11:36 AM.
                The right man in the wrong place makes all the difference in the world.
                Current Projects: Scripting Wiki, Something...
                Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

                Comment


                  #23
                  Added and populated :

                  http://forums.eagle.ru/showthread.ph...78#post1622678

                  The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

                  Comment


                    #24
                    Hi folks, maybe someone can help me.

                    I'm trying for weeks to get this to work: I just want to do a message to a specific group via trigger.action.outTextForGroup but all I get is an error that the GroupID is nil. Maybe I'm too dumb to get this ID by using this one Group.getByName(string):getID()

                    Regards
                    My Rig: Windows 10 Pro, Intel i7-8700k@4.7GHz, 32GB DDR4 3200 RAM, Gigabyte Z370 AORUS Ultra Gaming, 1TB Sabrent Rocket NVMe, Samsung 3*1TB HDD (RAID 0), GTX1070 G1, Thrustmaster HOTAS WARTHOG + Saitek Pro Flight Pedals + TrackIR5, ACER 30" 4K 60FPS GSync Display

                    Comment


                      #25
                      Originally posted by Megagoth1702 View Post
                      The attachment problem often happened to me when I saved the mission withou actually changing anything within it. You know, you alt tab out for a long time, then alt tab back in and you're not sure whether you saved the mission or not. So you just save it one more time. That's when I lost my files within the mission.

                      I believe it is enough to move a unit a little bit to make the mission "changed".

                      Speed, have you gotten this bug WITHOUT not having changed it between saves?
                      I thought that perhaps it could have to do with having two copies of the DCS ME open at the same time, editing the same mission, but when I tried to reproduce it with this method, it didn't work. I'll try your method!

                      Awesome, no SLmod but pretty much the same functions, haha.

                      Speed, looking at the mist manual I can not find anything like "unitsFiring", that sets a flag to true once a unit has fired something. Am I overlooking something?

                      Thanks.
                      Currently, the way to get information about weapons firing is to use an event handler. If the event is a shot event (world.event.S_EVENT_SHOT), then you treat the event.weapon table as a Unit, and use Unit.getTypeName on it- theoretically, this should give you the name of the weapon. However, currently, Unit.getTypeName does not work on all weapon types. For some, it will give you the name of the weapon; for others, it will give you nil. We hope this will be fixed in future versions of DCS, but as long as this problem exists, I cannot port the weapons_firing Slmod functionality into Mist.

                      Or... perhaps I can, if we are OK with a mist.flagFunc.units_firing function that does not work for some weapon types?
                      Intelligent discourse can only begin with the honest admission of your own fallibility.
                      Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/
                      Lua scripts and mods:
                      MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616
                      Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979
                      Now includes remote server administration tools for kicking, banning, loading missions, etc.

                      Comment


                        #26
                        Sometimes is better to have a feature with limitation, instead that don't even have any feature. In this sim we need countinously to look for workaround due to bug or engine limitations, so having a function that work for weapon "a" but not for weapon "b" isn't an issue for me, as far I have a list of "a".


                        But...

                        it's only my personal opinion.

                        The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

                        Comment


                          #27
                          Originally posted by chromium View Post
                          Maybe is on work... I miss the POS & PTS... they're almost necessary to me
                          Mist only has access to a portion of the game's Lua API that Slmod has access to. Mist is limited to only ONE DCS Lua environment; Slmod uses FOUR. Unfortunately, mission scripting has no info on the multiplayer client environment.

                          Even if we had all the info on who were the clients, what they said in chat, what mission slots they were in, etc, we'd still need some kind of callback that was equivalent to server.on_chat, and also, we'd need an equivalent to net.send_chat (so that you could communicate privately to Combined Arms players and spectators).

                          Basically, it is impossible to replicate SlmodMenu objects (POS, PTS, AdminMenu, Coordinate converter, ...) in mission scripting Lua, and it's unlikely that the necessary changes to the game's code to do so will be made in the near future (if ever).
                          Intelligent discourse can only begin with the honest admission of your own fallibility.
                          Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/
                          Lua scripts and mods:
                          MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616
                          Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979
                          Now includes remote server administration tools for kicking, banning, loading missions, etc.

                          Comment


                            #28
                            than the other question is: do you think that could exist a workaround to have something similar (es. a multiplayer working radio menù)?

                            in the meantime... nothing will move me by SLmod also, I will use both if necessary

                            The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

                            Comment


                              #29
                              Originally posted by Quax456 View Post
                              Hi folks, maybe someone can help me.

                              I'm trying for weeks to get this to work: I just want to do a message to a specific group via trigger.action.outTextForGroup but all I get is an error that the GroupID is nil. Maybe I'm too dumb to get this ID by using this one Group.getByName(string):getID()

                              Regards
                              trigger.action.outTextForGroup- and all the outTextFor functions- got broken during the process of building one of the patches (I think it was 1.2.1). Group.getByName(string groupName):getID() is indeed the correct way to get a group's ID for this function (though- you wouldn't want to use EXACTLY that code for an ACTUAL mission- you'd generate a Lua error if that group was not alive. So first, you'd want to make sure that Group.getByName actually returned a group before you tried using getID).

                              Anyway, they should be fixed in a future DCS version.
                              Intelligent discourse can only begin with the honest admission of your own fallibility.
                              Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/
                              Lua scripts and mods:
                              MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616
                              Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979
                              Now includes remote server administration tools for kicking, banning, loading missions, etc.

                              Comment


                                #30
                                Originally posted by chromium View Post
                                than the other question is: do you think that could exist a workaround to have something similar (es. a multiplayer working radio menù)?

                                in the meantime... nothing will move me by SLmod also, I will use both if necessary
                                Yes, the best work-around is to use a server-side mod to replicate similar functionality to the F10 "other" menu by using multiplayer chat

                                As I understand it- this could be wrong though- the "create other radio menu/menu item" commands only occur once, if you're not around to "see" it, you won't get it. So this command would have to be stored somewhere/somehow. This info is also not communicated over the network to clients.

                                And finally, there's a design decision- how exactly should these menus work for clients- should clients be allowed unrestricted access to these? If that were to happen, it would actually break a feature I'm sure SOMEONE out there is using- right now, the host has his own private set of menus to control mission trigger logic, that clients cannot interfere with. So, do we need to be able to specify WHO can use these menu items?

                                So anyway, it's definitely a non-trivial design/programming challenge. No, it's probably not difficult, just time consuming.
                                Last edited by Speed; 12-05-2012, 05:08 PM.
                                Intelligent discourse can only begin with the honest admission of your own fallibility.
                                Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/
                                Lua scripts and mods:
                                MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616
                                Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979
                                Now includes remote server administration tools for kicking, banning, loading missions, etc.

                                Comment

                                Working...
                                X