欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

基于autojs编写一个自弹钢琴的脚本

程序员文章站 2022-03-16 12:49:33
...

需求说明

硬件:一部手机
软件:Auto.js、明日之后(游戏)、钢琴师(含钢琴全键位的游戏)
脚本:此以“起风了.js”脚本为例

自运行软件图标

基于autojs编写一个自弹钢琴的脚本

开启无障碍及相关操作说明

基于autojs编写一个自弹钢琴的脚本

基于autojs编写一个自弹钢琴的脚本

基于autojs编写一个自弹钢琴的脚本
基于autojs编写一个自弹钢琴的脚本

打开钢琴软件/游戏,进行测试

基于autojs编写一个自弹钢琴的脚本

总结:

将脚本文件导入到autojs,进入游戏,打开钢琴88全键,点击悬浮窗菜单栏,选择目标文件,运行即可。

以下给出完整代码:

var S=0.7;   //S=脚本播放的倍速,越大越快
var Y=device.width;
var X=device.height;
var Y1=Y/15
var Y2=Y1*3
Y1=Y-Y1
Y2=Y-Y2
var Z=X/1920;
toast("《起风了》");
sleep(1000/S); 
toast("开始弹奏"); 
sleep(2000/S);
sleep(0/S);
press(1166*Z,Y1,1);  press(611*Z,Y1,1);
//另一种写法也可以:gestures([0,1,[1166*Z,Y1],[611*Z,Y1]]);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(500*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);  press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);   press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);   press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);   press(500*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);   press(648*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1018*Z,Y1,1);  press(759*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);  press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(500*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);  press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(500*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(759*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);  press(648*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(500*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);  press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(500*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);  press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(648*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(537*Z,Y1,1);
sleep(300/S);
press(685*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);  press(796*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);  press(685*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);  press(537*Z,Y1,1);
sleep(300/S);
press(685*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(796*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(685*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);  press(870*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(759*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(150/S);
press(1018*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);  press(870*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(759*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);  press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(870*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(462*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);
sleep(150/S);
press(721*Z,Y1,1);
sleep(300/S);
press(611*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1351*Z,Y1,1);press(426*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(574*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(685*Z,Y1,1);
sleep(300/S);
press(574*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1388*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1425*Z,Y1,1);
sleep(150/S);
press(1388*Z,Y1,1);press(685*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);press(796*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(685*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(462*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);
sleep(150/S);
press(721*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);press(500*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(870*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(462*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);
sleep(150/S);
press(721*Z,Y1,1);
sleep(300/S);
press(611*Z,Y1,1);
sleep(150/S);
press(1129*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1351*Z,Y1,1);press(426*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(574*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(685*Z,Y1,1);
sleep(300/S);
press(574*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1388*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1425*Z,Y1,1);
sleep(150/S);
press(1388*Z,Y1,1);press(685*Z,Y1,1);
sleep(150/S);
press(1351*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);press(796*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(685*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(462*Z,Y1,1);
sleep(300/S);
press(1462*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1462*Z,Y1,1);
sleep(150/S);
press(721*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(462*Z,Y1,1);
sleep(300/S);
press(1462*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1462*Z,Y1,1);
sleep(150/S);
press(721*Z,Y1,1);
sleep(300/S);
press(1277*Z,Y1,1);press(611*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);
sleep(150/S);
press(1314*Z,Y1,1);press(537*Z,Y1,1);
sleep(300/S);
press(685*Z,Y1,1);
sleep(300/S);
press(796*Z,Y1,1);
sleep(300/S);
press(685*Z,Y1,1);
sleep(300/S);
press(537*Z,Y1,1);
sleep(300/S);
press(685*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(796*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(685*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(870*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(870*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);press(389*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);press(389*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(150/S);
press(1239*Z,Y1,1);
sleep(150/S);
press(1203*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);
sleep(150/S);
press(1166*Z,Y1,1);press(500*Z,Y1,1);
sleep(300/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(648*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(870*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(648*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(870*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(759*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(500*Z,Y1,1);
sleep(300/S);
press(1314*Z,Y1,1);press(648*Z,Y1,1);
sleep(150/S);
press(1277*Z,Y1,1);
sleep(150/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(648*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(389*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);
press(537*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(389*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(648*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(537*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(1055*Z,Y1,1);press(870*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(759*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(648*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(796*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(907*Z,Y1,1);
sleep(300/S);
press(1203*Z,Y1,1);press(796*Z,Y1,1);
sleep(300/S);
press(1166*Z,Y1,1);press(648*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(796*Z,Y1,1);
sleep(150/S);
press(1055*Z,Y1,1);
sleep(150/S);
press(907*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(796*Z,Y1,1);
sleep(300/S);
press(1129*Z,Y1,1);press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(611*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(870*Z,Y1,1);
sleep(300/S);
press(759*Z,Y1,1);
sleep(300/S);
press(611*Z,Y1,1);
sleep(1200/S);
toast("演奏完毕");

说明:

以上只做学习使用,不可用作商业用途,未经本人允许,请勿转发!