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


Notices

Reply
 
Thread Tools Display Modes
Old 02-25-2014, 03:48 PM   #11
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,988
Default

Quote:
Originally Posted by towsim View Post
Position_vec3 = YourObject:getPoint()
elevation = land.getHeight{x = Position_vec3 .x, y = Position_vec3 .z}
now you can subtract the elevation from your position z value.
Great, thanks! I found it on the same page as we speak. That will help me along
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 02-25-2014, 05:16 PM   #12
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,988
Default

With the AWACS I get a hight difference of 3 meters (12 feet). Does the Unit:getPosition().p return the top of the fuselage?
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 03-22-2014, 03:19 PM   #13
VIMANAMAN
Member
 
Join Date: Jan 2012
Posts: 420
Default

Very useful Yurgon, thanks - I've been wanting to take the first few steps down this (initially at least), quite daunting road.

I couldn't find how / where to start with this stuff, so nice one

More reading required by me, but good to have made a start. TY

EDIT - wont let me add rep - sorry.

Last edited by VIMANAMAN; 03-22-2014 at 03:22 PM.
VIMANAMAN is offline   Reply With Quote
Old 03-22-2014, 04:09 PM   #14
Yurgon
Campaign Testers
 
Yurgon's Avatar
 
Join Date: May 2010
Location: Germany
Posts: 7,161
Default

Quote:
Originally Posted by VIMANAMAN View Post
Very useful Yurgon, thanks - I've been wanting to take the first few steps down this (initially at least), quite daunting road.

I couldn't find how / where to start with this stuff, so nice one

More reading required by me, but good to have made a start. TY

EDIT - wont let me add rep - sorry.
Thanks.

I'm not entirely sure about the rep system, but I think posts can only be rep'ed for a short period of time, or the same post can't be rep'ed too often or so. If you find newer posts by the same member, it might be possible to rep them instead (like this one, hint, hint )

On to another post:

Quote:
Originally Posted by towsim View Post
Position_vec3 = YourObject:getPoint()
elevation = land.getHeight{x = Position_vec3 .x, y = Position_vec3 .z}
now you can subtract the elevation from your position z value.
Huh, when you posted that, it looked like a lot of magic to me. In the meantime, I've done some scripting in this area, and that land.getHeight() looks like an awesome little helper function.
Yurgon is offline   Reply With Quote
Old 04-08-2014, 02:34 PM   #15
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,988
Default

Is everyone using the Notepad++ to code? I use the Programmers Notepad (almost the same as Notepad++) but there is no way to run and debug small pieces of the code in any of these notepads. Is there a more powerful coding compiler for lua?
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 04-08-2014, 02:36 PM   #16
cichlidfan
Veteran
 
cichlidfan's Avatar
 
Join Date: Apr 2011
Location: Woodbridge,VA,USA
Posts: 19,575
Default

I believe you need a LUA interpreter, not a compiler.

http://www.lua.org/download.html
__________________
ASUS ROG Maximus VIII Hero, i7-6700K, Noctua NH-D14 Cooler, Crucial 32GB DDR4 2133, Samsung 950 Pro NVMe 256GB, Samsung EVO 250GB & 500GB SSD, 2TB Caviar Black, Zotac GTX 1080 AMP! Extreme 8GB, Corsair HX1000i, Phillips BDM4065UC 40" 4k monitor, VX2258 TouchScreen, TIR 5 w/ProClip, TM Warthog, VKB Gladiator Pro, Saitek X56, et. al., MFG Crosswind Pedals #1199, VolairSim Pit, Rift CV1
cichlidfan is offline   Reply With Quote
Old 04-08-2014, 02:42 PM   #17
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,988
Default

Yes thats what I meant. I did find some for android but wanted to hear if there is a recommended one for windows. Didn't like the android ones
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 04-08-2014, 02:44 PM   #18
cichlidfan
Veteran
 
cichlidfan's Avatar
 
Join Date: Apr 2011
Location: Woodbridge,VA,USA
Posts: 19,575
Default

There is always an online version.

http://www.compileonline.com/execute_lua_online.php
__________________
ASUS ROG Maximus VIII Hero, i7-6700K, Noctua NH-D14 Cooler, Crucial 32GB DDR4 2133, Samsung 950 Pro NVMe 256GB, Samsung EVO 250GB & 500GB SSD, 2TB Caviar Black, Zotac GTX 1080 AMP! Extreme 8GB, Corsair HX1000i, Phillips BDM4065UC 40" 4k monitor, VX2258 TouchScreen, TIR 5 w/ProClip, TM Warthog, VKB Gladiator Pro, Saitek X56, et. al., MFG Crosswind Pedals #1199, VolairSim Pit, Rift CV1
cichlidfan is offline   Reply With Quote
Old 04-08-2014, 02:48 PM   #19
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,988
Default

Thanks. Ill try it out on some snippets.
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 05-29-2014, 07:46 PM   #20
Joyride
Veteran
 
Joyride's Avatar
 
Join Date: Apr 2009
Location: Colorado, USA
Posts: 513
Default

Short version: how to you make a function name dynamic?

Long version:

I need to create an event handler within a function, but may have several of these event handlers going concurrently for different "CAS taskings". In all of the examples I've seen event handlers are global. Thus, is there a way with lua to create a dynamic variable name for the event handler?

For example, the event handler checks for blue-on-blue shots and is called BlueDamageHandler. This is called within function "CAS_1" which has a variable "Task" (function CAS_1(Task). So, task #1 is running and calls BlueDamageHandler to start checking for blue-on-blue shots.

Meanwhile, CAS task #2 is activated using the same overall function, and also needs to call on this BlueDamageHandler but with different units to check on, etc. So how do I make the damage handler specific to each task? What I want to do is have the damage handler be called "BlueDamageHandler_01" or something for the first task, "BlueDamageHandler02" for the second, and so on.
Joyride 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 03:04 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.