Author Topic: MMO macro  (Read 3903 times)

0 Members and 1 Guest are viewing this topic.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
MMO macro
« on: December 25, 2019, 01:04:12 am »
Looking to make a macro program to automate some key presses. Anyone ever make something where it outputs key presses as if it was actually being done?

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: MMO macro
« Reply #1 on: December 25, 2019, 02:50:25 am »
Assuming you're in windows, something like https://www.autohotkey.com/ may be an easier solution for you

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: MMO macro
« Reply #2 on: December 25, 2019, 11:47:05 am »
That looks perfect actually, thanks.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: MMO macro
« Reply #3 on: December 25, 2019, 12:05:48 pm »
Checked it out, if QB64 can output keystrokes i can do it in QB64 much easier based on timing and keeping track of what is next and not.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: MMO macro
« Reply #4 on: December 25, 2019, 12:41:33 pm »
Is _SCREENPRINT what you  want? http://www.qb64.org/wiki/SCREENPRINT
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: MMO macro
« Reply #5 on: December 25, 2019, 12:56:38 pm »
damn that works perfectly, thank you! I will post the source when completed.

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: MMO macro
« Reply #6 on: December 25, 2019, 06:02:32 pm »
I take it there is no way to send key combos like "Shift + 1" using _SCREENPRINT?

Offline Craz1000

  • Forum Regular
  • Posts: 111
  • I'm OK
    • View Profile
    • Craz1000.net
Re: MMO macro
« Reply #7 on: December 25, 2019, 07:43:10 pm »
Got it to work. Luckily EQ2 has a hotbar spinner you can use to swap hotbars, just binded it to "," and "."

