Macros Ultima IV

From Ultima Codex
Jump to navigation Jump to search

Mixing reagents for spells and other tasks can require quite a few key-presses in Ultima IV. Using an external program can save a lot of repetitive actions and the need to look up the required reagents.

  1. Go to AutoHotKey and download the installer. Installation is simple and the program uses few system resources.
  2. Write macro scripts (file type .ahk), which may contain any number of commands. You activate scripts by double-clicking .ahk files and deactivate them by right-clicking the AutoHotKey icon on the task bar. Both of these can be done at any time – even right in the middle of a game. AutoHotKey also allows for automated activation of scripts.

Single Mixture[edit]

The below script will mix the appropriate spell (if you have the required reagents) by hitting Ctrl-Alt-<First letter of spell>. For example, Ctrl-Alt-A for Awaken or Ctrl-Alt-T for Tremor. Ctrl-Space will hit space seven times which can ease handling the eight person party.

^!a::
Send m
Sleep 200
Send abc{Enter}{Esc}
return

^!b::
Send m
Sleep 200
Send bed{Enter}{Esc}
return

^!c::
Send m
Sleep 200
Send cbc{Enter}{Esc}
return

^!d::
Send m
Sleep 200
Send dfac{Enter}{Esc}
return

^!e::
Send m
Sleep 200
Send efda{Enter}{Esc}
return

^!f::
Send m
Sleep 200
Send ffa{Enter}{Esc}
return

^!g::
Send m
Sleep 200
Send gfha{Enter}{Esc}
return

^!h::
Send m
Sleep 200
Send hbd{Enter}{Esc}
return 

^!i::
Send m
Sleep 200
Send ifh{Enter}{Esc}
return 

^!j::
Send m
Sleep 200
Send jfhg{Enter}{Esc}
return 

^!k::
Send m
Sleep 200
Send kfg{Enter}{Esc}
return

^!l::
Send m
Sleep 200
Send la{Enter}{Esc}
return

^!m::
Send m
Sleep 200
Send mfa{Enter}{Esc}
return 

^!n::
Send m
Sleep 200
Send ncha{Enter}{Esc}
return

^!o::
Send m
Sleep 200
Send oea{Enter}{Esc}
return

^!p::
Send m
Sleep 200
Send pcba{Enter}{Esc}
return 

^!q::
Send m
Sleep 200
Send qeba{Enter}{Esc}
return

^!r::
Send m
Sleep 200
Send recbhda{Enter}{Esc}
return 

^!s::
Send m
Sleep 200
Send sbd{Enter}{Esc}
return 

^!t::
Send m
Sleep 200
Send teha{Enter}{Esc}
return

^!u::
Send m
Sleep 200
Send uca{Enter}{Esc}
return 

^!v::
Send m
Sleep 200
Send vgh{Enter}{Esc}
return

^!w::
Send m
Sleep 200
Send wea{Enter}{Esc}
return

^!x::
Send m
Sleep 200
Send xeda{Enter}{Esc}
return

^!y::
Send m
Sleep 200
Send yed{Enter}{Esc}
return

^!z::
Send m
Sleep 200
Send zed{Enter}{Esc}
return

^Space::
Send {Space}{Space}{Space}{Space}{Space}{Space}{Space}
return

Quantity Selection[edit]

The below script will mix the appropriate spell (if you have the required reagents) by hitting Ctrl-Alt-<First letter of spell>. For example, Ctrl-Alt-A for Awaken or Ctrl-Alt-T for Tremor. It will ask how many you wish to mix and then repeat the mixing that many times.

Ctrl-Space will hit space seven times which can ease handling the eight person party.


^!a::Mix("abc", MyGuiFunction())
return

^!b::Mix("bed", MyGuiFunction())
return

^!c::Mix("cbc", MyGuiFunction())
return

^!d::Mix("dfac", MyGuiFunction())
return

^!e::Mix("efda", MyGuiFunction())
return

^!f::Mix("ffa", MyGuiFunction())
return

^!g::Mix("gfha", MyGuiFunction())
return

^!h::Mix("hbd", MyGuiFunction())
return

^!i::Mix("ifh", MyGuiFunction())
return

^!j::Mix("jfhg", MyGuiFunction())
return

^!k::Mix("kfg", MyGuiFunction())
return

^!l::Mix("la", MyGuiFunction())
return

^!m::Mix("mfa", MyGuiFunction())
return

^!n::Mix("ncha", MyGuiFunction())
return

^!o::Mix("oea", MyGuiFunction())
return

^!p::Mix("pcba", MyGuiFunction())
return

^!q::Mix("qeba", MyGuiFunction())
return

^!r::Mix("recbhda", MyGuiFunction())
return

^!s::Mix("sbd", MyGuiFunction())
return

^!t::Mix("teha", MyGuiFunction())
return

^!u::Mix("uca", MyGuiFunction())
return

^!v::Mix("vgh", MyGuiFunction())
return

^!w::Mix("wea", MyGuiFunction())
return

^!x::Mix("xeda", MyGuiFunction())
return

^!y::Mix("yed", MyGuiFunction())
return

^!z::Mix("zed", MyGuiFunction())
return

^Space::
Send {Space}{Space}{Space}{Space}{Space}{Space}{Space}
return

MyGuiFunction()  {
  Global Quantity
  Gui, +LastFound
  GuiHWND := WinExist()           ;--get handle to this gui..

  Gui, Add, Text,, Quantity:
  Gui, Add, Edit, vQuantity ;
  Gui, Add , Button, Default, OK
  Gui, Show

  WinWaitClose, ahk_id %GuiHWND%  ;--waiting for gui to close
  return ReturnCode               ;--returning value
;-------
ButtonOK:
  GuiControlGet, ReturnCode, , Quantity
  Gui, Destroy
return
;-------
GuiEscape:
GuiClose:
  ReturnCode = -1
  Gui, Destroy
return
}

Mix(keys, Quantity)
{
  Sleep 200
  SendInput m
  Sleep 200
  Loop, %Quantity%
  {
    SendInput %keys%{Enter}
    Sleep 200
  }
  Send {Esc}
return
}