用街机模拟器玩格斗游戏的一键出招脚本
用Winkawaks本身已有宏可支持一键出招,但可惜网络连机时不支持宏运行,何况mame更不支持宏。那就只有——按键精灵了。
因为格斗游戏,人物正反位置很重要。左右两边位置按键根本不同,在原则上考虑,按一个键后则所有必杀技变为右位出招,按另一个键则变回左位出招。因按键精灵不支持全局变量,考虑很久,又看到了版主的“用一个脚本控制另一个脚本”深受启发,终于写了个初步的脚本,可以实现:1,按f9,启动正反位判断;2,按z,变成左位发招;3,按b,变成右位发招。4,h键升龙,y键波动,目前只做了这两个必杀,其他必杀请参照脚本处理。
说明:模拟器按键的设置为:方向键w、a、s、d。拳j、k、L,脚u、i、o。如玩友设置不同,请在脚本中自行调整。
A,正反判断的脚本:
[General]
Description=正反判断
BeginHotkey=120
BeginHotkeyMod=0
RunOnce=1
Enable=1
[Repeat]
Type=0
Number=1
[CallBack]
OnSetup=
[Comment]
Content=格斗游戏正反判断.
[Script]
Rem checkbutton
WaitKey wait
If wait=90
kongzhi=0
Gosub writescript
ElseIf wait=66
kongzhi=1
Gosub writescript
EndIf
Goto checkbutton
Sub writescript
Set objShell = CreateObject("WScript.Shell")
x = objShell.SpecialFolders.Item("desktop")
//↑取得桌面路径
VBS set fso=CreateObject("Scripting.FileSystemObject")
VBS const forwriting=2
VBS const forreading=1
VBS set myfile=fso.createtextfile(x&"\cs.txt")
//↑写一个cs.TXT到桌面
VBS myfile.writeline(kongzhi)
//↑这行就是写进TXT的内容
VBS myfile.Close
Return writescript
B,受控小升龙拳脚本:
[General]
Description=受控小升龙
BeginHotkey=72
BeginHotkeyMod=0
RunOnce=1
Enable=1
[Repeat]
Type=0
Number=1
[CallBack]
OnSetup=
[Comment]
Content=格斗游戏受控波动拳
[Script]
//Rem 检测是否运行脚本
Set objShell = CreateObject("WScript.Shell")
x = objShell.SpecialFolders.Item("desktop")
//↑取得桌面路径
VBS set fso=CreateObject("Scripting.FileSystemObject")
VBS const forwriting=2
VBS const forreading=1
VBS Set myfile=fso.OpenTextFile(x&"\cs.txt",ForReading)
VBS a=myfile.ReadLine
If a = 0
KeyUp 83 1
KeyUp 65 1
KeyPress 68 1
KeyPress 83 1
KeyDown 83 1
KeyPress 68 1
KeyUp 83 1
KeyPress 74 1
ElseIf a=1
KeyUp 83 1
KeyUp 68 1
KeyPress 65 1
KeyPress 83 1
KeyDown 83 1
KeyPress 65 1
KeyUp 83 1
KeyPress 74 1
EndIf
VBS myfile.Close
//Goto 检测是否运行脚本
C,受控小波动拳脚本:
[General]
Description=受控波动拳
BeginHotkey=89
BeginHotkeyMod=0
RunOnce=1
Enable=1
[Repeat]
Type=0
Number=1
[CallBack]
OnSetup=
[Comment]
Content=格斗游戏受控波动拳
[Script]
//Rem 检测是否运行脚本
Set objShell = CreateObject("WScript.Shell")
x = objShell.SpecialFolders.Item("desktop")
//↑取得桌面路径
VBS set fso=CreateObject("Scripting.FileSystemObject")
VBS const forwriting=2
VBS const forreading=1
VBS Set myfile=fso.OpenTextFile(x&"\cs.txt",ForReading)
VBS a=myfile.ReadLine
If a = 0
KeyUp 83 1
KeyUp 65 1
KeyPress 83 1
KeyDown 83 1
KeyPress 68 1
KeyUp 83 1
KeyPress 68 1
KeyPress 74 1
ElseIf a=1
KeyUp 83 1
KeyUp 68 1
KeyPress 83 1
KeyDown 83 1
KeyPress 65 1
KeyUp 83 1
KeyPress 65 1
KeyPress 74 1
EndIf
VBS myfile.Close
//Goto 检测是否运行脚本
本人初次写脚本,乃抛砖引玉,希望不要被板砖拍:)
|