I’d like to create a macro so that I can jump between a few different camera speeds using MoveViewRightStart
, but with the option to also stop it.
So…
- Shift + Key = Increase Speed
- Ctrl + Key = Decrease Speed
- Alt+ Key = Stop Camera Movement
The commands in question are:
MoveViewRightStart()
MoveViewRightStop()
I can play with the values used for increasing or decreasing the camera speed myself, but let’s just say I’d like to start with MoveViewRightStart(0.02)
and then change the value by .02 with each increment.
Is this something that can be accomplished with a simple macro?
Something like this, but there probably are ways to improve it, by sanitizing negative values, avoiding floating point shenanigans near zero and shortening the code. The ctrl modifier doesn’t work by default since there normally already is a key binding bound to that combination
/run if IsShiftKeyDown()then cspeed=(cspeed or 0)+.02 MoveViewRightStart(cspeed)elseif IsControlKeyDown()then cspeed=(cspeed or 0)-.02 MoveViewRightStart(cspeed)elseif IsAltKeyDown()then MoveViewRightStop()end
Slightly different
/run if IsAltKeyDown() then MoveViewRightStop() else cspeed = (cspeed or 0) + (SecureCmdOptionParse("[mod:shift].02;[mod:ctrl]-.02") or 0) MoveViewRightStart(cspeed) end
You probably want to start spinning the other direction when continuing to hold your modifier, e.g.
/script local delta =0; spinspeed = spinspeed or 0; if IsShiftKeyDown() then delta = -.1 else delta = .1 end; spinspeed = spinspeed + delta; if spinspeed >=0 then MoveViewRightStart(spinspeed) else MoveViewLeftStart(-spinspeed) end
will spin right when clicked and slower or left when shift clicked
Same question came up somewhere else; so I am curious, what is it for?