Code: QB64: [Select]
  1. _TITLE "EQ2 Macro"
  2.  
  3. TYPE Ability
  4.     CastTime AS INTEGER
  5.     Cooldown AS INTEGER
  6.     CoolDownClock AS INTEGER
  7.     SpellName AS STRING * 20
  8.  
  9. _MOUSESHOW "CROSSHAIR"
  10. Hotkeys = 12
  11. DIM SHARED MaxActive AS INTEGER
  12. DIM SHARED HotKey(Hotkeys * 2) AS Ability
  13. DIM SHARED ActiveClock AS INTEGER
  14. MacroActive = 0
  15. BossActive = 0
  16. Active = 0
  17.  
  18. LoadHotkeyTimers
  19. LINE (100, 300)-(150, 350), 2, BF
  20. LINE (300, 300)-(350, 350), 4, BF
  21. LINE (500, 300)-(550, 350), 1, BF
  22. LINE (100, 400)-(550, 450), 14, BF
  23.  
  24.  
  25.     LOCATE 1, 1
  26.     _LIMIT 10
  27.     IF MacroActive = 1 THEN
  28.         IF Active = 0 THEN
  29.             IF BossActive = 1 THEN BossSpells (Hotkeys)
  30.             CALL CastSpells(Hotkeys)
  31.         ELSE
  32.             ActiveClock = ActiveClock - 1
  33.             IF ActiveClock = 0 THEN Active = 0
  34.         END IF
  35.     END IF
  36.  
  37.         IF _MOUSEBUTTON(1) THEN
  38.             IF POINT(MX - 1, MY - 1) = 2 AND MacroActive = 0 THEN
  39.                 CALL Delay("Battle active in:", 30)
  40.                 MacroActive = 1
  41.                 ClearClock = 0
  42.             ELSEIF POINT(MX - 1, MY - 1) = 1 AND MacroActive = 0 THEN
  43.                 CALL Delay("Boss active in:", 30)
  44.                 MacroActive = 1
  45.                 BossActive = 1
  46.                 ClearClock = 0
  47.             ELSEIF POINT(MX - 1, MY - 1) = 4 AND MacroActive = 1 THEN
  48.                 MacroActive = 0
  49.                 BossActive = 0
  50.                 PRINT "Stopped                                   "
  51.             ELSEIF POINT(MX - 1, MY - 1) = 14 AND MacroActive = 0 AND ClearClock = 0 THEN
  52.                 ClearTimers (Hotkeys)
  53.                 Active = 0
  54.                 ActiveClock = 0
  55.                 ClearClock = 1
  56.                 PRINT "Cleared cooldown timers                   "
  57.             END IF
  58.         END IF
  59.         MX = _MOUSEX
  60.         MY = _MOUSEY
  61.     LOOP
  62.  
  63.     UpdateClocks (Hotkeys)
  64.  
  65.  
  66.  
  67. SUB ClearTimers (HotKeys)
  68.     FOR x = 1 TO HotKeys * 2
  69.         HotKey(x).CoolDownClock = 0
  70.     NEXT x
  71.  
  72. SUB Delay (Msg$, TimeDelay)
  73.     DO
  74.         _LIMIT 10
  75.         LOCATE 1, 1
  76.         PRINT Msg$; TimeDelay / 10
  77.         TimeDelay = TimeDelay - 1
  78.  
  79.     LOOP UNTIL TimeDelay = 0
  80.  
  81.  
  82.  
  83. SUB UpdateClocks (Hotkeys)
  84.     LOCATE 5, 1
  85.     PRINT "Norm:";
  86.     FOR x = 1 TO Hotkeys * 2
  87.         IF HotKey(x).CoolDownClock > 0 THEN HotKey(x).CoolDownClock = HotKey(x).CoolDownClock - 1
  88.  
  89.         IF x = 12 THEN
  90.             PRINT HotKey(x).CoolDownClock; "                                      "
  91.             LOCATE 6, 1
  92.             PRINT "Boss:";
  93.         ELSEIF x = 24 THEN
  94.             PRINT HotKey(x).CoolDownClock; "                                      "
  95.         ELSE
  96.             PRINT HotKey(x).CoolDownClock;
  97.         END IF
  98.     NEXT x
  99.  
  100. ' runs through hotbar and casts first ability off cooldown
  101. SUB CastSpells (Hotkeys)
  102.     FOR x = 1 TO Hotkeys
  103.         IF Active = 0 AND HotKey(x).CoolDownClock = 0 AND HotKey(x).CastTime <> 0 THEN
  104.             Active = 1
  105.             PRINT "Casting "; HotKey(x).SpellName; "                           "
  106.  
  107.             HotKey(x).CoolDownClock = HotKey(x).CastTime + HotKey(x).Cooldown
  108.             ActiveClock = HotKey(x).CastTime
  109.             _SCREENPRINT ","
  110.  
  111.             IF x < 10 THEN
  112.                 _SCREENPRINT RTRIM$(LTRIM$(STR$(x)))
  113.             ELSEIF x = 10 THEN
  114.                 _SCREENPRINT "0"
  115.             ELSEIF x = 11 THEN
  116.                 _SCREENPRINT "-"
  117.             ELSEIF x = 12 THEN
  118.                 _SCREENPRINT "="
  119.             END IF
  120.             EXIT FOR
  121.         END IF
  122.     NEXT x
  123.  
  124. SUB BossSpells (Hotkeys)
  125.     FOR x = Hotkeys + 1 TO Hotkeys * 2
  126.         IF Active = 0 AND HotKey(x).CoolDownClock = 0 AND HotKey(x).CastTime <> 0 THEN
  127.             Active = 1
  128.             PRINT "Casting "; HotKey(x).SpellName; "      "; x - 12; CHR$(x - 12)
  129.  
  130.             HotKey(x).CoolDownClock = HotKey(x).CastTime + HotKey(x).Cooldown
  131.             ActiveClock = HotKey(x).CastTime
  132.  
  133.             _SCREENPRINT "."
  134.             _SCREENPRINT RTRIM$(LTRIM$(STR$(x - 12)))
  135.             EXIT FOR
  136.         END IF
  137.     NEXT x
  138.  
  139.  
  140. 'This is where you would set cast time and cooldown time
  141. 'if spell is a DOT and the duration of the dot is greater than the cooldown then use duration as cooldown
  142. SUB LoadHotkeyTimers
  143.     MaxActive = 2
  144.  
  145.     HotKey(1).SpellName = "Dooming Darkess IV"
  146.     HotKey(2).SpellName = "Vampire Bats VIII"
  147.     HotKey(3).SpellName = "Bloodcoil XI"
  148.     HotKey(4).SpellName = "Soulroot XII"
  149.     HotKey(5).SpellName = "Pandemic XI"
  150.     HotKey(6).SpellName = "Lifetap IX"
  151.     HotKey(7).SpellName = "Arcane Bewilderment"
  152.     HotKey(8).SpellName = "Animated Dagger"
  153.     HotKey(9).SpellName = "Smite of Consistency"
  154.     HotKey(10).SpellName = "Energy Clash"
  155.     HotKey(11).SpellName = "Edit Me"
  156.     HotKey(12).SpellName = "Edit Me"
  157.  
  158.     HotKey(1).CastTime = 10
  159.     HotKey(2).CastTime = 15
  160.     HotKey(3).CastTime = 10
  161.     HotKey(4).CastTime = 15
  162.     HotKey(5).CastTime = 20
  163.     HotKey(6).CastTime = 15
  164.     HotKey(7).CastTime = 10
  165.     HotKey(8).CastTime = 10
  166.     HotKey(9).CastTime = 10
  167.     HotKey(10).CastTime = 10
  168.     HotKey(11).CastTime = 0
  169.     HotKey(12).CastTime = 0
  170.  
  171.     HotKey(1).Cooldown = 252
  172.     HotKey(2).Cooldown = 252
  173.     HotKey(3).Cooldown = 278
  174.     HotKey(4).Cooldown = 17
  175.     HotKey(5).Cooldown = 76
  176.     HotKey(6).Cooldown = 45
  177.     HotKey(7).Cooldown = 300
  178.     HotKey(8).Cooldown = 150
  179.     HotKey(9).Cooldown = 60
  180.     HotKey(10).Cooldown = 300
  181.     HotKey(11).Cooldown = 1
  182.     HotKey(12).Cooldown = 1
  183.  
  184.     'Priority spells (boss battles)
  185.  
  186.     HotKey(13).SpellName = "UndeadHorde VI"
  187.     HotKey(14).SpellName = "Awaken Grave VIII"
  188.     HotKey(15).SpellName = "Blighted Horde IX"
  189.     HotKey(16).SpellName = "Vampirism"
  190.     HotKey(17).SpellName = "Bloatfly"
  191.     HotKey(18).SpellName = "Desiccation"
  192.     HotKey(19).SpellName = "Exsanguination"
  193.     HotKey(20).SpellName = "Virulent Outbreak"
  194.     HotKey(21).SpellName = "Withering"
  195.     HotKey(22).SpellName = "Toxic Life"
  196.     HotKey(23).SpellName = "Edit Me"
  197.     HotKey(24).SpellName = "Edit Me"
  198.  
  199.     HotKey(13).CastTime = 15
  200.     HotKey(14).CastTime = 15
  201.     HotKey(15).CastTime = 15
  202.     HotKey(16).CastTime = 20
  203.     HotKey(17).CastTime = 30
  204.     HotKey(18).CastTime = 25
  205.     HotKey(19).CastTime = 30
  206.     HotKey(20).CastTime = 40
  207.     HotKey(21).CastTime = 50
  208.     HotKey(22).CastTime = 45
  209.     HotKey(23).CastTime = 0
  210.     HotKey(24).CastTime = 0
  211.  
  212.     HotKey(13).Cooldown = 3010
  213.     HotKey(14).Cooldown = 300
  214.     HotKey(15).Cooldown = 300
  215.     HotKey(16).Cooldown = 910
  216.     HotKey(17).Cooldown = 2210
  217.     HotKey(18).Cooldown = 2560
  218.     HotKey(19).Cooldown = 2060
  219.     HotKey(20).Cooldown = 1510
  220.     HotKey(21).Cooldown = 1660
  221.     HotKey(22).Cooldown = 2260
  222.     HotKey(23).Cooldown = 1
  223.     HotKey(24).Cooldown = 1
  224.  
  225.