一年级编写计算机代码,这是我自己写的一个小程序!我把代码拆分出来给新手学习下大神勿喷 _ 脚本制作教程 - 按键精灵论坛...

开始

首先拆分Qui界面的代码

Event ForMvs.Load

ForMvs.ComboBox1.ListIndex = 关卡难度选择 : ForMvs.ComboBox2.ListIndex = 挂机层数选择

ForMvs.InputBox2.Text = 60:ForMvs.InputBox1.Text = "欢迎使用三国群雄传辅助工具"

ForMvs.OptionBox1.Value = 0 : ForMvs.OptionBox2.Value = 0

End Event

上面的代码内容,加载窗体ForMvs,加载内容1,下拉框1初始选择 = 关卡难度选择。

2,下拉框,2初始选择 = 挂机层数选择。3.输入框2,文本内容 = 60,4.输入框1.文本内容 = "欢迎使用三国群雄传辅助工具" 。5和6是单选框的值初始化

------------------------------------------------我是分割线------------------------------------------------------------

Function ShwoMsgboxr(输出)

ForMvs.InputBox1.Text = 输出 & Vbcrlf & ForMvs.InputBox1.Text

End Function

上面的代码内容,建立一个函数,函数内容 = 窗体,输入框1,文本内容 = 返还值 &换行符&出窗体,输入框1,文本内容

这个函数的作用是在事先准备好的窗体控件,输入框1中显示需要显示文字可&值或者变量

------------------------------------------------我是分割线------------------------------------------------------------

Event ForMvs.ComboBox1.SelectChange

Select Case ForMvs.ComboBox1.ListIndex

Case 1

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 普通"

Case 2

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 精英"

Case 3

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 噩梦"

End Select

End Event

上面的代码内容,窗体,控件下拉框,改变,选择判断下拉框的值如果下拉框改变内容则弹出一个提示

------------------------------------------------我是分割线------------------------------------------------------------

Event ForMvs.ComboBox2.SelectChange

Select Case ForMvs.ComboBox2.ListIndex

Case 1

MessageBox "提示" & Vbcrlf & "选择成功当前层数无增加 "

Case 2

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 二层"

Case 3

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 三层"

Case 4

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 四层"

End Select

End Event

与上面的代码意思同样

------------------------------------------------我是分割线------------------------------------------------------------

Event ForMvs.OptionBox1.Click

MessageBox "提示" & Vbcrlf & "选择成功当前使用人物 = 神威司马"

End Event

单选框如果被点击则触发控件内容并弹出准备好的内容

------------------------------------------------我是分割线------------------------------------------------------------

Event ForMvs.OptionBox2.Click

MessageBox "提示" & Vbcrlf & "选择成功当前使用人物 = 神威赵云"

End Event

与上面的代码意思同样

------------------------------------------------我是分割线------------------------------------------------------------

Event ForMvs.Button1.Click

ForMvs.InputBox2.text = ForMvs.InputBox2.text

MsgBox "设定成功当前副本内限制时间 "&"="&ForMvs.InputBox2.text &"秒"

End Event

上面的代码意思是利用控件按钮确定输入框2中的文本内容

------------------------------------------------我是分割线------------------------------------------------------------

这里开始的代码是利用控件选择后返回的值或者内容来更改脚本中的变量

Dim 难度, 启动模式, 层数

难度 = - 1 : 启动模式 = 0 : 层数 = 0

If ForMvs.ComboBox1.ListIndex = 1 Then

难度 = 0

ElseIf ForMvs.ComboBox1.ListIndex = 2 Then

难度 = 1

ElseIf ForMvs.ComboBox1.ListIndex = 3 Then

难度 = 2

End If

If ForMvs.ComboBox2.ListIndex = 1 Then

层数 = 1

ElseIf ForMvs.ComboBox2.ListIndex = 2 Then

层数 = 2

ElseIf ForMvs.ComboBox2.ListIndex = 3 Then

层数 = 3

ElseIf ForMvs.ComboBox2.ListIndex = 4 Then

层数 = 4

End If

If ForMvs.OptionBox1.Value = 1 Then

启动模式 = 1

ElseIf ForMvs.OptionBox2.Value = 1 Then

启动模式 = 2

End If

Dim Delays

Delays = ForMvs.InputBox2.Text//让变量等于输入框2文本的值

