Calneon

Townscaper autohotkey video capture

Dec 28th, 2020 (edited)
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Usage:
  2. ; CTRL+R: reload the script, will also stop execution
  3. ; CTRL+J: begin, will run indefinitely until CTRL+R is pressed
  4.  
  5. ^r::Reload
  6. ^j::
  7.  
  8. SetMouseDelay, 1
  9.  
  10. ; These values won't work if you're not running in 1080p
  11. ; Position of the sun UI panel (bottom left)
  12. sunPosX := 1795
  13. sunPosY := 655
  14.  
  15. ; Size of the sun UI panel
  16. sunSizeX := 105
  17. sunSizeY := 40
  18.    
  19. Loop {
  20.     ; Each loop we move the sun one pixel to the right, and loop around
  21.     ; when we reach the end
  22.     delta := Mod(A_Index, sunSizeX)
  23.    
  24.     ; X is the start position + loop delta
  25.     X := sunPosX + delta        
  26.     Y := Min(sunPosY + Sin((delta / sunSizeX) * 3.1416 * 1.5) * -sunSizeY, sunPosY)
  27.        
  28.     ; Set the sun position
  29.     MouseMove, X, Y
  30.     MouseClick
  31.     sleep, 100
  32.  
  33.     ; Drag to rotate the camera
  34.     MouseMove, 1500, 1000
  35.     sleep, 1
  36.     SendEvent {click, down}
  37.     sleep, 1
  38.     MouseMove, 1511, 1000
  39.     sleep, 1
  40.     MouseMove, 1512, 1000
  41.     sleep, 1
  42.     MouseMove, 1513, 1000
  43.     sleep, 1
  44.     MouseMove, 1514, 1000
  45.     sleep, 1
  46.     MouseMove, 1515, 1000
  47.     sleep, 1
  48.     SendEvent {click, up}
  49.     sleep, 100
  50.    
  51.     ; Take a screenshot
  52.     ; Increase the sleep time if your computer freezes longer while taking the screenshot
  53.     MouseMove, (1823), (736) ; Move to screenshot
  54.     MouseClick ; Capture
  55.     sleep, 500
  56. }
  57. return
Add Comment
Please, Sign In to add comment