赞
踩
天涯明月刀手游自动弹奏案件精灵代码怎么编写和使用?天涯明月刀手游ios怎么自动弹奏?一起来看看吧。
天涯明月刀手游自动弹奏按键精灵使用详细教学
一、前言
由于游戏内触屏不精准,音符时长难以控制,多音/和弦指法和已有乐器并无联系,导致手动曲谱弹奏效果很差。另外如果想要编写双人合奏的曲子,比如男号笛子主旋律,女号弹琴作和弦伴奏,那么对弹奏的精准要求非常的高,因此利用脚本来自动弹琴成为了很有必要的手段。
目前已经有人编写好了安卓端还有pc端的脚本,可以直接使用。
[https://www.jianshu.com/p/5fe2af3090f6?utm_campaign=hugo&utm_medium=reader_share&utm_content=note&utm_source=qq]
对于ios用户,可以使用pc端的脚本直接在pc上录制。但是像楼主这样电脑是mac(苹果电脑)但是又不想装windows系统的,就没法用pc客户端了。另外还有pc的云游戏,但是非常卡,难以录制,效果很差。楼主只能自力更生了。
索性楼主百度发现ios端也有按键精灵,那么利用按键精灵编写脚本,就可以实现ios端自动弹琴。
二、准备工作
1.安装手机端按键精灵需要越狱,可自行百度。如果你不准备给自己的iphone越狱的话,那么你可以放弃继续看这个攻略了。安装按键精灵的教程如下:
[http://bbs.anjian.com/showtopic-652186-1.aspx]
2.由于在手机端编写脚本很麻烦,毕竟手机键盘很小,复制粘贴代码也不方便,建议使用电脑端编写,然后通过qq之类的软件(只要能传送数据,任何手段都可以)直接发送到手机端。然后电脑端写代码任何文本编辑器都可以,比如最常用的word都行,虽然黑坨坨一堆代码看的很乱。个人mac上用的是Sublime Text来写,不同的函数自变量之类的都自动用不同颜色区分看起来很舒服。
三、按键精灵基础函数介绍
1.关于手机像素点的介绍和基础触按键的介绍可以参看下面的链接
[http://bbs.anjian.com/showtopic-604658-1.aspx]
当然你也可以自行百度学习。这里简单介绍一下。
2.手机屏幕是由像素点组成的,比如iphone 6s就是750*1344个像素点组成。从左上到右下建立坐标系。x取0到750的整数,y取0到1344的整数。
3.TouchDown x, y, n
这个函数就是按键精灵按下手机屏幕上(x,y)这个坐标位置的点。其中n为手指的标记,比如取1-10代表10个不同的手指,单音演奏的时候可以都默认用同一个,涉及到和弦和多轨道旋律演奏就要同时用到几个不同的手指。
4.TouchUp n
就是弹起标记为n的手指按下的按键。
5.Delay t
就是等待t毫秒
四、单旋律曲谱编写与示范
1.结合第3部分的知识,那么弹奏某个音符,时长为t的操作,只需要通过按键精灵按下该音符坐标的位置,Delay t时间,再弹起就可以做到。
换成代码就是
TouchDown x, y, n
Delay t
TouchUp n
当然由于要反复弹很多单音,这3个函数可能要按这个顺序反复调用,因此我们可以专门编写一个函数来使得代码更加简洁。
2.关于音符坐标怎么确定
可以通过按键精灵脚本录制,来获得游戏内3个8度,一共21个音的坐标位置。如下图所示,找到脚本录制的地方。
打开游戏找到自由演奏的地方,点击按键精灵的浮窗来录制。
结束录制后找到按键精灵内录制好的脚本。
点击右上角来编辑脚本代码。
这里就可以看到录制的脚本,也就是你刚刚按屏幕的所有操作自动录制转成的代码,其中那些坐标就是刚刚你弹奏的音符的坐标,建议从左下依次弹完一个8度,然后弹中音,最后高音。不过由于距离间隔是一样的,时机上你只录制3个音,用等差数列也可以推导出来。录制21个音然后每行去线性拟合坐标的话会比较精准一些。
3.单音弹奏函数Note的编写
Function Note(n1,n2,beat)
TouchDown n1*80,n2*190-30,1
Delay beat*1000
TouchUp 1
End Function
这里我的21个音的坐标分别是(80,160) (80,350) (80,540)....(160,160)(160,350)(160,540)...因此就有了第2行TouchDown n1*80,n2*190-30,1 这么写,实际上就是个等差数列的网格。
这里的beat代表拍子的数目。不懂乐理的可以自动百度一个比如一个bpm120的曲子,代表120 beats per mins,每秒钟120拍,每拍就是0.5s=500ms。 对于一个4/4拍的曲子,就是1/4音符为1拍,每小节4拍。
我这里第3行代码Delay beat*1000就是代表了这个音弹拍子数乘以1000ms的时间,你可以通过修改这个1000来改变整首曲子的速度。这里相当于bpm60的速度。
然后我左边n1代表这个里21个音3行的行数,n2代表列数。也就是n1取1,2,3分别代表低音,中音,高音,n2取1,2,3...代表do,re,mi....
另外空拍(简谱里的0)可以直接用Delay函数空对应的时长就行了。因此下面加了一个判定,如果n2取0,那么直接空对应时长不按键。n2不是0的时候就和前面一样。
Function Note(n1,n2,beat)
if n2=0 Then
Delay beat*1000
Else
TouchDown n1*80,n2*190-30,1
Delay beat*1000
TouchUp 1
End if
End Function
4.单音曲谱代码示范
示例1
Function Note(n1,n2,beat)
if n2=0 Then
Delay beat*1000
Else
TouchDown n1*80,n2*190-30,1
Delay beat*1000
TouchUp 1
End if
End Function
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,2,1.5)
Call Note(3,1,0.5)
Call Note(2,7,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,2,1.5)
Call Note(3,1,0.5)
Call Note(2,7,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,3)
Call Note(3,1,0.75)
Call Note(2,7,0.25)
//
Call Note(2,6,1.5)
Call Note(2,7,0.5)
Call Note(2,6,0.5)
Call Note(2,7,0.25)
Call Note(2,6,0.25)
Call Note(2,5,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,0.5)
Call Note(2,5,0.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
Call Note(1,6,1)
Call Note(2,6,0.5)
Call Note(2,3,0.5)
//
Call Note(2,2,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(1,6,0.5)
Call Note(2,2,1)
Call Note(2,3,1)
//
Call Note(1,6,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,2,1.5)
Call Note(3,1,0.5)
Call Note(2,7,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,2,1.5)
Call Note(3,1,0.5)
Call Note(2,7,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,3)
Call Note(3,1,0.75)
Call Note(2,7,0.25)
//
Call Note(2,6,1.5)
Call Note(2,7,0.5)
Call Note(2,6,0.5)
Call Note(2,7,0.25)
Call Note(2,6,0.25)
Call Note(2,5,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,0.5)
Call Note(2,5,0.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
Call Note(1,6,1)
Call Note(2,6,0.5)
Call Note(2,3,0.5)
//
Call Note(2,2,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(1,6,0.5)
Call Note(2,2,1)
Call Note(2,3,1)
//
Call Note(1,6,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,2,0.5)
Call Note(2,1,0.5)
Call Note(2,5,0.5)
//小颤音//
Call Note(2,2,0.2)
Call Note(2,1,0.1)
Call Note(2,2,0.2)
Call Note(2,1,1)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//
Call Note(1,6,0.5)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(2,3,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(3,1,0.75)
Call Note(2,7,0.25)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
Call Note(2,1,1)
Call Note(1,6,0.5)
Call Note(2,3,0.5)
//
Call Note(2,2,0.5)
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(1,6,0.5)
Call Note(2,3,1)
Call Note(1,6,0.5)
Call Note(2,2,0.5)
//
Call Note(2,3,3)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(3,1,0.75)
Call Note(2,7,0.25)
//
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
Call Note(2,1,1)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//
Call Note(1,6,0.5)
Call Note(2,6,0.5)
Call Note(2,5,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(2,3,0.5)
Call Note(2,5,0.5)
//
Call Note(2,6,7)
这里开头就是定义了Note这个单音演奏的函数,然后反复调用这个这个单音函数一个音一个音来弹。//双斜线在代码里是注释用的,实际不会运行,一般用来让自己理解这里你写了啥,做个标记,我这里就把每小节分割了一下方便查错,你也可以多写一下这里是第几小节,特别是比较长的谱子等会你都找不到北了。
示例2(包含空拍子,曲谱只写了开头,而且颤音,倚音之类的修饰音没有写,在后面高级技巧部分再补充)
//乱红
Function Note(n1,n2,beat)
if n2=0 Then
Delay beat*1000
Else
TouchDown n1*80,n2*190-30,1
Delay beat*1000
TouchUp 1
End if
End Function
//
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,0.75)
Call Note(2,6,0.75)
Call Note(2,3,1.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//
Call Note(2,3,3)
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,0.75)
Call Note(2,6,0.75)
Call Note(2,3,1.5)
Call Note(2,2,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,3)
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,1.5)
Call Note(2,6,0.5)
Call Note(2,3,1)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//第一小段
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
Call Note(1,7,0.5)
Call Note(1,6,1)
Call Note(1,0,0.5)
Call Note(2,1,0.25)
Call Note(1,7,0.25)
//
Call Note(1,6,1.5)
Call Note(2,1,0.5)
Call Note(1,7,1)
Call Note(1,6,0.5)
Call Note(1,5,0.5)
//
Call Note(1,6,3)
//重复开头
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,0.75)
Call Note(2,6,0.75)
Call Note(2,3,1.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//
Call Note(2,3,3)
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,1.5)
Call Note(2,6,0.75)
Call Note(2,3,1.5)
Call Note(2,2,0.5)
Call Note(2,5,0.5)
//
Call Note(2,3,3)
Call Note(1,0,0.5)
Call Note(1,6,0.5)
//
Call Note(2,5,1.5)
Call Note(2,6,0.5)
Call Note(2,3,1)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
//第二小段
Call Note(2,3,0.5)
Call Note(2,2,0.5)
Call Note(2,1,0.5)
Call Note(1,7,0.5)
Call Note(1,6,1)
Call Note(1,0,0.5)
Call Note(1,6,0.25)
Call Note(1,7,0.25)
//
Call Note(2,1,1)
Call Note(2,1,0.5)
Call Note(2,3,0.5)
Call Note(2,2,1)
Call Note(2,1,0.5)
Call Note(1,7,0.5)
//
Call Note(1,6,3)
5.脚本运行
电脑端写好了代码通过qq之类的发送到手机,并直接粘贴覆盖掉刚刚我说的你录制脚本的代码,然后游戏内通过浮窗,点击运行就可以自动弹奏了。
以上就是小编关于天涯明月刀手游自动弹奏按键精灵使用详细教学所有的分享了,希望能帮助到大家。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。