I had someone ask me about the use of my script, and rather than answer privately I figured I'd explain what's going wrong here for the benefit of anyone else who might be trying to use only
parts of the script for the functions they found useful.
Mule, I'm having trouble with the zoom part of your script.
...snippets from my script including zoom level memory, weapon switching subcommands that control order of selection, and movement state commands...
bind MOUSE2 "+vstr ztoggle zNot" //hold-to-zoom, works better and faster, but requires +vstr support (1)
I use this but I cannot figure out how to hold to zoom. Can you help?
Thanks.
Note the "(1)" on that last line. It indicates you must use once of the UrT clients which support "+vstr" commands. Also note that the whole script kind of works in an all-or-nothing sort of system. Any command that you use not integrated into these commands will create another way in which this system can get out of sync with the true game state, or in this case be missing components that tie into the other systems.
If what you shared is the entire portion of script you're using, then you missed the portion that defines the "ztoggle" and "wret" commands, because they tightly integrate with weapon selection AND movement state management. The reasons for that are:
- I support using FOV values (and mouse sensitivity values) that are movement state specific (i.e. widest when sprinting, second narrowest when crouching--truly narrowest when zoomed/in iron sights). To restore those states correctly the movement system needs its fingers in the unzooming process.
- I do some weapon-management stuff on releasing fire (ensuring auto-switch back to last selected weapon after firing a single grenade rather than getting the inconsistent post-firing state of a random weapon selection or second grenade). To avoid losing zoom when the script gets out of sync (selecting grenade without carrying any), I
don't do that while zoomed--selecting primary while zoomed in primary breaks zoom in my script, because of various
other potential sync issues and workarounds being applied.
- Once upon a time, rather than implementing iron sights zoom for all weapons, I had my zoom button auto-switch to primary. This can still be easily supported as the system currently works with the addition of one "middle management" command similar to ztoggle. This again requires integration with and thus full use of the weapon selection management system.
Zooming is in particular very tightly integrated with movement and weapon management. If you exclude this portion you can probably use either weapon management or movement independently. Any attempts however, to cherry-pick subsets of either of those systems, however, is likely to work very poorly.