Hello, I am curious if there is a way to allow the player to set a variable in-game. For example, if the player types /hotkey ALT-T. I would then like the variable hotkey to equal ALT-T. Thank you!
I think /script hotkey=ALT-Q may work, but I am looking for something a bit more user friendly.
Not exactly sure what you are asking so,
The function for a slash command can take a string parameter, something like
local HotKey
SLASH_INTHENSTUSHK1 = "/hotkey"
SlashCmdList["INTHENSTUSHK"] = function(msg)
if msg ~= "" then
HotKey = string.upper(msg)
end
end
Otherwise a bit more explanation might be required.
I don’t see how a script is less user friendly than making a slash command that does the same thing
/run hotkey = "ALT-Q"
It would help to explain what you are trying to do
Otherwise you can use the WowLua addon for easy development
https://www.curseforge.com/wow/addons/wowlua
1 Like
I have a secure button that runs a macro to target a unit and then places a raid icon on it when the player hits ALT-T on the keyboard. I would like to create a slash command that allows the user to change the hotkey (which is a saved variable).
I don’t know if it is possible, but if this could be an automated task we could get rid of the hotkey all together (for example how Deadly Boss Mods will place a raid icon over a players head when they’re affected by an ability). I did try looking through their code but couldn’t find where/how they were doing that.
Thank you!
Protected actions can’t be automated and require a hardware event (key press/mouse click…). Placing a raid icon is not protected… yet.
You can replace a binding on a button in a slash command (replace the HotKey = code with the binding code in the slash command above) but the problem then comes down to detecting if the user has entered a valid key with which to replace the binding.
For this something like using static bindings might be the better option.
https://wow.gamepedia.com/Creating_key_bindings