Guest User

STCHsource.ahk

a guest
Jul 5th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.16 KB | None | 0 0
  1. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn ; Enable warnings to assist with detecting common errors.
  3. SendMode Input
  4. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  5.  
  6. FormatTime, CDD1,, dd
  7.  
  8. FormatTime, CDD2,, MMMM
  9.  
  10. FormatTime, CDD3,, yyyy
  11.  
  12. FormatTime, CTT1,, hh
  13.  
  14. FormatTime, CTT2,, mm
  15.  
  16. FormatTime, CTT3,, tt
  17.  
  18. FormatTime, CTT4,, ss
  19.  
  20.  
  21. catc:=1
  22. global catc
  23.  
  24. global h
  25. global v
  26. global h0
  27. global v0
  28. global h1
  29. global v1
  30. global h2
  31. global v2
  32. global sch
  33. global scw
  34.  
  35.  
  36. ;These are the raw hotkeys as read from the configuration file (will read w or f or t or f11 or PgDn)
  37.  
  38. FileReadLine, www, STCHconfig.txt, 30
  39. global www
  40. FileReadLine, eee, STCHconfig.txt, 36
  41. global eee
  42. FileReadLine, rrr, STCHconfig.txt, 42
  43. global rrr
  44. FileReadLine, ttt, STCHconfig.txt, 48
  45. global ttt
  46. FileReadLine, yyy, STCHconfig.txt, 54
  47. global yyy
  48.  
  49. FileReadLine, sss, STCHconfig.txt, 60
  50. global sss
  51. FileReadLine, ggg, STCHconfig.txt, 66
  52. global ggg
  53.  
  54. FileReadLine, ddd, STCHconfig.txt, 72
  55. global ddd
  56. FileReadLine, fff, STCHconfig.txt, 78
  57. global fff
  58.  
  59. FileReadLine, cloclo, STCHconfig.txt, 90
  60. global cloclo
  61.  
  62. FileReadLine, cencen, STCHconfig.txt, 97
  63. global cencen
  64.  
  65.  
  66. FileReadLine, cencen, STCHconfig.txt, 97
  67. global cencen
  68.  
  69. FileReadLine, widwid, STCHconfig.txt, 16
  70. global widwid
  71.  
  72.  
  73. FileReadLine, heihei, STCHconfig.txt, 21
  74. global heihei
  75.  
  76.  
  77. FileReadLine, waiwai, STCHconfig.txt, 84
  78. global waiwai
  79.  
  80.  
  81. FileReadLine, suprsupr, STCHconfig.txt, 104
  82. global suprsupr
  83.  
  84. ;shorter wait
  85.  
  86.  
  87. ; /4 is fastest allowed with defaults /5 is too fast
  88. shwshw:=waiwai/4
  89.  
  90. global shwshw
  91.  
  92. h :=1
  93. v :=1
  94.  
  95. ;this is center of screen in theory
  96. global v1:=-heihei/2
  97. global h1:=widwid/2
  98.  
  99.  
  100. global feed
  101.  
  102.  
  103. ;bottom left
  104.  
  105.  
  106.  
  107. global h0:=-15000
  108. global v0:=15000
  109.  
  110. global hshv:=shwshw/2
  111.  
  112. global calibr:=10
  113.  
  114. global h00:=15000
  115. global v00:=-15000
  116.  
  117.  
  118.  
  119. ;
  120. ;there is no absolute for submarine titans for mouse control, only relative
  121. ;credit to evilC (wolf II too) for the functional version
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135. pwin:
  136. PrimaryWindow()
  137.  
  138.  
  139. PrimaryWindow(){
  140. global
  141. Gui, GuiName:New
  142.  
  143. Gui, Add, Text,, The on-screen buttons do nothing, they only reflect what is in the configuration file
  144. Gui, Add, Text,, Close program from bottom right corner in tray or press %cloclo%
  145.  
  146. ;
  147.  
  148. ;`n`n`nOriginal ;hotkeys work alongside those below (1=yes 0=no)
  149. ;Gui, Add, Button, x24 y94 w400 h30, %suprsupr%
  150.  
  151.  
  152. Gui, Add, Button, x264 y24 w40 h30, %cloclo%
  153.  
  154. Gui, Add, Button, x10 y200 w400 h30, Resolution from configuration file is %widwid% X %heihei%
  155. Gui, Add, Button, x112 y240 w200 h30, Current base delay is %waiwai% miliseconds (1sec = 1000ms)
  156. Gui, Add, Button, x32 y280 w360 h50, "Return cursor mode" is %cencen% `n(0=none 1=battlefield center 2=monitor center)
  157.  
  158.  
  159. Gui, Add, Button, x20 y400 w70 h30, %www%
  160. Gui, Add, Button, x100 y400 w70 h30, %eee%
  161. Gui, Add, Button, x180 y400 w70 h30, %rrr%
  162. Gui, Add, Button, x260 y400 w70 h30, %ttt%
  163. Gui, Add, Button, x340 y400 w70 h30, %yyy%
  164.  
  165. Gui, Add, Button, x60 y500 w70 h40, %sss% `n (< arrow)
  166. Gui, Add, Button, x30 y450 w70 h40, %ddd%
  167. Gui, Add, Button, x330 y450 w70 h40, %fff%
  168. Gui, Add, Button, x300 y500 w70 h40, %ggg% `n(> arrow)
  169.  
  170. Gui, Add, Button, x100 y470 w30 h20,
  171. Gui, Add, Button, x150 y470 w30 h20,
  172. Gui, Add, Button, x200 y470 w30 h20,
  173. Gui, Add, Button, x250 y470 w30 h20,
  174. Gui, Add, Button, x300 y470 w30 h20,
  175.  
  176. Gui, Add, Button, x190 y520 w50 h20,
  177.  
  178. Gui, Add, Text,,
  179. Gui, Show,, ST CH (Building hotkey helper) - r/SubmarineTitans
  180.  
  181.  
  182. Sleep 1
  183. }
  184.  
  185.  
  186.  
  187.  
  188. ;here is where to dump the HOTKEYS
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. hotkey, % cloclo, theezexit
  196.  
  197. hotkey, % ggg, ggggg
  198.  
  199. hotkey, % sss, sssss
  200.  
  201. hotkey, % ddd, ddddd
  202.  
  203. hotkey, % fff, fffff
  204.  
  205. hotkey, % www, wwwww
  206.  
  207. hotkey, % eee, eeeee
  208.  
  209. hotkey, % rrr, rrrrr
  210.  
  211. hotkey, % ttt, ttttt
  212.  
  213. hotkey, % yyy, yyyyy
  214.  
  215. ;HOTKEYS ABOVE HERE
  216.  
  217.  
  218. Menu, Tray, Tip , Submarine Titans Custom Hotkeys (Building hotkey helper) - r/SubmarineTitans subreddit
  219.  
  220.  
  221. return
  222.  
  223.  
  224.  
  225. ;beyond that return things only execute on demand
  226.  
  227. theezexit:
  228. {
  229. ExitApp
  230. }
  231. return
  232.  
  233.  
  234.  
  235. Thefunc(cordx,cordy,ctct){
  236.  
  237.  
  238. ;top right corner to compensate
  239.  
  240.  
  241. DllCall("mouse_event",uint,1,int, h00 ,int, v00,uint,0,int,0)
  242.  
  243.  
  244. ;bot left corner
  245.  
  246. Sleep %shwshw%
  247.  
  248. DllCall("mouse_event",uint,1,int, h0 ,int, v0,uint,0,int,0)
  249.  
  250. Sleep %shwshw%
  251. ;vertically no distorsion
  252. ;this is the vertical compensation so it doesnt scroll too much
  253. vvnd:=-calibr
  254.  
  255. Sleep %hshv%
  256.  
  257. ;line bellow ends up bottom center
  258.  
  259. DllCall("mouse_event",uint,1,int, h1 ,int, vvnd,uint,0,int,0)
  260.  
  261. icx:=-cordx
  262. icy:=-cordy+calibr
  263.  
  264.  
  265. Sleep %shwshw%
  266. DllCall("mouse_event",uint,1,int, icx ,int, icy,uint,0,int,0)
  267. Sleep %shwshw%
  268. Click, down
  269. Sleep %shwshw%
  270. Click, up
  271.  
  272.  
  273.  
  274.  
  275. }
  276. return
  277.  
  278.  
  279.  
  280. ;this one does the actual return to center, the above one does not require it
  281.  
  282.  
  283. Thefuncoo(cordx,cordy,ctct){
  284.  
  285.  
  286. ;top right corner to compensate
  287.  
  288.  
  289. DllCall("mouse_event",uint,1,int, h00 ,int, v00,uint,0,int,0)
  290.  
  291.  
  292. ;bot left corner
  293.  
  294. Sleep %shwshw%
  295.  
  296. DllCall("mouse_event",uint,1,int, h0 ,int, v0,uint,0,int,0)
  297.  
  298. Sleep %shwshw%
  299. ;vertically no distorsion
  300. ;this is the vertical compensation so it doesnt scroll too much
  301. vvnd:=-calibr
  302.  
  303. Sleep %hshv%
  304.  
  305. ;line bellow ends up bottom center
  306.  
  307. DllCall("mouse_event",uint,1,int, h1 ,int, vvnd,uint,0,int,0)
  308.  
  309. icx:=-cordx
  310. icy:=-cordy+calibr
  311.  
  312.  
  313. Sleep %shwshw%
  314. DllCall("mouse_event",uint,1,int, icx ,int, icy,uint,0,int,0)
  315. Sleep %shwshw%
  316. Click, down
  317. Sleep %shwshw%
  318. Click, up
  319.  
  320. Sleep %shwshw%
  321. if ctct=1
  322. {
  323.  
  324. battleup:=-icx
  325. battlecenter:=-78-icy+v1
  326.  
  327. DllCall("mouse_event",uint,1,int, battleup ,int, battlecenter,uint,0,int,0)
  328. Sleep %shwshw%
  329. return
  330. }
  331. ;i mixed up up and center oh well at least it works
  332.  
  333. if ctct=2
  334. {
  335. upup:=-icx
  336. centerrr:=-icy+v1
  337. DllCall("mouse_event",uint,1,int, upup ,int, centerrr,uint,0,int,0)
  338. Sleep %shwshw%
  339. return
  340. }
  341.  
  342.  
  343.  
  344. }
  345. return
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361. replhot(key) {
  362.  
  363. Return, "{" key "}"
  364. }
  365.  
  366.  
  367. return
  368.  
  369.  
  370. ;testing for now
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381. ggggg:
  382. {
  383. Thefunc(196,45,cencen)
  384. }
  385. return
  386.  
  387.  
  388.  
  389.  
  390.  
  391. sssss:
  392. {
  393. Thefunc(282,45,cencen)
  394. }
  395. return
  396.  
  397.  
  398.  
  399. ddddd:
  400. {
  401. catc:=catc-1
  402. if catc=0
  403. catc:=5
  404.  
  405. if catc=1
  406. Thefunc(313,70,cencen)
  407.  
  408. if catc=2
  409. Thefunc(268,70,cencen)
  410.  
  411. if catc=3
  412. Thefunc(226,70,cencen)
  413.  
  414. if catc=4
  415. Thefunc(181,70,cencen)
  416.  
  417. if catc=5
  418. Thefunc(162,70,cencen)
  419.  
  420. }
  421. return
  422.  
  423. fffff:
  424. {
  425. catc:=catc+1
  426. if catc=6
  427. catc:=1
  428.  
  429.  
  430.  
  431. if catc=1
  432. Thefunc(313,70,cencen)
  433.  
  434. if catc=2
  435. Thefunc(268,70,cencen)
  436.  
  437. if catc=3
  438. Thefunc(226,70,cencen)
  439.  
  440. if catc=4
  441. Thefunc(181,70,cencen)
  442.  
  443. if catc=5
  444. Thefunc(162,70,cencen)
  445.  
  446.  
  447. }
  448.  
  449.  
  450. return
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460. wwwww:
  461. {
  462. Thefuncoo(320,105,cencen)
  463. }
  464. return
  465.  
  466.  
  467. eeeee:
  468. {
  469. Thefuncoo(270,105,cencen)
  470. }
  471. return
  472.  
  473.  
  474. rrrrr:
  475. {
  476. Thefuncoo(222,105,cencen)
  477. }
  478. return
  479.  
  480.  
  481. ttttt:
  482. {
  483. Thefuncoo(174,105,cencen)
  484. }
  485. return
  486.  
  487. yyyyy:
  488. {
  489. Thefuncoo(125,105,cencen)
  490. }
  491. return
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502. ;hotkey, % ggg, ggggg, Off
  503.  
  504.  
  505.  
  506. ;if suprsupr=1
  507. ;{
  508. ;curkey:=replhot(ggg)
  509. ;SendInput %curkey%
  510. ;Sleep %shwshw%
  511. ;}
  512.  
  513.  
  514. ;hotkey, % ggg, ggggg, On
  515.  
  516.  
  517.  
  518. ;hotkey, % sss, sssss, Off
  519. ;curkey:=replhot(sss)
  520. ;if suprsupr=1
  521. ;{
  522. ;Sleep %shwshw%
  523. ;SendInput %curkey%
  524. ;}
  525. ;hotkey, % sss, sssss, On
  526.  
  527.  
  528.  
  529.  
  530.  
  531. ;return
Add Comment
Please, Sign In to add comment