Beatle Опубликовано 13 декабря, 2011 Поделиться Опубликовано 13 декабря, 2011 Писал скрипт поиска и замены значений по хоткею, поглядывая на скрипт управлением спидхаком. Чувствую что решение близко, но уже мозг не варит. Скажите плз, где косяк и может можно его еще оптимизировать?EnableHotkey =1function rwr()hideAllCEWindows()showMessage("START?") results=AOBScan("67 2B 00 00", "+W-C-X") if (results~=nil) then count=stringlist_getCount(results) if (count>1) thenfunction No(hotkey) for i = 0, (count-1), 1 do address=stringlist_getString(results,i) if (EnableHotkey==1) then value = 22222 writeInteger(address,value) end endfunction Norma(hotkey)for i = 0, (count-1), 1 do address=stringlist_getString(results,i)if (EnableHotkey==1) then value = 11111 writeInteger(address,value) end end end end object_destroy(results) results=nil end showMessage("OK")endfunction myattach(timer) if getProcessIDFromProcessName("game.exe") ~= nil then object_destroy(timer) openProcess("game.exe") rwr() elseshowMessage("Client not found")closeCE() endf=createForm(false) --create an invisible windowt=createTimer(F);timer_setInterval(t,100) --10 might have been too fast for xp...timer_onTimer(t,myattach)endendfunction SetHotKey(func, hotkey) local objectHotKey = createHotkey(func, hotkey) generichotkey_setKeys(objectHotKey, hotkey) generichotkey_onHotkey(objectHotKey, func)endfunction onOpenProcess(processid) SetHotKey(No, VK_R) SetHotKey(Norma, VK_V)end Ссылка на комментарий Поделиться на другие сайты Поделиться
MasterGH Опубликовано 14 декабря, 2011 Поделиться Опубликовано 14 декабря, 2011 Сплошной косяк.Особенно, когда после условия идёт функция: if (count>1) thenfunction No(hotkey)....Лучше убрать функцию myattach(timer) и работу таймера.Начни с простого - подготовь форму и реакции на хот-кеиfunction No()--...endfunction Norma()--...endfunction SetHotKey(func, hotkey) local objectHotKey = createHotkey(func, hotkey) generichotkey_setKeys(objectHotKey, hotkey) generichotkey_onHotkey(objectHotKey, func)endfunction onOpenProcess(processid) SetHotKey(No, VK_R) SetHotKey(Norma, VK_V) control_setCaption(formTrainer, "Trainer Run ....") setProperty(infoLabel, "Enabled", "true")endfunction OnCloseTrainerForm(sender) closeCE() return caFreeendformTrainer = createForm(true)form_centerScreen(formTrainer)control_setCaption(formTrainer, "Process game is not exist")form_onClose(formTrainer, OnCloseTrainerForm)infoLabel = createLabel(formTrainer)control_setCaption(infoLabel, "Key R - ....\n\rKey V - ....")control_setPosition(infoLabel, 20, 10)setProperty(infoLabel, "Enabled", "false")listProcess = getAutoAttachList()strings_add(listProcess, "test.exe") Ссылка на комментарий Поделиться на другие сайты Поделиться
Рекомендуемые сообщения