------------------------------------------------我是分割线------------------------------------------------------------

这里开始的代码是大漠插件绑定注册与绑定的方式方法

Dim Obj, dm, dm_ret

Dim dmdisplay, dmmouse, dmkeypad, dmmode, isduihuakuangopen

dmdisplay = "dx2"

dmmouse = "dx"

dmkeypad = "dx"

dmmode = "0"

BindDM//函数,实现准备好的绑定代码

If dm_ret <> 0 Then

ShwoMsgboxr "绑定成功"

Else

ShwoMsgboxr "绑定失败"

EndScript

End If

以上代码看不懂的去参考大漠插件接口命令3.1233或者搜索大漠插件视频观看学习

------------------------------------------------我是分割线------------------------------------------------------------

这里开始的则是上面用到的BindDM函数的内容

Function BindDM()

ShwoMsgboxr "准备绑定窗口"

Set Obj = createobject("WScript.Shell")

PutAttachment "C:\lkjgamehelper", "*.dll"

PutAttachment "C:\lkjgamehelper", "*.bmp"

PutAttachment ".\plugin", "RegDll.dll"

Obj.run "regsvr32 atl.dll /s"

obj.run "regsvr32 C:\lkjgamehelper\dm.dll /s"

Set Obj = nothing

Set dm = createobject("dm.dmsoft")

dm.DisableScreenSave

dm.SetPath "C:\lkjgamehelper"

Dim ban

ban = "3.1233"

If ban = dm.Ver() Then

ShwoMsgboxr "注册成功"

Else

ShwoMsgboxr "注册失败"

End If

hwnd = dm.GetMousePointWindow()

dm_ret = dm.BindWindow(hwnd,dmdisplay,dmmouse,dmkeypad,dmmode)

if dm_ret = 0 then

last_error = dm.GetLastError()

if dm.GetOsType() = 3 then

if dm.CheckUAC() = 1 then

if dm.SetUAC(0) = 1 then

ShwoMsgboxr "已经关闭系统UAC设置,必须重启系统才可以生效。点击确定重启系统"

dm.ExitOs 2

dm.delay 2000

endscript

end if

end if

end if

ShwoMsgboxr "绑定失败,错误码是:" & last_error

dm.delay 1000

ShwoMsgboxr "如果确定关闭了UAC,很可能是系统的防火墙拦截插件,请暂时关闭360等安全防火墙再尝试"

EndScript

Else

ShwoMsgboxr "绑定完成"

End If

End Function

------------------------------------------------我是分割线------------------------------------------------------------

这里的代码是用于结束脚本事释放大漠插件取消绑定窗口

Sub OnScriptExit()

ShwoMsgboxr "取消绑定窗口"

dm_ret = dm.UnBindWindow

Set dm = nothing

Set dm_ret = nothing

Set Obj = nothing

End Sub

------------------------------------------------我是分割线------------------------------------------------------------

这里开始的则是我自己编写的脚本内容了~大神勿喷~我使用大漠一不会字库二不会找多图就是个渣渣。。。。

Dim 难度, 启动模式, 层数

难度 = - 1 : 启动模式 = 0 : 层数 = 0

If ForMvs.ComboBox1.ListIndex = 1 Then

难度 = 0

ElseIf ForMvs.ComboBox1.ListIndex = 2 Then

难度 = 1

ElseIf ForMvs.ComboBox1.ListIndex = 3 Then

难度 = 2

End If

If ForMvs.ComboBox2.ListIndex = 1 Then

层数 = 1

ElseIf ForMvs.ComboBox2.ListIndex = 2 Then

层数 = 2

ElseIf ForMvs.ComboBox2.ListIndex = 3 Then

层数 = 3

ElseIf ForMvs.ComboBox2.ListIndex = 4 Then

层数 = 4

End If

If ForMvs.OptionBox1.Value = 1 Then

启动模式 = 1

ElseIf ForMvs.OptionBox2.Value = 1 Then

启动模式 = 2

End If

Dim Delays

Delays = ForMvs.InputBox2.Text

Delay 3000

Dim Obj, dm, dm_ret

Dim dmdisplay, dmmouse, dmkeypad, dmmode, isduihuakuangopen

dmdisplay = "dx2"

dmmouse = "dx"

dmkeypad = "dx"

