DCS funct setCommand with script - ED Forums


Thread Tools Display Modes
Old 01-19-2020, 06:06 AM   #1
Join Date: Jul 2018
Posts: 242
Default DCS funct setCommand with script

Hi everyone,

I would be interested to run the DCS function
function Controller.setCommand(Class self, table command )
with a script. I tried something like that :

Testsc = { 
  id = 'Script', 
  params = {
    command = trigger.action.outText("Hello",3)

groupCon = Group.getByName("A10"):getController()
but I cant get it working
The error says "parameter self missing"

What am I doing wrong ?

What about if I want to run not just one but let's say two commands ?

CougarFFW04 is offline   Reply With Quote
Old 01-19-2020, 07:15 AM   #2
ED Testers Team
Grimes's Avatar
Join Date: Jan 2006
Location: Black Mesa
Posts: 8,190

It is important to note the differences in calling class objects with . and :.

Both of these do the same thing. When you call a function with . it doesn't assume the first variable is a "self", you will have to add it to the function call. When you do it with : and it is a correct object, then it will use that object as the first variable.

Controller.setCommand(groupCon, Testsc)

Also fairly certain the script needs to be in a string format. Should be able to double bracket it or be very careful with quotes.

command = [[trigger.action.outText("Hello",3)]]


command = "trigger.action.outText('Hello',3)"
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 for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote

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 04:42 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.