Swat Equip Assist

Moderator: xyzzy

Anyone tired yet of typing equipment over and over while being the leader? I made a tool to solve this problem, so less typing, more playing.

Image

Attachment includes source, for anyone security-conscious.

Note: Some items (like armor and secondary) can be excluded from the expression!

Expression Formats:

- Logical (minimal)
example | eq: smg/jhp/pistol/5fb/c2/la/helmet

- Literal (verbose; most useful to inform new players)
example | Equipment: SMG, JHP, Pistol, 5 Flashbangs, C2, Light Armor, Helmet

- ETS (balance between Logical and Literal)
example | Equipment: smg, jhp, pistol, 5 fb, c2, light armor, helmet

Hotkeys

A system-wide hotkey can be set for each save. Hotkeys allow expressions to be sent to SWAT 4 automatically, vitiating the need to switch to the desktop.

Once a hotkey becomes effective, it will only serve in terms of this application, so always use modifiers to avoid conflicts. Note that hotkeys aren't effective until saved.

Arguments

- Forward
Runs a file after loading Equip Assist.
Syntax: forward:"<SWAT 4 file path>"
Note: All following arguments from this argument are used to run the file. Assuming that the file path refers to SWAT, the 'nointro' argument is passed by default.

- Chatkey
Specifies the teamchat key. This will modify how expressions are prefixed when pressing hotkeys. If none is set, then chat must be opened manually.
Syntax: chatkey:[t|none]

- Hidden
Hides the Equip Assist window. This argument only works in conjunction with Forward.
Syntax: hidden:[yes|no]
Note: Use with caution. If set, then accessing the Equip Assist window becomes impossible while SWAT is running. Only one instance of Equip Assist can run at a time.

Example of a shortcut:
"E:\Sierra\SWAT 4\ContentExpansion\System\SwatEquipAssist.exe" chatkey:t hidden:no forward:"E:\Sierra\SWAT 4\ContentExpansion\System\Swat4X.exe"

Technical Notes:

Saves are stored at:
%appdata%\{5A3BEF97-3E67-4D60-BDC6-C059FE41161A}

No further disk writes are commited.

-

Save files can be imported using <Ctrl+F12>.

<Tab> and <Shift+Tab> are supported.

Use <Backspace> to return to the first equipment button.

Use <Ctrl+Enter> on an equipment button to select the expression.

Numpad, numeric keys, <Up Arrow> and <Down Arrow> can be used to alter the state of an equipment button.

Use <Esc> to copy the expression to the clipboard. If SWAT 4 is running, then it will be activated.

Mnemonics are enabled.

Buttons in category 'Tactical' are automatically corrected to maintain a limit of 5 items. Increments cause correction from right to left. Decrements cause correction from left to right.

Universal Equipment Sets

(You may want to print this list.)

CTRL+F0
=
EJ1: jhp/5fb/c2/la/helmet
EJ2: jhp/4fb,1gas/c2/la/helmet
EJ3: jhp/3fb,2gas/c2/la/helmet
EJ4: jhp/3fb,1gas,1wedge/c2/la/helmet
EJ5: jhp/4fb,1wedge/c2/la/helmet

Ctrl+Alt+F0
=
EF1: fmj/5fb/c2/la/helmet
EF2: fmj/4fb,1gas/c2/la/helmet
EF3: fmj/3fb,2gas/c2/la/helmet
EF4: fmj/3fb,1gas,1wedge/c2/la/helmet
EF5: fmj/4fb,1wedge/c2/la/helmet

Ctrl+Shift+F0
=
EG1: fmj/5gas/c2/la/gasmask
EG2: fmj/2fb,3gas/c2/la/gasmask
EG3: fmj/3fb,2gas/c2/la/gasmask
EG4: fmj/3gas,2wedge/c2/la/gasmask

The save file is attached to this post. Use Ctrl+F12 to import saves.

Attachments

Hello dahl,
It's a good idea indeed,but if I'm in-game and I don't want to write the eq,is there any way to create a hot-key so when I press it,a pre saved equipment phrase will be automatically copied to the clipboard,and I'll simply press Ctrl+V to paste it in the chat box ingame, instead of going to desktop and choosing the eq I want then copy the equipment phrase ,comeback to the game and paste it (it will take more time than simply write it :D )
(the tool should be already open in both cases ofc)

Greetings
@chlarmi,

Unless the ingame console provides such solution, then achieving such possibility is non-trivial. In eitherway, you may need a lot of function keys depending on the amount of saves.

Typing may indeed be faster if switching to the desktop is unfavorable, or if you can type really fast; but it is a highly disciplinary practice, providing non-uniform results, requiring you to solve the same problem over and over. On the long term, it is more demanding to format equipment strings manually. Generally, players tend to have a fixed equipment per map, which they could capture and reuse. I noticed only few alterations, with gas masks most prominently.

Also note that manually written strings are often limited to essential items such as ammo and tacticals, excluding headwear and breaching devices, which could encourage new or ignorant players to choose useless equipment. There are many loopholes which misguides irregular players, lowering the game quality, and this application only attacks few of them.
Hi Dahl,

Very good app you got here, I've got a cool suggestion why not create setups that are best used for custom maps that way everyone will have the best chance of doing customs smoothly and without fear due to their eq might not be as effective. So far it looks good on the screenshots that i've seen but good work. I hope u take this suggestion into consideration

Many Thanks
Accuser
Interesting thread here guys. I've quickly checked your application and I must tell I like the idea of yours when it comes to the clicking buttons, which are calculating the slots etc. It's great. Anyway, as chlarmi said, alt-tabbing from the game might not become very handy.