dmmode = "0"

BindDM

If dm_ret <> 0 Then

ShwoMsgboxr "绑定成功"

Else

ShwoMsgboxr "绑定失败"

EndScript

End If

Rem 初始化变量

Dim 层数判断, 副本内延时A, 副本内延时B,进程错误

层数判断 = 1 : 副本内延时A = 0 : 副本内延时B = 0 : 进程错误 = 0

Rem 仓库

Delay 500

dm_ret = dm.FindPic(0, 0, 2000, 2000, "仓库.bmp", "000000", 0.9, 0, intX, intY)

If intX >= 0 Then

Delay 300

dm.Moveto intx + 20, inty + 40

Delay 300

dm.RightClick

Delay 1230

Else

Rem 换线

dm.Moveto 1355,180

Delay 350

dm.LeftClick

Delay 500

dm.Moveto 1355,205

Delay 350

dm.LeftClick

Delay 500

dm.Moveto 1355,230

Delay 350

dm.LeftClick

Delay 8888

dm.KeyPress "77"

Rem 找

Delay 999

dm_ret = dm.FindPic(0, 0, 2000, 2000, "小地图.bmp", "000000", 0.9, 0, insx, insy)

If insx >= 0 Then

dm.Moveto insx + 5, insy + 5

Delay 350

dm.LeftClick

Delay 100

dm.LeftClick

Delay 500

dm.KeyPress "77"

Delay 6666

Goto 仓库

Else

dm.KeyPress "77"

Goto 找

End If

End If

dm.MoveTo 181, 240

Delay 350

dm.RightClick

Delay 100

dm.RightClick

Delay 700

dm.MoveTo 1080, 40

Delay 350

dm.LeftClick

Delay 1000

dm.MoveTo 700, 150

Delay 350

dm.LeftClick

Delay 500

dm.MoveTo 420, 500

Delay 350

dm.LeftClick

Select Case 难度

Case 0

Delay 500

Case 1

dm.Moveto 845,440

Delay 500

dm.LeftClick

Delay 500

Case 2

dm.Moveto 845,440

Delay 500

dm.LeftClick

Delay 300

dm.LeftClick

End Select

dm.MoveTo 790, 535

Delay 400

dm.LeftClick

Delay 185

dm.MoveTo 1166, 280

Delay 185

dm.RightClick

Delay 100

dm.RightClick

Delay 8888

Select Case 启动模式

Case 1

Goto 模式A

Case 2

Goto 模式B

End Select

Rem 模式A

dm_ret = dm.FindPic(0, 0, 2000, 2000, "离开副本.bmp", "000000", 0.9, 0, intu, intz)

If intu >= 0 Then

Delay 200

dm.Moveto 728,30

Delay 300

dm.RightClick

Delay 5000

Else

Goto 换线

End If

Rem 循环检测A

If 层数 = 0 Then

Goto 找图

Else

If 层数检测 >= 层数 Then

Goto 离开副本

ElseIf 副本内延时A = Delays Then

Goto 离开副本

End If

End If

Rem 找图

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具A.bmp", "000000", 0.9, 0, AglsX, AglsY)

Delay 20

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具B.bmp", "000000", 0.9, 0, BglsX, BglsY)

Delay 20

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具C.bmp", "000000", 0.9, 0, CglsX, CglsY)

Delay 20

If AglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto AglsX + 15, AglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

ElseIf BglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto BglsX + 10, BglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

ElseIf CglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto CglsX + 10, CglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

Else

dm.Keypress "69"

副本内延时A = 副本内延时A + 1

Delay 1000

Goto 循环检测A

End If

Rem 进入下一关

If 层数检测 = 层数 or 层数检测 >= 3 Then

Goto 离开副本

ElseIf 副本内延时B = Delays Then

Goto 离开副本

ElseIf 进程错误 = 10 Then

Goto 离开副本

End If

dm_ret = dm.FindPic(0, 0, 2000, 2000, "柱子.bmp", "000000", 0.9, 0, AgglX, AgglY)

If AgglX >= 0 Then

Delay 200

For i = 0 to 60

dm.Moveto AgglX + 20, AgglY + i

Delay 10

i = i + 1

Next

dm.RightClick

Delay 1500

