共同開發腳本
小弟最近在鑽研python的楓之谷純腳本目前可以順利錄製、順跑腳本
但大概每15~20分鐘會被測謊一次
且使用python開發導致腳本有些許誤差
想說在這邊徵由一些能人志士 一起共同開發腳本
import pyautogui
import time
def record_actions():
actions = []
print("開始錄製,按下 Ctrl+C 停止錄製。")
try:
while True:
x, y = pyautogui.position()
action = {'timestamp': time.time(), 'x': x, 'y': y}
actions.append(action)
time.sleep(0.1) # 等待 0.1 秒
except KeyboardInterrupt:
print("錄製結束。")
return actions
def replay_actions(actions):
print("開始重放錄製的動作,按下 Ctrl+C 停止重放。")
try:
for action in actions:
pyautogui.moveTo(action['x'], action['y'])
time.sleep(0.1) # 等待 0.1 秒
except KeyboardInterrupt:
print("重放結束。")
# 錄製動作
actions = record_actions()
# 重放動作
replay_actions(actions)
--------------------------------------------------------------------------------------------------------------------------------擬人化
import pyautogui
import time
import random
def click_with_random_delay(x, y):
pyautogui.moveTo(x, y)
time.sleep(random.uniform(0.5, 1.5)) # 隨機等待0.5到1.5秒
pyautogui.click()
# 進行一系列點擊動作
for i in range(5):
x = random.randint(100, 500) # 隨機生成x座標
y = random.randint(100, 500) # 隨機生成y座標
click_with_random_delay(x, y)
後面交給您囉 本帖最後由 sean985006 於 2023-7-20 18:26 編輯
滑鼠隨機點擊可以減少被測謊的機會?
趕緊來試試看
我目前只加了ˊ按下按鍵跟放開按鍵的隨機誤差而已
話說pyautogui好像會被楓谷擋掉的樣子 johnjohn0321 發表於 2023-7-17 11:25 static/image/common/back.gif
import pyautogui
import time
我使用您提供的,配合使用某按鍵精靈,還是會被測謊,請問能指點一下嗎? 還是說按鍵那邊也要調整呢? (因為我使用直接錄製播放的按鍵精靈,無法調整延遲ms之類的指令) 以下是我更改大大您的程式碼,請指點 謝謝您QQ
import pyautogui
import time
import random
import keyboard
def record_actions():
actions = []
print("準備錄製,按下 Ctrl+V 開始錄製。")
keyboard.wait('ctrl+v') # 等待 Ctrl+V 被按下
print("開始錄製,按下 Ctrl+X 停止錄製。")
try:
while True:
x, y = pyautogui.position()
action = {'timestamp': time.time(), 'x': x, 'y': y}
actions.append(action)
time.sleep(0.1) # 等待 0.1 秒
except KeyboardInterrupt:
print("錄製結束。")
return actions
def click_with_random_delay(x, y):
pyautogui.moveTo(x, y)
time.sleep(random.uniform(0.5, 1.5)) # 隨機等待0.5到1.5秒
pyautogui.click()
def replay_actions(actions):
print("準備重放錄製的動作,按下 Ctrl+V 開始重放。")
keyboard.wait('ctrl+v') # 等待 Ctrl+V 被按下
print("開始重放錄製的動作,按下 Ctrl+X 停止重放。")
try:
while True: # 加入無窮迴圈
for action in actions:
pyautogui.moveTo(action['x'], action['y'])
time.sleep(0.1) # 等待 0.1 秒
# 進行一系列點擊動作
for i in range(5):
x = random.randint(100, 500) # 隨機生成x座標
y = random.randint(100, 500) # 隨機生成y座標
click_with_random_delay(x, y)
except KeyboardInterrupt:
print("重放結束。")
# 設定全局熱鍵 Ctrl+X 來觸發 KeyboardInterrupt 事件
keyboard.add_hotkey('ctrl+x', lambda: keyboard.press_and_release('ctrl+c'))
# 錄製動作
actions = record_actions()
# 重放動作
replay_actions(actions)
找到大神了吗 jack4926 發表於 2023-7-21 07:19 static/image/common/back.gif
我使用您提供的,配合使用某按鍵精靈,還是會被測謊,請問能指點一下嗎? 還是說按鍵那邊也要調整呢? (因 ...
這個要開 後臺按鍵嗎,或者其他的嗎
頁:
[1]