chlarmi wrote:
if I'm in-game and I don't want to write the eq,is there any way to create a hot-key so when I press it,a pre saved equipment phrase will be automatically copied to the clipboard

dahl wrote:
Unless the ingame console provides such solution, then achieving such possibility is non-trivial. In eitherway, you may need a lot of function keys depending on the amount of saves.


I also had the exactly same trouble as you guys have. SWAT 4 game does not allow you to use binds while in lobby. If you want to go get rid of re-typing everything, this is where macros do the job. However, even though macros are just fine for this, to use them, you might need special mouse or keyboard device supporting this handy feature. I myself have macros set for the equipment shortcuts and I can say I don't need much to have enough. In-fact, I use just 4 buttons for ordering the equipment set. Those are:
  • A1/B1 EQ -> 4x Flashbang, 1x Wedge
  • A2/B2 EQ -> 3x Flashbang, 2x Gas
  • A2/B2 EQ -> 5x Flashbang
  • Other Equipment: Helmet / C2

It wouldn't be hard to alter Dahl's application. Although I am not C# programmer, I bet you can achieve the same goal using the similar I would do in C++. Thinking now and from the scratch, I think this might be the way to even improve you application to another level. In C++, those functions would be used:
RegisterHorKey() - simply catch hotkey sent by user, then write the specified equipment using SendInput(), keydb_event() or in C# this. To make it even more interesting, you could create two separate executables, one altering the equipment set and its hotkeys (so something you have now, just a hotkey settings would be added), and the other executable, which would work as a new SWAT 4 starter. It might have the exactly same icon, so it would look just like the game's shortcut on the desktop. This starter would load settings from file, read its command line arguments, which would be resend to original SWAT4X.exe (so that we can still use command arguments like: 5.9.64.179:11480?Password=****). When hotkey is received, callback handler would just write the specified equipment. I bet you get the basic idea.

If you do it like this, I am pretty sure I would use your application as well.

Thanks for bringing this up mate!
Hunter
Image

Code high, commit sober.
Nice, another great programmer providing us with more tools. Can't wait what both you and Hunter will bring us next, especially if you collaborate. :D

Dahl, it certainly looks interesting and I like the simplistic UI design. I will try it out but I don't think I'll use it frequently since I can generally type out eq fast and alt-tabbing is slower (but mainly because my swat is still all jumbled up and have to reinstall it).
Would be awesome if you could somehow link it with swat so that once you press certain key the UI would appear in game or like steam overlay and you'd be able to pick your eq and then paste it in chat. But dunno if that's possible.

Anyways, good job and keep working on more stuff!
"You might think you know everything there is to know about me.. But really, you're not even close."

"I don't care if this is the end...So...I'll use everything."
Accuser wrote:
Hi Dahl,

Very good app you got here, I've got a cool suggestion why not create setups that are best used for custom maps that way everyone will have the best chance of doing customs smoothly and without fear due to their eq might not be as effective. So far it looks good on the screenshots that i've seen but good work. I hope u take this suggestion into consideration

Many Thanks
Accuser


I'll write a save file with presets for stock maps, but not for custom maps, because I don't know them. However, if you wish, you could do it. Note that such equipment sets must be simple and universally agreeable. For example, a bias for either pistol or taser may cause friction.

Sokol wrote:
Would be awesome if you could somehow link it with swat so that once you press certain key the UI would appear in game or like steam overlay and you'd be able to pick your eq and then paste it in chat. But dunno if that's possible.


It is possible, but it would require serious hijacking to show the window as an overlay, similar to steam. I'll pass on that for now.

Hunter wrote:
Anyway, as chlarmi said, alt-tabbing from the game might not become very handy.


I recognize that a desktop switch may distract the user from the game, especially in case of a slow computer, a bright desktop background, many desktop icons or many open windows.

For now, I've binded <Esc> (non-system wide) so that the expression is copied to the clipboard, while finally, the Swat 4 (SS) window is activated if present. With this addition, selecting equipment will be as easy as: <T>, <Alt+Tab>, (Use <Up Arrow> and <Down Arrow> to select save), <Esc>, <Ctrl+V>, <Enter>.

Note that upon activating the SwatEquipAssist window at a second time, the save-list is automatically selected. In addition, saves are automatically opened if selected through the arrow keys, so the current expression will match accordingly.

Hunter wrote:
It wouldn't be hard to alter Dahl's application. Although I am not C# programmer, I bet you can achieve the same goal using the similar I would do in C++. Thinking now and from the scratch, I think this might be the way to even improve you application to another level. In C++, those functions would be used:
RegisterHorKey() - simply catch hotkey sent by user, then write the specified equipment using SendInput(), keydb_event() or in C# this. To make it even more interesting, you could create two separate executables, one altering the equipment set and its hotkeys (so something you have now, just a hotkey settings would be added), and the other executable, which would work as a new SWAT 4 starter. It might have the exactly same icon, so it would look just like the game's shortcut on the desktop. This starter would load settings from file, read its command line arguments, which would be resend to original SWAT4X.exe (so that we can still use command arguments like: 5.9.64.179:11480?Password=****). When hotkey is received, callback handler would just write the specified equipment. I bet you get the basic idea.


It is simpler to include system-wide hotkey support in the main executable, optionally with a checkbox to turn it off. If those functions (RegisterHotKey and SendKeys) do what I assume, then I could easily add such feature. I'll post an update later today.
I've commited the changes in the OP, hotkeys are now supported.

@Hunter,

RegisterHotKey and SendInput worked. However, SWAT couldn't capture keycodes sent with KEYEVENTF_UNICODE. I used KEYEVENTF_SCANCODE instead, apparently it uses a lower-level method.

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 196 on Fri Nov 23, 2012 8:34 pm

Users browsing this forum: No registered users and 1 guest