dm_ret = dm.FindPic(0, 0, 2000, 2000, "确定柱子.bmp", "000000", 0.9, 0, DintX, DintY)

If DintX >= 0 Then

Delay 200

dm.Moveto DintX + 10, DintY + 10

Delay 200

dm.LeftClick

Delay 1500

层数检测 = 层数检测 + 1

副本内延时B = 0

Delay 100

Goto 循环检测A

Else

Delay 1000

进程错误 = 进程错误 + 1

Goto 进入下一关

End If

Else

dm.Keypress "69"

Delay 1000

副本内延时B = 副本内延时B + 1

Goto 进入下一关

End If

Rem 模式B

dm_ret = dm.FindPic(0, 0, 2000, 2000, "离开副本.bmp", "000000", 0.9, 0, intu, intz)

If intU >= 0 Then

dm.Moveto 735, 35

Delay 150

dm.Keypress "68"

Delay 500

dm.Keypress "69"

Delay 500

dm.RightClick

Delay 5000

Else

Goto 换线

End If

Rem 循环检测B

If 层数 = 0 Then

Goto 找图副

Else

If 层数检测 >= 层数 Then

Goto 离开副本

ElseIf 副本内延时A = Delays Then

Goto 离开副本

End If

End If

Rem 找图副

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具A.bmp", "000000", 0.9, 0, AglsX, AglsY)

Delay 20

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具B.bmp", "000000", 0.9, 0, BglsX, BglsY)

Delay 20

dm_ret = dm.FindPic(0, 0, 2000, 2000, "道具C.bmp", "000000", 0.9, 0, CglsX, CglsY)

Delay 20

dm_ret = dm.FindPic(0, 0, 2000, 2000, "柱子.bmp", "000000", 0.9, 0, AxsX, AxsY)

If AglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto AglsX + 15, AglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

Delay 150

dm.Keypress "68"

Delay 350

ElseIf BglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto BglsX + 10, BglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

Delay 150

dm.Keypress "68"

Delay 350

ElseIf CglsX >= 0 Then

Delay 100

副本内延时A = 0

Delay 100

dm.Moveto CglsX + 10, CglsY + 15

Delay 185

dm.RightClick

For 80

dm.KeyDown "90"

Delay 5

dm.KeyUp "90"

Next

Delay 150

dm.Keypress "68"

Delay 350

ElseIf AxsX >= 0 And AglsX = BglsX = CglsX Then

准备下一层 = 准备下一层 + 1

If 准备下一层 = 20 Then

Goto 进入下一关副

Else

Delay 50

Goto 循环检测B

End If

Else

dm.Keypress "69"

副本内延时A = 副本内延时A + 1

Delay 1000

Goto 循环检测B

End If

Rem 进入下一关副

If 层数检测 = 层数 or 层数检测 >= 3 Then

Goto 离开副本

ElseIf 副本内检测B = Delays Then

Goto 离开副本

ElseIf 进程错误 = 10 Then

Goto 离开副本

End If

dm_ret = dm.FindPic(0, 0, 2000, 2000, "柱子.bmp", "000000", 0.9, 0, AgglX, AgglY)

If AgglX >= 0 Then

Delay 200

For i = 0 to 60

dm.Moveto AgglX + 20, AgglY + i

Delay 10

i = i + 1

Next

dm.RightClick

Delay 1500

dm_ret = dm.FindPic(0, 0, 2000, 2000, "确定柱子.bmp", "000000", 0.9, 0, DintX, DintY)

If DintX >= 0 Then

Delay 200

dm.Moveto DintX + 10, DintY + 10

Delay 200

dm.LeftClick

Delay 1000

dm.Keypress "68"

Delay 500

层数检测 = 层数检测 + 1

副本内延时B = 0

Delay 100

Goto 循环检测B

Else

Delay 1000

进程错误 = 进程错误 + 1

Goto 进入下一关副

End If

Else

dm.Keypress "69"

Delay 1000

副本内延时B = 副本内延时B + 1

Goto 进入下一关

End If

Rem 离开副本

dm.Moveto intU + 10, intZ + 10

Delay 500

dm.LeftClick

Delay 1500

dm_ret = dm.FindPic(0, 0, 2000, 2000, "确定.bmp", "000000", 0.9, 0, AintZ, AintU)

If AintZ >= 0 Then

