MIssion Scripting Tools (Mist)- enhancing mission scripting Lua - Page 3 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 12-05-2012, 12:06 PM   #21
chromium
3rd Party Developer
 
Join Date: Dec 2008
Location: Milan
Posts: 3,367
Default

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.
chromium is offline   Reply With Quote
Old 12-05-2012, 12:34 PM   #22
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,663
Default

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


Quote:
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
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum

Last edited by Grimes; 12-05-2012 at 12:36 PM.
Grimes is offline   Reply With Quote
Old 12-05-2012, 01:19 PM   #23
chromium
3rd Party Developer
 
Join Date: Dec 2008
Location: Milan
Posts: 3,367
Default

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.
chromium is offline   Reply With Quote
Old 12-05-2012, 01:33 PM   #24
Quax456
Member
 
Quax456's Avatar
 
Join Date: May 2012
Location: Lübeck, Germany
Posts: 701
Default

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, 16GB DDR4 RAM, Gigabyte Z370 AORUS Ultra Gaming, Samsung SSD 850 EVO 500GB, Samsung 1TB HDD, GTX1070 G1, Thrustmaster HOTAS WARTHOG + Saitek Pro Flight Pedals + TrackIR5

Quax456 is offline   Reply With Quote
Old 12-05-2012, 05:08 PM   #25
Speed
Veteran
 
Speed's Avatar
 
Join Date: Nov 2008
Location: Auburn, AL
Posts: 4,079
Default

Quote:
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!

Quote:
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.
Speed is offline   Reply With Quote
Old 12-05-2012, 05:15 PM   #26
chromium
3rd Party Developer
 
Join Date: Dec 2008
Location: Milan
Posts: 3,367
Default

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.
chromium is offline   Reply With Quote
Old 12-05-2012, 05:30 PM   #27
Speed
Veteran
 
Speed's Avatar
 
Join Date: Nov 2008
Location: Auburn, AL
Posts: 4,079
Default

Quote:
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.
Speed is offline   Reply With Quote
Old 12-05-2012, 05:37 PM   #28
chromium
3rd Party Developer
 
Join Date: Dec 2008
Location: Milan
Posts: 3,367
Default

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.
chromium is offline   Reply With Quote
Old 12-05-2012, 05:42 PM   #29
Speed
Veteran
 
Speed's Avatar
 
Join Date: Nov 2008
Location: Auburn, AL
Posts: 4,079
Default

Quote:
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.
Speed is offline   Reply With Quote
Old 12-05-2012, 06:03 PM   #30
Speed
Veteran
 
Speed's Avatar
 
Join Date: Nov 2008
Location: Auburn, AL
Posts: 4,079
Default

Quote:
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.
__________________
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.

Last edited by Speed; 12-05-2012 at 06:08 PM.
Speed is offline   Reply With Quote
Reply

Tags
mist

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 11:23 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.