按键精灵的颜色插件(Color)
一、颜色插件相关的命令
1、GetPixelColor得到指定点颜色
GetCursorPos x,y getcolor = Plugin.color.GetPixelColor(x,y,0) TracePrint getcolor
2、ColorToRGB颜色转RGB
Call plugin.Color.ColorToRGB("D8D8D8",R,G,B)
TracePrint "红色:"&R
TracePrint "绿色:"&G
TracePrint "蓝色:"&B
3、CountColor区域搜索颜色数量
num = Plugin.Color.CountColor(0, 0, 024, 768, "FFFFFF", 1) TracePrint "颜色""FFFFFF""数量为:" & num
二、制作比IfColor通用性更好的补血脚本
Hwnd = Plugin.window.MousePoint()
TracePrint Hwnd
While true
srect = Plugin.window.GetClientRect(hwnd)
TracePrint srect
MyArray=split(srect,"|")
x=MyArray(0)
y=MyArray(1)
l=MyArray(2)
h=MyArray(3)
TracePrint x&","&y&","&l&","&h
Hpx = x+238 //血条80%血量位置
Hpy = y+45
getcolor=plugin.color.GetPixelColor(Hpx,Hpy,0) //获取血条80%血量位置颜色
TracePrint getcolor
Call Plugin.Color.ColorToRGB(getcolor, R, G, B)
TracePrint R&"," &G&"," &B
If R > 201 and R < 231 and G > 201 and G < 231 and B > 201 and B < 231 Then
KeyPress "Q",1
End If
Delay 200
Wend
三、用多点找色代替找图命令(FindMutiColor)
XY=Plugin.Color.FindMutiColor(0,0,200,897,"9B6837","1|3|FFFFFF,4|3|684524,10|7|FFFFFF,15|11|FFFFFF,17|5|342312,20|4|49311A,21|10|FFFFFF,24|5|FFFFFF,27|6|FFFFFF,34|6|FFFFFF",1)
dim MyArray
MyArray = Split(XY, "|")
X = CInt(MyArray(0)) : Y = CInt(MyArray(1))
If X >= 0 and Y >= 0 Then
MoveTo X, Y
Delay 200
LeftClick 2
End If
四、颜色增强插件(ColorEx)
Call Plugin.ColorEx.PrintScreen(0,0,1440,900)
XY=Plugin.Color.FindMutiColor(0,0,200,897,"9B6837","1|3|FFFFFF,4|3|684524,10|7|FFFFFF,15|11|FFFFFF,17|5|342312,20|4|49311A,21|10|FFFFFF,24|5|FFFFFF,27|6|FFFFFF,34|6|FFFFFF",1)
dim MyArray
MyArray = Split(XY, "|")
X = CInt(MyArray(0)) : Y = CInt(MyArray(1))
If X >= 0 and Y >= 0 Then
MoveTo X, Y
Delay 200
LeftClick 2
End If
Call plugin.ColorEx.Free ()
- 上一篇: 按键精灵的后台插件(Bkgnd)
- 下一篇: 按键精灵的文件插件(File)