Advertisement
Guest User

H3 Combat Terrain Module

a guest
Jun 10th, 2016
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.39 KB | None | 0 0
  1. #RequireAdmin
  2. #include <TrayConstants.au3>
  3. #include <Misc.au3>
  4.  
  5. HotKeySet("{ESC}", "Terminate")     ; Terminates script using [escape]
  6. HotKeySet("{RIGHT}", "Forward")     ; Increments y coordinate by 1 (0,143) using [right arrow]
  7. HotKeySet("{LEFT}", "Backward")     ; Decrements y coordinate by 1 (0,143) using [left arrow]
  8. HotKeySet("{UP}", "Up")             ; Increments x coordinate by 1 [no limits] using [up arrow]
  9. HotKeySet("{DOWN}", "Down")         ; Decrements x coordinate by 1 [no limits] using [down arrow]
  10. HotKeySet("{w}", "TerrainUp")       ; Increment Terrain type (1, 2, 4, 8 ...) using [w]
  11. HotKeySet("{s}", "TerrainDown")     ; Decrement Terrain type (4, 2, 1, f512 ...) using [s]
  12.  
  13. Local $xx = 0
  14. Local $yy = 0
  15.  
  16. WinActivate("???????????")          ; Focus on Terrain Obstacles program
  17. WinWaitActive("???????????")        ; Wait for Terrain Obstacles program to be active
  18. ControlCommand("","","[Class:TCheckBox; INSTANCE:1]","Check") ; Automatically turn on grid
  19. ControlSetText("","","[CLASS:TEdit; INSTANCE:2]",$xx)         ; Set X coordinate
  20. ControlSetText("","","[CLASS:TEdit; INSTANCE:3]",$yy)         ; Set Y coordinate
  21.  
  22. Local $CurrentTerrain = 0
  23. Local $TerrainArray[19] = ["1","2","4","8","16","32","64","128","256","f1","f2","f4","f8","f16","f32","f64","f128","f256","f512"]
  24. ControlSetText("","","[CLASS:TEdit; INSTANCE:1]",$TerrainArray[$CurrentTerrain]) ; Set terrain to dirt
  25. ControlClick("","","[CLASS:TButton; INSTANCE:1]"); Generate Terrain
  26.  
  27. While True
  28.    ToolTip('w,s to change terrain type' & @CRLF & 'Arrow keys to move around' & @CRLF & 'ESC to terminate',0,0, 'HELP')
  29.    sleep (10000)
  30. WEnd
  31.  
  32. Func Terminate()
  33. Exit 0
  34. EndFunc
  35.  
  36. Func Forward()
  37.    $yy = $yy+1
  38.    If $yy > 143 Then
  39.       $yy = 0
  40.       $xx = $xx+1
  41.    EndIf
  42.    If $xx > 143 Then
  43.       $xx = 0
  44.    EndIf
  45.       ControlSetText("","","[CLASS:TEdit; INSTANCE:2]",$xx)
  46.       ControlSetText("","","[CLASS:TEdit; INSTANCE:3]",$yy)
  47.       ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  48. EndFunc
  49.  
  50. Func Backward()
  51.    $yy = $yy-1
  52.    If $yy < 0 Then
  53.       $yy = 143
  54.       $xx = $xx-1
  55.    EndIf
  56.    If $xx < 0 Then
  57.       $xx = 143
  58.    EndIf
  59.       ControlSetText("","","[CLASS:TEdit; INSTANCE:2]",$xx)
  60.       ControlSetText("","","[CLASS:TEdit; INSTANCE:3]",$yy)
  61.       ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  62. EndFunc
  63.  
  64. Func Up()
  65.    $xx = $xx+1
  66.    If $xx > 143 Then
  67.       $xx = 0
  68.       $yy = $yy+1
  69.    EndIf
  70.    If $yy > 143 Then
  71.       $yy = 0
  72.    EndIf
  73.       ControlSetText("","","[CLASS:TEdit; INSTANCE:2]",$xx)
  74.       ControlSetText("","","[CLASS:TEdit; INSTANCE:3]",$yy)
  75.       ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  76. EndFunc
  77.  
  78. Func Down()
  79.    $xx = $xx-1
  80.    If $xx < 0 Then
  81.       $xx = 143
  82.       $yy = $yy-1
  83.    EndIf
  84.    If $yy < 0 Then
  85.       $yy = 143
  86.    EndIf
  87.       ControlSetText("","","[CLASS:TEdit; INSTANCE:2]",$xx)
  88.       ControlSetText("","","[CLASS:TEdit; INSTANCE:3]",$yy)
  89.       ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  90. EndFunc
  91.  
  92. Func TerrainUp()
  93.    If $CurrentTerrain = 18 Then
  94.       $CurrentTerrain = 0
  95.    Else
  96.       $CurrentTerrain = $CurrentTerrain+1
  97.    EndIf
  98.    ControlSetText("","","[CLASS:TEdit; INSTANCE:1]",$TerrainArray[$CurrentTerrain])
  99.    ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  100. EndFunc
  101.  
  102. Func TerrainDown()
  103.    If $CurrentTerrain = 0 Then
  104.       $CurrentTerrain = 18
  105.    Else
  106.       $CurrentTerrain = $CurrentTerrain-1
  107.    EndIf
  108.    ControlSetText("","","[CLASS:TEdit; INSTANCE:1]",$TerrainArray[$CurrentTerrain])
  109.    ControlClick("","","[CLASS:TButton; INSTANCE:1]")
  110. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement