CougarFFW04 Posted January 19, 2020 Posted January 19, 2020 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() 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
Grimes Posted January 19, 2020 Posted January 19, 2020 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: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts