Tutorial: Introduction to Lua scripting - Page 7 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 12-17-2015, 04:26 AM   #61
Yurgon
Campaign Testers
 
Yurgon's Avatar
 
Join Date: May 2010
Location: Germany
Posts: 7,462
Default

Quote:
Originally Posted by ajax View Post
I've gotten that same error. It generally appears when an older mission is updated and saved in a newer version of DCS. I've never been able to fix it, but it doesn't seem to really hurt anything.
Interesting.

I just ran one of the missions I used to create the screenshots for the original post (created in 1.2.7), which ran fine in 1.5.2. I then edited and re-saved it in 1.5.2, and it still ran without a problem. Of course this was a very simple mission with just one aircraft and one trigger, but I couldn't find any fundamental problems with it.

Edit: Also ran the old mission in 1.2.16, and again, not a problem.

Last edited by Yurgon; 12-17-2015 at 04:30 AM.
Yurgon is offline   Reply With Quote
Old 12-17-2015, 06:39 AM   #62
richard008
Junior Member
 
Join Date: Dec 2015
Location: China
Posts: 50
Default

Quote:
Originally Posted by ajax View Post
Trigger: can't execute trigger, err:"[string "?"]:1: bad argument #1 to 'loadstring' (string expected, got function)"

I've gotten that same error. It generally appears when an older mission is updated and saved in a newer version of DCS. I've never been able to fix it, but it doesn't seem to really hurt anything.
So is the case, although it did hurt anything, but it seems that Trigger can not normally use.
All "do file"/"do script" does not work, if it is the problem of lua script,but a simple print ("1234") did indeed that is very puzzled Law enforcement.
richard008 is offline   Reply With Quote
Old 12-17-2015, 05:10 PM   #63
Yurgon
Campaign Testers
 
Yurgon's Avatar
 
Join Date: May 2010
Location: Germany
Posts: 7,462
Default

Quote:
Originally Posted by richard008 View Post
All "do file"/"do script" does not work, if it is the problem of lua script,but a simple print ("1234") did indeed that is very puzzled Law enforcement.
Once again, I ran a mission with a simple DO FILE trigger action in 2 different versions of DCS with no problem. If you post your mission, maybe someone can figure out why it's not working. I suggest you open a new thread in the Mission Builders' Corner for that purpose.
Yurgon is offline   Reply With Quote
Old 12-17-2015, 11:31 PM   #64
ajax
Member
 
ajax's Avatar
 
Join Date: Feb 2010
Posts: 476
Default

I'm not talking about fairly new DCS versions, I'm talking old, old missions like some originally written for BS1 or FC2. Also, the error occurred in the log file when saving the mission not at run time. This sounds like it's a different problem.

A couple of things you might check: 1) If you're using DCS 1.5 or 2.0 make sure you're not using a 'mission start' trigger. It may be fixed now, but it was broken for these versions. 2) If you are copy/pasting from notepad++, try different encoding settings, for example try UTF-8 or UTF-8-BOM.
ajax is offline   Reply With Quote
Old 12-20-2016, 08:54 AM   #65
gromit190
Member
 
gromit190's Avatar
 
Join Date: Jul 2015
Posts: 120
Default

Great tutorial! Whenever someone wants to start scritping for DCS, I just link them here.

I'd just like to add that Lua Development Tools (LDT) is completely unmatched when it comes to free IDEs for .lua. Notepad++, Atom, etc has context highlighting but LDT also has extensive content assist (intellisense), automatic refactoring etc.

I've been using Notepad++ for years and not just lua programming. But once you go LDT there's no turning back :-P

gromit190 is offline   Reply With Quote
Old 12-20-2016, 10:32 PM   #66
FlightControl
Senior Member
 
FlightControl's Avatar
 
Join Date: Mar 2012
Location: Antwerp, Belgium
Posts: 2,026
Default

Quote:
Originally Posted by gromit190 View Post
Great tutorial! Whenever someone wants to start scritping for DCS, I just link them here.

