Sorry for asking, I should use alias for creating the +myz and -myz.
Here is the working script with these 2 changes.
Code:
// Zoom levels
set fov1 "cg_zoomfov 80;cg_zoomsensitivity 1; print Zoom 80"
set fov2 "cg_zoomfov 55;cg_zoomsensitivity 1; print Zoom 55"
set fov3 "cg_zoomfov 35;cg_zoomsensitivity 1; print Zoom 35"
set fov4 "cg_zoomfov 20;cg_zoomsensitivity 1; print Zoom 20"
// Zoom cycle
set sfov1 "vstr fov1; set lzoom vstr sfov1; set mzoom vstr sfov2"
set sfov2 "vstr fov2; set lzoom vstr sfov1; set mzoom vstr sfov3"
set sfov3 "vstr fov3; set lzoom vstr sfov2; set mzoom vstr sfov4"
set sfov4 "vstr fov4; set lzoom vstr sfov3; set mzoom vstr sfov4"
// Zoom with mousewheel
set wheel_zoom "bind mwheelup vstr mzoom; bind mwheeldown vstr lzoom"
// Weapon selection with mousewheel
set wheel_norm "bind mwheelup weapnext; bind mwheeldown weapprev"
// Set gradual zoom to mouse wheel and default zoom to mouse3
set zwheel "vstr wheel_zoom; bind mouse3 vstr sfov2; +zoom"
// Reset the mouse wheel and mouse3 to their default settings
set nwheel "vstr wheel_norm; bind mouse3 +button2; -zoom"
// Define the command that toggles the wheel between zoom
// and weapons toggle.
alias "+myz" "vstr zwheel"
alias "-myz" "vstr nwheel"
// Set defualt cg_zoomfov
vstr sfov2
// Bind the zoom command
bind space "+myz"
// Show the user that the script is executed
echo "Executed zoom.cfg."
I wonder how you previously created toggle commands on keydown/up without the alias command.
Best Regards
Kadle