Skip to content

Commit

Permalink
修复通用ghub高cpu占用
Browse files Browse the repository at this point in the history
  • Loading branch information
ahao-laptop committed Feb 15, 2023
1 parent d128682 commit ca0c894
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions resource/APEX/ghub2scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
false
],
"script": [
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep3(1)\n end\nend",
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep(1)\n end\nend",
"",
"",
false
Expand All @@ -41,4 +41,4 @@
"",
false
]
}
}
4 changes: 2 additions & 2 deletions resource/General/ghub2scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
false
],
"script": [
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep3(1)\n end\nend",
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep(1)\n end\nend",
"",
"",
false
Expand All @@ -41,4 +41,4 @@
"",
false
]
}
}
4 changes: 2 additions & 2 deletions resource/PUBG/ghub2scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
false
],
"script": [
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep3(1)\n end\nend",
"EnablePrimaryMouseButtonEvents(true)\n\nconfig = {{}}\nvars = {{}}\n\ndofile(\"{}\")\nbindkeys(config, vars)\n\nfunction Sleep3(time)\n local a = GetRunningTime()\n while GetRunningTime() - a < time do\n end\nend\n\nClearLog()\nOutputLogMessage(\"Running\"..\"\\n\")\nfunction OnEvent(event, arg)\n -- \u83b7\u53d6\u9f20\u6807\u72b6\u6001\n mousebtns = {{}}\n for i = 1, 5, 1 do\n mousebtns[i] = {{}}\n mousebtns[i][1] = false\n for _, key in pairs(config[\"keys\"]) do\n buttonconfig = config[key]\n if i == buttonconfig[\"button\"] then\n mousebtns[i][2] = buttonconfig\n end\n end\n end\n\n while (true) do\n\n -- \u53ea\u652f\u6301G1-G5 \u548c\u5f53\u524d\u63d2\u5165\u7684\u7f57\u6280\u9f20\u6807\u597d\u50cf\u6ca1\u6709\u5173\u7cfb\n for i = 1, 5, 1 do\n iPressed = IsMouseButtonPressed(i)\n pressed = nil\n if mousebtns[i][1] ~= iPressed then\n -- \u6309\u952e\u72b6\u6001\u6539\u53d8\n if mousebtns[i][1] then\n -- true -> false \u8bf4\u660e\u6309\u952e\u91ca\u653e\n pressed = false\n else\n -- false -> true \u8bf4\u660e\u6309\u952e\u6309\u4e0b\n pressed = true\n end\n\n mousebtns[i][1] = iPressed \n if pressed == false then\n if mousebtns[i][2] ~= nil then\n local func = _G[mousebtns[i][2][\"funcRelease\"]]\n if func then\n func(vars)\n end\n end\n elseif pressed == true then\n if mousebtns[i][2] ~= nil then\n match = true\n for _, modifier in pairs(mousebtns[i][2][\"modifier\"]) do\n if not IsModifierPressed(modifier) then\n match = false\n end\n end\n if match then\n local func = _G[mousebtns[i][2][\"funcPress\"]]\n if func then\n func(vars)\n end\n end\n end\n end\n else\n -- \u6309\u952e\u72b6\u6001\u672a\u6539\u53d8\n if ads(vars) then\n dorecoil(vars)\n end\n end\n\n end\n\n -- \u4fee\u6539\u811a\u672c\u524d\u505c\u6b62\u5faa\u73af \u5426\u5219ghub\u5d29\u6e83\n if mousebtns[1][1] and mousebtns[2][1] then\n OutputLogMessage(\"Exited\\n\")\n return\n end\n\n Sleep(1)\n end\nend",
"",
"",
false
Expand All @@ -71,4 +71,4 @@
"180\u5ea6\u8f6c\u8eab",
true
]
}
}

0 comments on commit ca0c894

Please sign in to comment.