I'd just like to add that Lua Development Tools (LDT) is completely unmatched when it comes to free IDEs for .lua. Notepad++, Atom, etc has context highlighting but LDT also has extensive content assist (intellisense), automatic refactoring etc.

I've been using Notepad++ for years and not just lua programming. But once you go LDT there's no turning back :-P

Indeed, I can only confirm the feedback from Gromit190.

The LDT environment should be standard for mission designers doing lua scripting. The Mission Object Oriented Scripting Environment was built with it.

http://flightcontrol-master.github.io/MOOSE/

https://www.youtube.com/channel/UCjr...oWsG4SpS8i79Qg

Fc
__________________
FlightControl is offline   Reply With Quote
Old 12-21-2016, 03:23 AM   #67
Yurgon
Campaign Testers
 
Yurgon's Avatar
 
Join Date: May 2010
Location: Germany
Posts: 7,462
Default

Thanks for the kind words and thanks for the heads-up, guys!

Edit: And link added to original post.
__________________

Last edited by Yurgon; 12-21-2016 at 03:26 AM.
Yurgon is offline   Reply With Quote
Old 07-12-2017, 04:37 PM   #68
WildBillKelsoe
Veteran
 
WildBillKelsoe's Avatar
 
Join Date: Jun 2009
Location: Cairo, Egypt
Posts: 6,396
Default

If you would talk a little bit about certain meanings to attract others like me to the language but in terms for complete newbs (with no programming history or education), for example the meanings of chunks, lexical conventions, functions, compilers and interpreters (you covered this, guys this is what you use to have the niche Lua (Loo-aa) on your device to test the compiled code chunks (compiled as in aggregated, before running?), code (the bits of instructions given to Lua to execute (or not), chunks (differs from comments, the main body of code sans the comments and other unimportant stuff).

I want to also add the Lua Digest which has been helpful into wetting my baby feet into programming in Lua for the first time (or any programming for that matter!). You guys can find great help by talking to the devs (or if unavailable their friends directly).
__________________
AWAITING ED NEW DAMAGE MODEL IMPLEMENTATION FOR WW2 BIRDS

Fat T is above, thin T is below. Long T is faster, Short T is slower. Open triangle is AWACS, closed triangle is your own sensors. Double dash is friendly, Single dash is enemy. Circle is friendly. Strobe is jammer. Strobe to dash is under 35 km. HDD is 7 times range key. Radar to 160 km, IRST to 10 km. Stay low, but never slow.
WildBillKelsoe is offline   Reply With Quote
Old 11-20-2017, 11:18 AM   #69
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 8,068
Default

Just a heads up, I've been updating the scripting engine wiki a bit.
- Added enumerator data for callsigns and formations
- reorganized enumerator lists to better reflect a tables contents (I got sick of trying to remember if the shorthand values for different tables started at 0 or 1)
- Task pages now categorized by which group types can perform a task. Also added enumerator links for weapons and AI tasking.

If there is anything specific that you guys can think of that is still missing just post it here and I'll try to address it.
__________________
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
Grimes is offline   Reply With Quote
Old 11-20-2017, 05:39 PM   #70
Delta99
Member
 
Delta99's Avatar
 
Join Date: Jan 2017
Posts: 414
Thumbs up

Quote:
Originally Posted by Grimes View Post
Just a heads up, I've been updating the scripting engine wiki a bit.
- Added enumerator data for callsigns and formations
- reorganized enumerator lists to better reflect a tables contents (I got sick of trying to remember if the shorthand values for different tables started at 0 or 1)
- Task pages now categorized by which group types can perform a task. Also added enumerator links for weapons and AI tasking.

If there is anything specific that you guys can think of that is still missing just post it here and I'll try to address it.
Appreciate the work there Grimes.
__________________
My Missions: Valley Patrol Mission :: Valley Escort Mission :: A2A Engagements
Delta99 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 12:15 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.