DCS funct setCommand with script - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 01-19-2020, 06:06 AM   #1
CougarFFW04
Member
 
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 :

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

groupCon = Group.getByName("A10"):getController()
groupCon.setCommand(Testsc)
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 ?

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

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)
groupCon:setComment(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)]]

or

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
Reply

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.