Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #SingleInstance force
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- DetectHiddenWindows, On
- game_title := "Secret World Legends" ; Name of game window key presses to be sent to
- summon_count := 0 ; Track of current number of summons
- ; Note: # has a special meaning in the context of using Send/ControlSend so if you wish to use HTML hex colour codes use {#} to represent a #
- summon_cols := ["{#}00FF00", "{#}FF0000", "{#}0000FF", "{#}00FF00", "{#}FF0000", "{#}0000FF", "{#}00FF00", "{#}FF0000", "{#}0000FF", "{#}FF00FF"]
- ; Ctrl + F1
- ; Reset and reload any script changes
- ^F1::
- Reload
- Sleep 1000
- ; If successful (i.e. no errors in script) the reload will close this instance during the Sleep
- ; This means remaining code shouldn't execute.
- ; However, if we reached here, means something went wrong so let user know.
- MsgBox, 4,, The script could not be reloaded. Would you like to exit?
- IfMsgBox, Yes, ExitApp
- Return
- ; Ctrl + F2 but only if game has focus
- #If WinActive(game_title)
- ^F2::
- script_name := "MBAH"
- call_out(script_name)
- Return
- #If
- ; Ctrl + F3 but only if game has focus
- #If WinActive(game_title)
- ^F3::
- script_name := "MBBP"
- call_out(script_name)
- Return
- #If
- send_message(message) {
- global game_name
- ; Sends the following to the window with a name matching game_name
- ; Enter key to give chat cursor focus, the message to be sent, Enter key to have the message sent.
- ControlSend,, {Enter}%message%{Enter}, %game_name%
- Sleep 200
- }
- call_out(script_name) {
- global summon_count
- global summon_cols
- ; Determine colour based on number of summons tracked and the number of colours to choose from
- ; i.e. make sure 0 < index < number of summon colours
- index := Mod(summon_count, summon_cols.Length()) + 1
- colour := summon_cols[index]
- ; Adjust displayed representation of summon count to be what is expected
- count := summon_count + 1
- ; Form the message that's to be typed in chat
- chat_msg := "/" . script_name . " " . colour . " " . count
- ; Type message in chat
- send_message(chat_msg)
- ; Update summon count
- summon_count += 1
- }
Advertisement
Add Comment
Please, Sign In to add comment