第一段:缩写Alt+Ctrl+F为ACF,但是进战斗和离开战斗一瞬间会卡一下,什么问题?
local function updatehotkey(self, actionButtonType)
local hotkey = _G[self:GetName() .. "HotKey"];
local replace = string.gsub;
if ( not actionButtonType ) then
actionButtonType = "ACTIONBUTTON";
end
local action = actionButtonType..self:GetID();
local text = GetBindingText(GetBindingKey(action), "KEY_");
if text then
text = replace(text, "CTRL", "C");
text = replace(text, "ALT", "A");
text = replace(text, "SHIFT", "S");
text = replace(text, "Spacebar", "Sp");
text = replace(text, "Insert", "In");
text = replace(text, "Delete", "De");
text = replace(text, "Num Pad", "NP");
text = replace(text, "Num Lock", "NL");
text = replace(text, "Backspace", "Ba");
text = replace(text, " Arrow", "");
text = replace(text, "-", "");
text = replace(text, "Wheel ", "W-");
text = replace(text, "Page ", "P-");
end
if hotkey:GetText() == _G["RANGE_INDICATOR"] then
hotkey:SetText("")
else
hotkey:SetText(text)
end
end
hooksecurefunc("ActionButton_OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
ActionButton_UpdateHotkeys(self, self.buttonType)
hooksecurefunc("ActionButton_UpdateHotkeys", updatehotkey)
end
end)
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
---------------------------------------------------------------------------------------------
第二段:只能缩写Alt+W为AW,缩写Alt+Ctrl+F为ACF无效,但是不卡顿。。。
local function updatehotkey(self, actionButtonType)
local hotkey = _G[self:GetName() .. "HotKey"]
local replace = string.gsub
local text = hotkey:GetText()
if text then
text = replace(text, "(s%-)", "S")
text = replace(text, "(a%-)", "A")
text = replace(text, "(c%-)", "C")
text = replace(text, "(Mouse Button )", "M")
text = replace(text, "(鼠标中键)", "M3")
text = replace(text, "(鼠标滚轮向上滚动)", "MU")
text = replace(text, "(鼠标滚轮向下滚动)", "MD")
text = replace(text, "(鼠标按键4)", "M4")
text = replace(text, "(鼠标按键5)", "M5")
text = replace(text, "(数字键盘)", "N")
text = replace(text, "Capslock", "CK")
text = replace(text, "(Page Up)", "PU")
text = replace(text, "(Page Down)", "PD")
text = replace(text, "(空格键)", "SpB")
text = replace(text, "(Insert)", "Ins")
text = replace(text, "(Home)", "Hm")
text = replace(text, "(Delete)", "Del")
end
if hotkey:GetText() == _G["RANGE_INDICATOR"] then
hotkey:SetText("")
else
hotkey:SetText(text)
end
end
hooksecurefunc("ActionButton_OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
ActionButton_UpdateHotkeys(self, self.buttonType)
hooksecurefunc("ActionButton_UpdateHotkeys", updatehotkey)
end
end)
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
动作条快捷键缩写代码问题求助
版主: 花希来了
版面规则
本版只能发攻略相关的帖子,无关帖子一律删除
本版只能发攻略相关的帖子,无关帖子一律删除
Re: 动作条快捷键缩写代码问题求助
ngacn找了个帖子,自助修改,暂时测试没有卡顿。。
https://bbs.nga.cn/read.php?tid=1525241 ... sc&rand=95
附件已上传,需要的自行下载,代码如下:
--动作条快捷键缩写
function ActionButton_UpdateHotkeys(self, actionButtonType)
local id;
if ( not actionButtonType ) then
actionButtonType = "ACTIONBUTTON";
id = self:GetID();
else
if ( actionButtonType == "MULTICASTACTIONBUTTON" ) then
id = self.buttonIndex;
else
id = self:GetID();
end
end
local hotkey = _G[self:GetName().."HotKey"];
local key = GetBindingKey(actionButtonType..id) or
GetBindingKey("CLICK "..self:GetName()..":LeftButton");
local text = GetBindingText(key, "KEY_", false);
if text == nil then
return
end
text = string.gsub(text, "鼠标按键", "M");
text = string.gsub(text, "鼠标中键", "M3");
text = string.gsub(text, "数字键盘", "Nu");
text = string.gsub(text, "Page Up", "PU");
text = string.gsub(text, "Page Down", "PD");
text = string.gsub(text, "Home", "Hm");
text = string.gsub(text, "方向键左", "LT");
text = string.gsub(text, "方向键右)", "RT");
text = string.gsub(text, "方向键上)", "UP");
text = string.gsub(text, "方向键下", "DN");
text = string.gsub(text, "CTRL", "C");
text = string.gsub(text, "ALT", "A");
text = string.gsub(text, "SHIFT", "S");
text = string.gsub(text, "空格键", "SpB");
text = string.gsub(text, "Insert", "Ins");
text = string.gsub(text, "Delete", "Del");
text = string.gsub(text, "Num Pad", "NP");
text = string.gsub(text, "退格", "Ba");
text = string.gsub(text, " Arrow", "");
text = string.gsub(text, "-", "");
text = string.gsub(text, "鼠标滚轮向下滚动", "WD");
text = string.gsub(text, "鼠标滚轮向上滚动", "WU");
if ( text == "" ) then
hotkey:SetText(RANGE_INDICATOR);
hotkey:Hide();
else
hotkey:SetText(text);
hotkey:Show();
end
end
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
https://bbs.nga.cn/read.php?tid=1525241 ... sc&rand=95
附件已上传,需要的自行下载,代码如下:
--动作条快捷键缩写
function ActionButton_UpdateHotkeys(self, actionButtonType)
local id;
if ( not actionButtonType ) then
actionButtonType = "ACTIONBUTTON";
id = self:GetID();
else
if ( actionButtonType == "MULTICASTACTIONBUTTON" ) then
id = self.buttonIndex;
else
id = self:GetID();
end
end
local hotkey = _G[self:GetName().."HotKey"];
local key = GetBindingKey(actionButtonType..id) or
GetBindingKey("CLICK "..self:GetName()..":LeftButton");
local text = GetBindingText(key, "KEY_", false);
if text == nil then
return
end
text = string.gsub(text, "鼠标按键", "M");
text = string.gsub(text, "鼠标中键", "M3");
text = string.gsub(text, "数字键盘", "Nu");
text = string.gsub(text, "Page Up", "PU");
text = string.gsub(text, "Page Down", "PD");
text = string.gsub(text, "Home", "Hm");
text = string.gsub(text, "方向键左", "LT");
text = string.gsub(text, "方向键右)", "RT");
text = string.gsub(text, "方向键上)", "UP");
text = string.gsub(text, "方向键下", "DN");
text = string.gsub(text, "CTRL", "C");
text = string.gsub(text, "ALT", "A");
text = string.gsub(text, "SHIFT", "S");
text = string.gsub(text, "空格键", "SpB");
text = string.gsub(text, "Insert", "Ins");
text = string.gsub(text, "Delete", "Del");
text = string.gsub(text, "Num Pad", "NP");
text = string.gsub(text, "退格", "Ba");
text = string.gsub(text, " Arrow", "");
text = string.gsub(text, "-", "");
text = string.gsub(text, "鼠标滚轮向下滚动", "WD");
text = string.gsub(text, "鼠标滚轮向上滚动", "WU");
if ( text == "" ) then
hotkey:SetText(RANGE_INDICATOR);
hotkey:Hide();
else
hotkey:SetText(text);
hotkey:Show();
end
end
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
- 附件
-
- rHotKey.zip
- (1.34 KiB) 已下载 13591 次
Re: 动作条快捷键缩写代码问题求助
修改了一点键盘映射缩写主代码如下:
--------------------------------------------------------------------------------------------------------
--动作条快捷键缩写
function ActionButton_UpdateHotkeys(self, actionButtonType)
local id;
if ( not actionButtonType ) then
actionButtonType = "ACTIONBUTTON";
id = self:GetID();
else
if ( actionButtonType == "MULTICASTACTIONBUTTON" ) then
id = self.buttonIndex;
else
id = self:GetID();
end
end
local hotkey = _G[self:GetName().."HotKey"];
local key = GetBindingKey(actionButtonType..id) or
GetBindingKey("CLICK "..self:GetName()..":LeftButton");
local text = GetBindingText(key, "KEY_", false);
if text == nil then
return
end
text = string.gsub(text, "SHIFT%-", "S");
text = string.gsub(text, "ALT%-", "A");
text = string.gsub(text, "CTRL%-", "C");
text = string.gsub(text, "鼠标按键", "M");
text = string.gsub(text, "鼠标中键", "M3");
text = string.gsub(text, "数字键盘", "NP");
text = string.gsub(text, "Page Up", "PgU");
text = string.gsub(text, "Page Down", "PgD");
text = string.gsub(text, "Home", "Hm");
text = string.gsub(text, "方向键左", "LT");
text = string.gsub(text, "方向键右", "RT");
text = string.gsub(text, "方向键上", "UP");
text = string.gsub(text, "方向键下", "DN");
text = string.gsub(text, "空格键", "SpB");
text = string.gsub(text, "Insert", "Ins");
text = string.gsub(text, "Delete", "Del");
text = string.gsub(text, "Num Lock", "NL");
text = string.gsub(text, "Num Pad", "NP");
text = string.gsub(text, "退格", "Bak");
text = string.gsub(text, "鼠标滚轮向下滚动", "MWD");
text = string.gsub(text, "鼠标滚轮向上滚动", "MWU");
text = string.gsub(text, " Arrow", "");
text = string.gsub(text, "Mouse Wheel Down", "MWD");
text = string.gsub(text, "Mouse Wheel Up", "MWU");
text = string.gsub(text, "Backspace", "Bak");
text = string.gsub(text, "Spacebar", "SpB");
text = string.gsub(text, "Capslock", "CpL");
if ( text == "" ) then
hotkey:SetText(RANGE_INDICATOR);
hotkey:Hide();
else
hotkey:SetText(text);
hotkey:Show();
end
end
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
--------------------------------------------------------------------------------------------------------
--动作条快捷键缩写
function ActionButton_UpdateHotkeys(self, actionButtonType)
local id;
if ( not actionButtonType ) then
actionButtonType = "ACTIONBUTTON";
id = self:GetID();
else
if ( actionButtonType == "MULTICASTACTIONBUTTON" ) then
id = self.buttonIndex;
else
id = self:GetID();
end
end
local hotkey = _G[self:GetName().."HotKey"];
local key = GetBindingKey(actionButtonType..id) or
GetBindingKey("CLICK "..self:GetName()..":LeftButton");
local text = GetBindingText(key, "KEY_", false);
if text == nil then
return
end
text = string.gsub(text, "SHIFT%-", "S");
text = string.gsub(text, "ALT%-", "A");
text = string.gsub(text, "CTRL%-", "C");
text = string.gsub(text, "鼠标按键", "M");
text = string.gsub(text, "鼠标中键", "M3");
text = string.gsub(text, "数字键盘", "NP");
text = string.gsub(text, "Page Up", "PgU");
text = string.gsub(text, "Page Down", "PgD");
text = string.gsub(text, "Home", "Hm");
text = string.gsub(text, "方向键左", "LT");
text = string.gsub(text, "方向键右", "RT");
text = string.gsub(text, "方向键上", "UP");
text = string.gsub(text, "方向键下", "DN");
text = string.gsub(text, "空格键", "SpB");
text = string.gsub(text, "Insert", "Ins");
text = string.gsub(text, "Delete", "Del");
text = string.gsub(text, "Num Lock", "NL");
text = string.gsub(text, "Num Pad", "NP");
text = string.gsub(text, "退格", "Bak");
text = string.gsub(text, "鼠标滚轮向下滚动", "MWD");
text = string.gsub(text, "鼠标滚轮向上滚动", "MWU");
text = string.gsub(text, " Arrow", "");
text = string.gsub(text, "Mouse Wheel Down", "MWD");
text = string.gsub(text, "Mouse Wheel Up", "MWU");
text = string.gsub(text, "Backspace", "Bak");
text = string.gsub(text, "Spacebar", "SpB");
text = string.gsub(text, "Capslock", "CpL");
if ( text == "" ) then
hotkey:SetText(RANGE_INDICATOR);
hotkey:Hide();
else
hotkey:SetText(text);
hotkey:Show();
end
end
-- 快捷键优化
local function OnPlayerLogin(self, event, ...)
_G.NumberFont_OutlineThick_Mono_Small:SetFont(STANDARD_TEXT_FONT, 10,
"OUTLINE") ----快捷键
end
local Event = CreateFrame("Frame", nil, UIParent)
Event:RegisterEvent("PLAYER_LOGIN")
Event:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then OnPlayerLogin(self, event, ...) end
end)
- 附件
-
- rHotKey.7z
- (1.13 KiB) 已下载 13711 次
- hendrix1981
- 帖子: 81
- 注册时间: 2023-03-11 12:18:56
Re: 动作条快捷键缩写代码问题求助
写宏的时候,mod:后面好像只能接 ctrl alt shift,
楼主这个贴子是不是通过代码可以在mod后面加鼠标3,鼠标4,鼠标5了?
楼主这个贴子是不是通过代码可以在mod后面加鼠标3,鼠标4,鼠标5了?