When I make toggles, I usually just use 1 and 0, but it doesn't really matter. Your script works. However, you may want to give instructions to type
in-game, so that their current "mapstartalways" isn't wiped. Don't add it to autoexec or it will be added every time AC is started. There's also strstr and checkalias, but I'm usually too lazy for that. Instead of using an alias to toggle, you could just check if the fog is 1024 or not.
Yes, that's the most error proof simple script I've ever written.
[SELECT ALL] Code:
/addOnLoadAlways [ alias x "333" ]
[SELECT ALL] Code:
togglefog = [ if (= $fog 1024) [ if (&& (checkalias oldfog) (>= $oldfog 64) ) [ fog $oldfog ] [ fog 180 ] ] [ oldfog = $fog; sleep 5 [ fog 1024 ] ] ] ]