-
Posts
583 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by AKA_Clutter
-
Coming back to DCS and VR. OpenXR or Steam
AKA_Clutter replied to AKA_Clutter's topic in Virtual Reality
Thanks Sleighzy and Phantom711, I'll pass this information along. -
Coming back to DCS and VR. OpenXR or Steam
AKA_Clutter replied to AKA_Clutter's topic in Virtual Reality
Yeah, I meant OpenXR Toolkit, and I knew it was no longer supported and therefore wasn't sure that was the way to go. His version is NOT the Steam DCS version, but stand alone. I'm pretty sure he is still on Windows 10. For the longest time DCS VR went through Steam VR. And yes it's WMR, SteamWMR, Steam VR IIRC. So would he need to do anything to go though OpenXR runtime? And yes, I sent him a link to this thread. Thanks for the response. -
Hi, I have a friend coming back to DCS and VR. His current setup goes through Steam VR. I know that OpenXR was/(is?) is a thing. With all the changes of late, I've lost track of things. 1) Is OpenXR still the "way to go"? 2) If so, does it need to be installed or has something been integrated into DCS itself? 3) what is the best setup (i7, 9700k, 3080 RTX, HP G2)
-
Anyone running a 3080 and a Pinax Crysta Light
AKA_Clutter replied to AKA_Clutter's topic in Virtual Reality
Thanks for tge information. -
Virtual Reality Loading Screen Question
AKA_Clutter replied to iQyThradz3137i's topic in Virtual Reality
Running intel and a G2 an d I get those from time to time during mission loading. -
Is any running a Crystal Light with a 3080? Just wondering how it works. Thanks in advance
-
If the ship you added start at the start of the mission then it is probably not set to Late Activation. (Screen shot 1 below)> I added a second group of 1 ship to the first trigger (second screen shot) and then added a third ship with a second set of logic (See 3rd screen shot)> I've also uploaded an update mission with three ships. I also added a visual (Green circle) to the f10 map so you can see when the F-16 flies into the activation trigger zone. Hope this helps. Simple Test of Ship Activation_02.miz
-
Shouldn't be. I'll try when I get home later today.
-
Help required for lua scripting
AKA_Clutter replied to Swson's topic in Scripting Tips, Tricks & Issues
Hi Swson, Here are my thoughts. Now I am a newbie to llua, programming in general, and DCS sdripting. With that said, you probably want to use the world.addevent function. The Hoggit Wiki entry that describes this event is: https://wiki.hoggitworld.com/view/DCS_func_addEventHandler And here is my attempt at modify some code I'm using to do what you want. THIS IS NOT TESTED. Good luck and hope this helps. local debugFlagHotLZ = 0 -- Set to 1 to have the debug statement print to screen local checkForEvent = {} function checkForEvent:onEvent(event) local _status, _err = pcall(function(_args) if ((event.id == world.event.S_EVENT_EJECTION and event.initiator ~= nil) or (event.id == world.event.S_EVENT_PILOT_DEAD and event.initiator ~= nil) or (event.id == world.event.S_EVENT_CRASH and event.initiator ~= nil) or (event.id == world.event.S_EVENT_DEAD and event.initiator ~= nil)) then local leftUnit = event.initiator if (debugFlagHotLZ == 1) then trigger.action.outText("leftUnit loop Event ID is = " .. event.id,10 end local playerName = leftUnit:getPlayerName() if (playerName ~= nil) then if (debugFlagHotLZ == 1) then trigger.action.outText(playerName .. "/" .. leftUnit:getName() .. " left " .. leftUnit:getTypeName() .. " or ejected or died",5) end -- ******************* add what you want to do here. *********************************** end end end, _arguments) if (not _status) then env.error(string.format("Helo_Transport: checkForEvent ERROR: %s", _err)) trigger.action.outText("Helo_Transport: checkForEvent ERROR: " .. _err, 10) end end local Event_Check = world.addEventHandler(checkForEvent) -
@cfrag See I told you I was a noob at programming/lua/DCS MSE Thanks once again. Issue 1 Yeap, I wasn't thinking in programing terms in that "=" isn't equal but "assign". programing 101. And I will try other ways to protect against this. As I have it, I could use the group ID in a similar fashion , but that would only work with 1 unit per group. I thought it might be something like this. DCS MSE has many dead-end rabbit holes, or so I have read. Thanks again for the help. Now to go update the script.
-
Hi all, I'm not a programmer and relatively new to lua and DCS MSE. I am not asking for someone to rewrite, or write the script, just point me in a direction, or explain to me why it is doing what it's doing. Als I will attach the full script at the end. At the end of the script is a comment section containing an outline of the script and what I think the flow is. I am trying to write a script that will display a F10Other menu to clients that enter a helo. They can choose one of two options that will give them the bearing and distance to a "hot Landing Zone". I use the scheduleFunction to repeat the message of distance and bearing every 20 seconds. So far I have only tested by myself. It seems to work up until the point I select another aircraft, or if I crash. FIRST ISSUE Once I leave the current unit, or crash, I get an error message about 20-30 seconds later stating the "unit does not exist". What confuses me is right before the line that the scripts crashes, I have a check to see if the unit is nill, if it is nill, then it isn't supposed to execute the line that crashes. I've attached a screenshot showing the error message and the related section of the script. The section of script is local function inFlightDistHead(tempTBL, time) local ourArgument = tempTBL[1] local uObject = tempTBL[2] local landingZone = tempTBL[3] local gID = tempTBL[4] -- add slight delay for multiplayer timing for i = 1, 333333333 do --[[ do nothing ]] end -- Simple error check if uObject == nil then trigger.action.outText(" Sorry, but uint object is nil",15) ourArgument= 1 -- trigger.action.outText("Unit life is ".. uObject:getLife(), 10) -- trigger.action.outTextForGroup(gID,"Inside schedule function ourArgument is " .. ourArgument.. ' and the landing zone is ' .. landingZone .. ' degrees', 10) elseif ourArgument == 53 and timer.getTime() < 1800 then trigger.action.outText("INSIDE LOOP: Unit life is ".. uObject:getLife(),10) -- THIS IS THE LINE TWHERE THE "UNIT DOES NOT EXIST OCCURS local cDistance, cHeading = distanceHeading(uObject, landingZone) trigger.action.outTextForGroup(gID, "Distance to " .. landingZone .. " is " .. cDistance.. ' nm at a heading of ' .. cHeading .. ' degrees', 10) trigger.action.outSoundForCoalition(2 , "shiny-sound-effect.ogg" ) -- Keep going AKA_Message_Output return (time + msgInterval) else -- That's it we're done looping trigger.action.outTextForGroup(gID, '\n===========================\nMaximum time exceeded\nMax time was set to 1800 \n===========================\n', 10) return nil end end -- "end' assocaited iwth inFlightDistHead(tempTBL, time) Now, I tried to get fancy and this function is inside other function that I set up as an overarching function/wrapper. I don't know if that could cause this issue or not due to something being out of scope? SECOND ISSUE I am trying to use the world.eventHandler to see if I can tell when a unit has been exited. I have added S_EVENT_PLAYER_LEFT tas a check, but I don't seem to get that activated when I leave an aircraft. In the section of code below, I DO get the debug message when I crash but not when I just choose a different slot. elseif ((event.id == world.event.S_EVENT_EJECTION and event.initiator ~= nil) or (event.id == world.event.S_EVENT_PILOT_DEAD and event.initiator ~= nil) or (event.id == world.event.S_EVENT_CRASH and event.initiator ~= nil) or (event.id == world.event.S_EVENT_PLAYER_LEFT and event.initiator ~= nil) or -- added to mine, not in Relent's S_EVENT_UNIT_LOST (event.id == world.event.S_EVENT_UNIT_LOST and event.initiator ~= nil) or -- added to mine, not in Relent's S_EVENT_UNIT_LOST (event.id == world.event.S_EVENT_DEAD and event.initiator ~= nil)) then local leftUnit = event.initiator if (debugFlagHotLZ == 1) then trigger.action.outText("leftUnit loop Event ID is = " .. event.id,5) end Thanks in advance for any and all help. null Hot_LZ_Challenge_v0_19.lua
-
Hi @cfrag As usual, I was far less than clear. The function math.atan2(z,x) does work for me just as you explained. It is just not the way I expected based on the lua 5.1 manual. Specifically, the lua manual 5.1 states So based on this I expected the math.atan2 to give the correct answer without the need to determine if it was greater than or less than 360 degrees. Given yours and @Grimes responses, I did what I should have done to start with. I wrote a lua, non-dcs, script to see what it did and if it would give me the correct answer. And it doesn't give me the answers that I thought it would. You still need to determine if it is greater than or less than 360. From this I deduce I can read the manual and time to go post on Stackoverflow and see what I misread. Thanks for the help.
-
@BoomBoom Care to share/expand. We are having trouble with some of our mission that is using a really old script?
-
Hi, Still pretty much a newbie with lua and DCS MSE. I am trying to write a function to get the position of a unit and of a zone, and then determine the distance and heading from the unit to the zone. I have gotten it to work, but though trial and error. I do it though using math.atan2(z,x) and then check to see if I need to add 2Pi to get it the correct quadrant. (check to see if I have a negative degree). As I said the code snippet below works, BUT math.atan2(z,x) doesn't work as advertised. I did read in the Lua 5.3 manual where the atan2 function has been "depreciated" and that math.atan(y, [x]) is supposed to correctly accout for the different quadrants. However, I couldn't get it to work either. My question is am I doing something wrong, or missing something basic? Is this an oddity within DCS? Thanks in advance. local function distanceBearing(uObject, landingZone) -- get coords for zone local lzTbl = trigger.misc.getZone(landingZone) local lzX = lzTbl.point.x local lzZ = lzTbl.point.z local lzY = lzTbl.point.y -- vec3 Object.getPoint(Class Self ) local uPoint = uObject:getPoint() local uPointX = uPoint.x local uPointZ = uPoint.z local uPointY = uPoint.y -- Calcualte delta x and z local dx = lzX - uPointX local dz = lzZ - uPointZ local uDistance = math.sqrt(dz*dz + dx*dx) * m2nm -- calculate bearing local uHeading = math.deg(math.atan2(dz,dx)) if uHeading > 0 then uHeading = uHeading --trigger.action.outText("Bearing 6 to inside if statment (then) " .. uBearing6, 10) else uHeading = math.deg(math.atan2(dz, dx)+2*math.pi) --trigger.action.outText("Bearing 6 to inside if statment (else) " .. uBearing6, 10) end trigger.action.outText("\n====================\n\n Distance and bearing to Hot LZ 1\n\n====================\n ", 10) trigger.action.outText("Distance to Hot_LZ_1: " .. uDistance, 10) trigger.action.outText("Heading to Hot_LZ_1: " .. uHeading, 10) end
-
@rob10and @cfrag, Thanks for the responses and kind words. "It depends" sums it all up! And I am generally someone who wants to know "how" and "why". Picking up a written script and trying to tweak to you needs is a great way to start to learn both lua and the MSE API. I too have used MIST and some of "canned" scripts (e.g. cfrag's slot blocker) but haven't tried MOOSE yet. Since I am trying to teach myself programming, lua, and know the how and why (as best I can), I thought it would be best to try and do as much as I can via the API with MIST/MOOSE/CTOD as a crutch when necessary. @cfrag I've been crawling around in the MSE API, and I couldn't agree more. It is a much more complex and convoluted rabbit hole with some narrow passages, and dead ends. The Hoggit Wiki documentation has been a godsend. At times, I have to read it multiple times before it dawns on me actually what it is saying I still marvel at what all have done with things like CTOD, MIST, MOOSE, and things like Pretense, Liberation (although C based a lot), Blue Flag and so on. I think I am on page 5 in a book as big as "War and Peace". I'm still in the "fun" stage.
-
How far down the Lua rabbit hole should I go? Reprised Hi all, This is a follow-up to the thread that I originally posted to ask the question about how far down the lua rabbit hole I should go. As that thread has over 400 views and a few response (the comments were on point), none really addressed what I was looking for. So I thought I would take my shot at it and see what kind of feedback I got. https://forum.dcs.world/topic/355021-how-far-down-the-lua-rabbit-hole-should-i-go/ The primary responses were 1) you don’t need to go very deep, or 2) find some examples and modify to your needs. Both are on point. For simple things you don’t need a lot and there is no better way to learn that grab something and start modifying it to meet your needs. @Zyll responded that you don’t need to go very deep to be effective. He recommended being able to expertly traverse table and learning the API will get the biggest bang for the buck. MOOSE was also in his response, and from what I’ve read and seen on YouTube, one can do a lot without an in-depth knowledge of lua. They have a lot of example scripts to use MOOSE that I think you can make it a good starting point. I will note that the MOOSE User Guide 1.0 has a good break down under “intermediate scripting” of what one should know. As part of this they suggest that one reads chapters 1 – 4 of the Lua Manual (Edition1). OK, so here is my thoughts on the lua and how far down the rabbit hole to go. Again, my goals were to learn the language, to understand the DCS API itself, and write scripts. Lua Basics Obviously, you will need a detail knowledge of ALL the basics such as; 1. the general syntax of the language, 2. types and variables (numbers, strings, Boolean), 3. valid variable names, 4. reserved names (e.g., and, or, for, etc.), 5. expressions (mathematical, relational, logical, etc.) 6. concatenation operator “..” 7. precedence 8. scope of variables and blocks All of these are pretty easily picked up as they are used all the time. Control Structures These will be used often and as such you will need (and gain through usage) a detail know of most if not all of these. 1. If then else, else if statement – This is used all the time to determine when the script should do something based on the state of a variable. 2. While statement – these will be used although I don’t think as often as the if then else statement of the for statement. 3. For statement (numeric) – This, along with the if statement is used ALL the time. The numeric for is pretty straight forward. 4. For statement (generic) – One of the KEY concepts that you will need to know. Discussed in more depth below with tables. 5. Break and return statements – These will be used a lot as well. They can appear in any of the control statements and in functions. 6. Repeat statement – I haven’t used this much and not sure there is much need. I know hat it is but not near as familiar with it’s usage as the other Functions Functions are used everywhere. You will get to know these in detail. Regular functions, nested functions, functions as part of tables and metatable. Alos you will need to know how to pass items to function in various manners (single variables, tables ,etc. Tables Tables are THE data structure of lua. They are used everywhere in DCS. DCS uses classes and objects extensively, which are tables. To quote @Zil from the other thread: Expertly traversing tables (hint: everything in Lua is pretty much a table) is a must. Generally, the generic for (either in ipairs or in pairs) is used to traverse tables. I’m still trying to wrap my head around how these actual work on complex tables containing data, functions and other tables. Object Oriented Programing, Classes and Objects A good understanding of OOP, Classes and Objects will make life a lot easier. These are essential to understanding the DCS API and everything that Grimes, and others have documented, on Hoggit and other sites. This will help in understanding the “self” keyword, the “:” operator, as well as other little oddities. My guess (and it’s only a guess at this point in my script development history) is that for intermediate levels scripts you won’t be building your own classes and objects. It’s also my guess is that more advanced scripters, and certainly those doing MOOSE do make their own classes/objects. Metatables/metamethods Like OOP, Classes, and Objects understanding these, different types (e.g. __index) will go a long way in understating the DCS API and what you see in other scripts. Coroutines I worked through a couple of examples of this in lua itself. I’m not sure if these will actually be used in scripts. I don’t plan on spending much time. Debugging tools. I have just started to scratch the surface on this subject. Using pcall() and xpcall() can help in not having the mission crash due to an error and it can provide more information. io interface Yup, that is if you plan on trying to output/retrieve data. I’ve used this to generate reports associated with some random flags and unit generation. And there are plenty of larger efforts (e.g., Liberation, Pretense, etc) that use this to save the state of a mission at the end of a session. Standard Libraries I have run into a few of these, but they are pretty easy to pickup and understand as you go along. Other stuff There are TONS of other more complex/detail things in lua and the lua manual. Will those be needed? Who knows. If one is more than just a part time scripted, then probably. But all of that will come with time. Wrap up Ok those are my thoughts. I would love to see other’s thoughts and comments.
-
DML - Mission Creation Toolbox [no Lua required]
AKA_Clutter replied to cfrag's topic in Scripting Tips, Tricks & Issues
ROFLMAO - everyone knows better. -
How to schedule a funtion that is being called?
AKA_Clutter replied to AngelRR92's topic in Scripting Tips, Tricks & Issues
EDITED - I see I was WAY off base. I'll be interested in what the actual solution is. -
Help with DCS func addCommandForCoalition
AKA_Clutter replied to AKA_Clutter's topic in Scripting Tips, Tricks & Issues
OK, found the solution to this problem. I think @cfrag hit on the answer with the "root table" mention. I know the names of the levels and as such I think that is all I needed. See this thread -
Trying to pass menuID as a global variable
AKA_Clutter replied to AKA_Clutter's topic in Scripting Tips, Tricks & Issues
@Grimes Thanks so V ERY much. Now that I look closer at the Wiki, all the information is there, I just need to learn how to read the Wiki and the DCS API better. Also, still a newbie with lua. When I get a chance, I think I'll play around with this and see if I understand everything correctly. One thing I want to do is to 1 ) figure out how to get the complete table and then rpint it to a file just to see what it looks like. Thanks again for your knowledge and willingness to help Clutter -
Trying to pass menuID as a global variable
AKA_Clutter replied to AKA_Clutter's topic in Scripting Tips, Tricks & Issues
@Grimes Two questions: 1) is this path entry table accessible/readable? I didn't see any reference to this in the wiki. Of course, it is very likely that I overlooked it. 2) Directly using it does appear to work for the first level below F10 Other. Any idea how to do this for a sub-sub menu. F10Other -> Level 1 -> Level 2 I've tried a couple of things but no joy yet. -
Trying to pass menuID as a global variable
AKA_Clutter replied to AKA_Clutter's topic in Scripting Tips, Tricks & Issues
Hi @Grimes thanks for the response. I'm not sure what I did earlier, but I went back added a simple text variable to pass as an additional test just to verify that what I thought would be a global variable was indeed global. And indeed they are. Funny thing is after that, the script snippets did work as expected. I thought that perhaps I call the initial F10 Other before the second snippets was called and that screwed things up. But that doesn't seem to be it either. It works now and the new sub menu item shows up as intended. With that said, I'll play around with your two suggestions just as various ways to solve the same problem. The initial problem I am trying to solve is that in one of our squad training missions, the F10 Other menu is populated by a script written by someone else. It generates the F10 other menu based on a naming scheme. I would like to add some other submenu items to the ones that are auto generated. Again, thanks for the response and help. Clutter -
IIRC when they first came out with MT, there were issues with some older cpus with low core count. Also, iirc I think the recommendation was to limit the number of cores to use with MT. I initially had a i7 8700k when it first came and it worked fi e(point of reference). Might be worth some research.
-
Weird. I assume you tried loading it several times? Did you try running a repair?