combo36hits! 50氏=なるがみ氏
ステータスを画像認識によって取得する関数
取得できるもの
現在HP 最大HP 現在MP 最大MP 現在SP最大SP
現在ウエイト 最大ウエイト 経験値
サンプル
Call getstatus.uws
repeat
print "HP:" + GetStatus(GS_PreHP) + "/" + GetStatus(GS_MaxHP)
print "MP:" + GetStatus(GS_PreMP) + "/" + GetStatus(GS_MaxMP)
print "SP:" + GetStatus(GS_PreSP) + "/" + GetStatus(GS_MaxSP)
print "WT:" + GetStatus(GS_PreWT) + "/" + GetStatus(GS_MaxWT)
print "XP:" + GetStatus(GS_XP)
until (GETKEYSTATE(VK_F10))
GetStatus関数ファイル(スクランブル有)
combo36hits! 49氏+(56補足)+(57修正)
多重起動用セレクタ
dim tw_wnd
dim msg = ""
// GETID("", "D2MainWindow") を tw_wnd_selector() に置き換えると
//多重起動しているときにどちらをターゲットにするかが選べます
tw_wnd_id = GETID("", "D2MainWindow")
ifb tw_wnd_id = -1
MSGBOX("TalesWeaver not found.")
exitexit
endif
msg = "Window ID:" + tw_wnd_id + "が選択されました"
MSGBOX(msg)
//=============================================
function tw_wnd_selector()
const TW_RUN_MAX = 10
dim tw_wnd_id_list[TW_RUN_MAX]
dim tw_wnd_num = 0
dim wnd_id, wnd_num, select_num
dim i
diminput_ret,input_msg="一番左の数字を入力してください<#CR>"
result = -1
wnd_num = GETALLWIN()
for i=0 to wnd_num-1
wnd_id = ALL_WIN_ID[i]
ifb (STATUS(wnd_id, ST_CLASS) = "D2MainWindow")
input_msg = input_msg + tw_wnd_num
input_msg = input_msg + " - Window ID:" + wnd_id
input_msg = input_msg + "(" + STATUS(wnd_id, ST_X)
input_msg = input_msg + "," + STATUS(wnd_id, ST_Y) + ")"
input_msg = input_msg + "<#CR>"
tw_wnd_id_list[tw_wnd_num] = wnd_id
tw_wnd_num = tw_wnd_num + 1
if tw_wnd_num >= TW_RUN_MAX then break
endif
next
//TalesWeaverのウインドウが一つも見つからなかったとき
if tw_wnd_num <= 0 then exit
// TalesWeaver のウインドウが一つだけだったとき
ifb tw_wnd_num = 1
result = tw_wnd_id_list[0]
exit
endif
// TalesWeaver のウインドウが選択されなかったとき
input_ret = INPUT(input_msg)
if input_ret = EMPTY then exit
// 不正な数字が入力されたとき
select_num = val(input_ret)
if (select_num =
ERR_VALUE)or(select_num<0)or(select_num>=tw_wnd_num)thenexit
result = tw_wnd_id_list[select_num]
fend
combo35hits! 747氏
連打ツール
DEF_DLL SendMessageA(hwnd, uint, dword, dword):int:user32.dll
const WM_LBUTTONDOWN = 513
const WM_LBUTTONUP = 514
tw_wnd_id = GETID("Talesweaver", "D2MainWindow")
ifb tw_wnd_id = -1 then
MSGBOX("Talesweaver not found.")
exitexit
endif
MOUSEORG(tw_wnd_id, 2)
tw_wnd = IDTOHND(tw_wnd_id)
base_x = STATUS(tw_wnd_id, ST_CLX)
base_y = STATUS(tw_wnd_id, ST_CLY)
while TRUE
ifb GETKEYSTATE(VK_LBUTTON)
active_wnd_id = GETID(GET_ACTIVE_WIN)
ifb (active_wnd_id = tw_wnd_id)
click_pos = (G_MOUSE_X - base_x) + (G_MOUSE_Y - base_y) * 65536;
SendMessageA(tw_wnd, WM_LBUTTONDOWN, 0, click_pos)
SLEEP(0.1)
SendMessageA(tw_wnd, WM_LBUTTONUP, 0, click_pos)
endif
endif
SLEEP(0.3)
wend
combo35hits! 908氏
DrawTextなどのAPIをトラップして表示
id = GETID("Talesweaver")
While !GetKeyState(VK_ESC)
x = G_MOUSE_X; y = G_MOUSE_Y // マウス位置
ofx = x - STATUS(id, ST_CLX) // 相対位置
ofy = y - STATUS(id, ST_CLY)
if GetKeyState(VK_SHIFT) then print PosACC(id, ofx, ofy,ACC_API)
Sleep(0.01)
Wend
combo35hits! 858-860氏+862氏改
ステータス読み込み
※peekcolorなんでマウス乗っかると誤認識
function checkNum(x,y)
dim nc[11]
num = -1
nc[0] = peekcolor(x+5,y )
nc[1] = peekcolor(x+2,y+2)
nc[2] = peekcolor(x+1,y+8)
nc[3] = peekcolor(x+5,y+8)
nc[4] = peekcolor(x ,y+7)
nc[5] = peekcolor(x+2,y+6)
nc[6] = peekcolor(x+3,y+7)
nc[7] = peekcolor(x+1,y+5)
nc[8] = peekcolor(x+1,y+7)
nc[9] = peekcolor(x ,y+6)
nc[10] = peekcolor(x+1,y+6)
if nc[1]=$FFFFFF then result = 1
if nc[2]=$FFFFFF and nc[3]<>$FFFFFF then result = 2
if nc[5]=$FFFFFF andnc[1]<>$FFFFFFandnc[4]<>$FFFFFFthenresult=3
if nc[3]=$FFFFFF then result = 4
if nc[7]=$FFFFFF then result = 5
if nc[10]=$FFFFFF and nc[9]=$FFFFFF then result = 6
if nc[6]=$FFFFFF then result = 7
if nc[5]=$FFFFFF and nc[4]=$FFFFFF then result = 8
if nc[8]=$FFFFFF and nc[9]=$FFFFFF then result = 9
if nc[9]=$FFFFFF and nc[4]=$FFFFFF and nc[10]<>$FFFFFF then result =0
if nc[0]=$FFFFFF then result = 10
result = -1
fend
function checkPRM2(s)
SELECT s
CASE 0// HP
x = 62;y = 135
CASE 1// MP
x = 62;y = 149
CASE 2// SP
x = 62;y = 164
CASE 3// XP
x = 62;y = 178
DEFAULT// WT
x = 62;y = 199
SELEND
pp = -1
ifb STATUS( ID,ST_ACTIVE ) = true then
pp = 0 ; i = 0
p = checkNum(x,y)
while p<>-1 and i<=10 and p<>10
pp = pp*10+p
i = i + 1
p = checkNum(i*7+x,y)
wend
endif
result = pp
fend
combo35hits! 710氏+(717)補足
マウス右ボタンを押している間 連打
btn関数だけで送るとvk_lbuttonに影響が出るから
mouseorgでアクティブウインドウだけにクリック送信してやればできるはず。
あとはアクティブウインドウがTWのウインドウが判断するぐらいはしてやったほうがいいかも。
クリック位置指定しないと座標0,0をクリックしにいくっぽい?
G_MOUSE_XとかYとかでカーソル位置を指定してやってくださいな。
後、窓モードだとタイトルバーとかフレーム幅もちょこっと影響するから
その辺は自分で微調整してください。
cnt = 0
while ! getkeystate(vk_esc)
sleep(0.01)
//マウス押してるか判断
if ! getkeystate(vk_lbutton) then continue
//アクティブウインドウのID取得(事前にTW窓のID取得して比較するといいかも)
id = getid(get_active_win)
//クリックの送信先を取得したIDのみに限定
mouseorg(id, 2)
//クリックを送信
btn(left, click)
//クリックした回数を表示(きっといらないと思うので消してよし)
cnt = cnt +1
fukidasi(cnt)
//送信先の指定を開放
mouseorg(0)
wend