Jump to content

Recommended Posts

Posted

I'm trying to write some Lua to handle requests initiated by a pilot (e.g. a multiplayer client) via the F10 radio commands. I've sort of hit a road block as there's no event that captures this sort of thing, so how would one best figure out who (e.g. "Event".initiator) just hit F10>command?

 

Thanks!

Relent

Posted

Thanks xcom, but I guess I'm still stumped as there is no event to listen for that relates to someone hitting an F10 menu item... i.e. the only events I see are:

 

0 = S_EVENT_INVALID"

1 = "S_EVENT_SHOT"

2 = "S_EVENT_HIT"

3 = "S_EVENT_TAKEOFF"

4 = "S_EVENT_LAND"

5 = "S_EVENT_CRASH"

6 = "S_EVENT_EJECTION"

7 = "S_EVENT_REFUELING"

8 = "S_EVENT_DEAD"

9 = "S_EVENT_PILOT_DEAD"

10 = "S_EVENT_BASE_CAPTURED"

11 = "S_EVENT_MISSION_START"

12 = "S_EVENT_MISSION_END"

13 = "S_EVENT_TOOK_CONTROL"

14 = "S_EVENT_REFUELING_STOP"

15 = "S_EVENT_BIRTH"

16 = "S_EVENT_HUMAN_FAILURE"

17 = "S_EVENT_ENGINE_STARTUP"

18 = "S_EVENT_ENGINE_SHUTDOWN"

19 = "S_EVENT_PLAYER_ENTER_UNIT"

20 = "S_EVENT_PLAYER_LEAVE_UNIT"

21 = "S_EVENT_PLAYER_COMMENT"

22 = "S_EVENT_SHOOTING_START"

23 = "S_EVENT_SHOOTING_END"

24 = "S_EVENT_MAX'

 

So I'm thinking if I need to act on a particular user hitting an F10 menu item, I should probably dynamically show the F10 menu item only when a user does very specific activities that enable that menu item (e.g. unit in a zone, etc). Then based on the unit that performed the activity I could probably figure out who it is. More experimenting...

Posted

Since you are using scripting you can add the command specifically to the group in question and then pass that information directly to the function that is called from the command...

 

http://wiki.hoggit.us/view/DCS_func_addCommandForGroup

 

missionCommands.addCommandForGroup(grp:getID(), "F10 Command Name", nil, whateverFunction, {whatever = true, groupId = grp:getID()})

 

Whichever group sends the command the Id of the group will be passed to the function. Viola you will know who hit F10.

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

Thanks Grimes - I was scouring the Hoggit site but was coming up empty on how hitting F10/etc. could possibly be tracked, so was leaning towards dynamically creating the menus as mentioned. I appreciate the code example!

 

Relent

  • Recently Browsing   0 members

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