View previous topic :: View next topic |
Author |
Message |
kucingkembar Advanced Cheater Reputation: 0
Joined: 08 Oct 2020 Posts: 68
|
Posted: Mon Jul 19, 2021 7:45 am Post subject: how tof fix previous "Execute Script" |
|
|
sorry for my bad English,
I have this case:
[code]
if TheForm then
TheForm.destroy()
end
TheForm = createForm()
Value = 0
createHotkey(
function()
Value = Value + 1
TheForm.Caption = Value
end,
VK_NUMPAD1
)
[/code]
when the first "Execute Script", then I press numlock1 as a hotkey, the code work as I intended,
but when I press "Execute Script" again, the code from the previous "Execute Script" is also "run" too, and the result is the function run twice when I press the numlock1,
if you "Execute Script" 10 times, the result is the value will increase 10 times too, how must i do to fix this
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Mon Jul 19, 2021 8:17 am Post subject: |
|
|
while you destroy the form on execute again, you're not destroying the hotkey
try
Code: |
if TheForm then
TheForm.destroy()
end
if TheHotkey then
TheHotkey.destroy()
end
TheForm = createForm()
Value = 0
TheHotkey=createHotkey(
function()
Value = Value + 1
TheForm.Caption = Value
end,
VK_NUMPAD1
)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
kucingkembar Advanced Cheater Reputation: 0
Joined: 08 Oct 2020 Posts: 68
|
Posted: Mon Jul 19, 2021 8:27 am Post subject: |
|
|
Thank you A lot Dark Byte,
the code you provide works,
|
|
Back to top |
|
|
|