Jump to content

Scripts/Hooks - What is 'a_h'? I thought it was the unitID of the player's aircraft but it isn't.


Recommended Posts

Posted (edited)

From here: DCS_ControlAPI.html#gui-callbacks

function onShowRadioMenu(a_h)
end

If I 'tostring' it, then it's 0 when the menu closes, but 468 when I open it. I was hoping it was the unit that was opening the menu but in the ME the unit ID for the aircraft that I was in when I opened the menu is 299.

Anyone have any idea what this is?

 

PS Why can't people follow Apple's best coding practices suggestions and make variable names describe exactly what they are?! This 'save typing' nonsense doesn't help people who have to look at the code to learn from it...

Edited by Elphaba
Posted
On 1/19/2023 at 12:49 AM, Grimes said:

Anything in GUI callbacks is local to that PC. It won't have data on the actions of anyone else. 

So this means every player has to have their own copy of the hooks.lua script and put it in their own Hooks folder?
 

Posted
4 hours ago, Elphaba said:

So this means every player has to have their own copy of the hooks.lua script and put it in their own Hooks folder?
 

For the GUI callbacks yes. 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

You didn't miss it, the distinction isn't there other than stating it gets loaded when its located in a specific folder in a user's saved games folder. How were you do know? Did you try testing it? There are a few things in there that I know how they work and how it works when run on a server, but there are others that I'd have to do a quick test to know for certain how or what it does as a client connected to a server. 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
12 hours ago, Grimes said:

You didn't miss it, the distinction isn't there other than stating it gets loaded when its located in a specific folder in a user's saved games folder. How were you do know? Did you try testing it? There are a few things in there that I know how they work and how it works when run on a server, but there are others that I'd have to do a quick test to know for certain how or what it does as a client connected to a server. 

I *did* test it. But because everything is a black box, I don't know if there is a) a bug, b) I'm doing it wrong, c) there isn't any documention, or it's missing information d) my code is the problem e) something else.


That's the problem. I'm only 4 months into learning all this. You and others on here have had years of dealing with this. But still, for new people who've never used lua before and never done scripting the learning curve if damn near vertical and with missing / no / poor documentation, and code that isn't commented or clear and very few clear examples to learn from - it doesn't make it any easier. 

Perhaps, if I stick with it for 4 more years I can be blasé and know from intuition or experience where the gotchas are... but there are many more like me struggling and never knowing if 'we're' the problem or if it's a bug or if it will just never work. 

Case in point, you mentioned that everything in env.mission is available to the player, but recently I pointed out that the ResKey's for briefing pictures are not accessible even though you and the meagre documentation never make that clear or provide any logical reason for it. 

so for DAYS AND DAYS I waste time thinking I'M the one doing something wrong - when at the end of the day - it's DCS's code / api that's the problem. 

Again, from a beginner - that's almost impossible to discern one from the other.  

Posted
10 hours ago, Elphaba said:

I *did* test it. But because everything is a black box, I don't know if there is a) a bug, b) I'm doing it wrong, c) there isn't any documention, or it's missing information d) my code is the problem e) something else.


That's the problem. I'm only 4 months into learning all this. You and others on here have had years of dealing with this. But still, for new people who've never used lua before and never done scripting the learning curve if damn near vertical and with missing / no / poor documentation, and code that isn't commented or clear and very few clear examples to learn from - it doesn't make it any easier. 

Perhaps, if I stick with it for 4 more years I can be blasé and know from intuition or experience where the gotchas are... but there are many more like me struggling and never knowing if 'we're' the problem or if it's a bug or if it will just never work. 

You might be the first person I recall asking about the GUI callbacks within gameGUI, at least within the mission editor section, perhaps its been asked about in the modding sections. 

I don't know how to teach "gotchas" with regard to scripting. Everyone has their own goals, approaches, and time they can spend on this stuff. Sure there is some intuition on how to solve typical problems, but there is also plenty of "wait a minute did that change?" that occurs in my own scripting projects. And it kinda sucks being just about the sole arbiter of the documentation. If you want to be my guest and rely only on what ED provide. image.pngnull

 

10 hours ago, Elphaba said:

Case in point, you mentioned that everything in env.mission is available to the player, but recently I pointed out that the ResKey's for briefing pictures are not accessible even though you and the meagre documentation never make that clear or provide any logical reason for it. 

I answered in the context of accessing shapes and probably recent other questions of yours that had similar answers. Forgive me on forgetting about one of the few exceptions to the rule that had nothing to do with what the question was about. 

 

 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
55 minutes ago, Grimes said:

You might be the first person I recall asking about the GUI callbacks within gameGUI, at least within the mission editor section, perhaps its been asked about in the modding sections. 

I don't know how to teach "gotchas" with regard to scripting. Everyone has their own goals, approaches, and time they can spend on this stuff. Sure there is some intuition on how to solve typical problems, but there is also plenty of "wait a minute did that change?" that occurs in my own scripting projects. And it kinda sucks being just about the sole arbiter of the documentation. If you want to be my guest and rely only on what ED provide. image.pngnull

 

I answered in the context of accessing shapes and probably recent other questions of yours that had similar answers. Forgive me on forgetting about one of the few exceptions to the rule that had nothing to do with what the question was about. 

 

 

I accept all of that but I feel you might be misrepresenting my frustration and complaint - which was in the last few sentences...

"so for DAYS AND DAYS I waste time thinking I'M the one doing something wrong - when at the end of the day - it's DCS's code / api that's the problem. 

Again, from a beginner - that's almost impossible to discern one from the other.  "

This is the fundamental problem we newbies struggle with - never knowing if it's us or the API that's the problem. The lack of support and interests from ED doesn't help with that. 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...