dm.Moveto AintZ + 10, AintU + 10

Delay 350

dm.LeftClick

Delay 500

Else

Delay 500

Goto 离开副本

End If

Delay 8888

Goto 初始化变量

Function BindDM()

ShwoMsgboxr "准备绑定窗口"

Set Obj = createobject("WScript.Shell")

PutAttachment "C:\lkjgamehelper", "*.dll"

PutAttachment "C:\lkjgamehelper", "*.bmp"

PutAttachment ".\plugin", "RegDll.dll"

Obj.run "regsvr32 atl.dll /s"

obj.run "regsvr32 C:\lkjgamehelper\dm.dll /s"

Set Obj = nothing

Set dm = createobject("dm.dmsoft")

dm.DisableScreenSave

dm.SetPath "C:\lkjgamehelper"

Dim ban

ban = "3.1233"

If ban = dm.Ver() Then

ShwoMsgboxr "注册成功"

Else

ShwoMsgboxr "注册失败"

End If

hwnd = dm.GetMousePointWindow()

dm_ret = dm.BindWindow(hwnd,dmdisplay,dmmouse,dmkeypad,dmmode)

if dm_ret = 0 then

last_error = dm.GetLastError()

if dm.GetOsType() = 3 then

if dm.CheckUAC() = 1 then

if dm.SetUAC(0) = 1 then

ShwoMsgboxr "已经关闭系统UAC设置,必须重启系统才可以生效。点击确定重启系统"

dm.ExitOs 2

dm.delay 2000

endscript

end if

end if

end if

ShwoMsgboxr "绑定失败,错误码是:" & last_error

dm.delay 1000

ShwoMsgboxr "如果确定关闭了UAC,很可能是系统的防火墙拦截插件,请暂时关闭360等安全防火墙再尝试"

EndScript

Else

ShwoMsgboxr "绑定完成"

End If

End Function

Sub OnScriptExit()

ShwoMsgboxr "取消绑定窗口"

dm_ret = dm.UnBindWindow

Set dm = nothing

Set dm_ret = nothing

Set Obj = nothing

End Sub

Event ForMvs.Load

ForMvs.ComboBox1.ListIndex = 关卡难度选择 : ForMvs.ComboBox2.ListIndex = 挂机层数选择

ForMvs.InputBox2.Text = 60:ForMvs.InputBox1.Text = "欢迎使用三国群雄传辅助工具"

ForMvs.OptionBox1.Value = 0 : ForMvs.OptionBox2.Value = 0

End Event

Function ShwoMsgboxr(输出)

ForMvs.InputBox1.Text = 输出 & Vbcrlf & ForMvs.InputBox1.Text

End Function

Event ForMvs.ComboBox1.SelectChange

Select Case ForMvs.ComboBox1.ListIndex

Case 1

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 普通"

Case 2

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 精英"

Case 3

MessageBox "提示" & Vbcrlf & "选择成功当前难度 = 噩梦"

End Select

End Event

Event ForMvs.ComboBox2.SelectChange

Select Case ForMvs.ComboBox2.ListIndex

Case 1

MessageBox "提示" & Vbcrlf & "选择成功当前层数无增加 "

Case 2

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 二层"

Case 3

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 三层"

Case 4

MessageBox "提示" & Vbcrlf & "选择成功当前挂机层数 = 四层"

End Select

End Event

Event ForMvs.OptionBox1.Click

MessageBox "提示" & Vbcrlf & "选择成功当前使用人物 = 神威司马"

End Event

Event ForMvs.OptionBox2.Click

MessageBox "提示" & Vbcrlf & "选择成功当前使用人物 = 神威赵云"

End Event

Event ForMvs.Button1.Click

ForMvs.InputBox2.text = ForMvs.InputBox2.text

MsgBox "设定成功当前副本内限制时间 "&"="&ForMvs.InputBox2.text &"秒"

End Event

这是源代码 ~~~

一个带Qui界面的完整脚本源代码,游戏是起凡游戏平台上附带的一个游戏-游戏名

------------------------------------------------我是分割线------------------------------------------------------------

源码文件下载连接照常回复可下载~避免沉了!~~

http://share.weiyun.com/47b9bfd17e8617a934d27cecbf7a79eb

本人QQ号 1033229305 小伙伴可以加我互相讨论哦~!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值