Compare commits
No commits in common. "bdfbe4039f5aee1de4702a15c15be6bf0b38d9d3" and "c283ee31399984ba014db9e18db456ac93f9b9ae" have entirely different histories.
bdfbe4039f
...
c283ee3139
@ -1,26 +1,35 @@
|
||||
var nmpb_id = "561738578bfc6a71d8c9a907";
|
||||
var output_channel = "lobby";
|
||||
var input_channel = "NMPB Autoplayer (Sockets)"; // damn Prince Fluff in Troll Heaven2
|
||||
var input_channel = "NMPB Autoplayer (Troll Heaven2)";
|
||||
var my_name = "NMPB (Ray890)*";
|
||||
var mppUri = "ws://www.multiplayerpiano.com:8080";
|
||||
var mppUri = "ws://mpp-proxy-mpp-proxy.a3c1.starter-us-west-1.openshiftapps.com:80";
|
||||
|
||||
var Client = require('mpp-client');
|
||||
|
||||
var client1 = new Client(mppUri);
|
||||
client1.setChannel(output_channel);
|
||||
client1.start();
|
||||
var client2 = new Client(mppUri);
|
||||
client2.setChannel(input_channel);
|
||||
|
||||
function startClients() {
|
||||
client1.start();
|
||||
setTimeout(function(){
|
||||
client2.start();
|
||||
}, 2000);
|
||||
}
|
||||
startClients();
|
||||
|
||||
client1.on("hi", function(){
|
||||
client1.sendArray([{m:'userset', set:{name:my_name}}]);
|
||||
});
|
||||
|
||||
setInterval(()=>{
|
||||
if ((client1.isConnected() && !client1.channel) || (client1.channel && client1.channel._id != output_channel)) client1.setChannel(output_channel);
|
||||
if ((client2.isConnected() && !client2.channel) || (client2.channel && client2.channel._id != input_channel )) client2.setChannel(input_channel );
|
||||
}, 1000);
|
||||
client1.on("disconnect", function(){
|
||||
client1.stop();
|
||||
client2.stop();
|
||||
setTimeout(()=>{
|
||||
startClients();
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
|
||||
// NMPB notes to lobby
|
||||
@ -33,18 +42,12 @@ client2.on('a', msg => {
|
||||
if (msg.p._id != nmpb_id) return;
|
||||
client1.sendArray([{m:'a', message: msg.a}]);
|
||||
});
|
||||
// NMPB mouse to lobby
|
||||
client2.on('m', msg => {
|
||||
if (client2.findParticipantById(msg.id)._id != nmpb_id) return;
|
||||
client1.sendArray([msg]);
|
||||
});
|
||||
|
||||
|
||||
// lobby commands to NMPB
|
||||
var NMPB_commands = `
|
||||
help h list search s title color info about
|
||||
upload u
|
||||
auto a play p random r restart rr set pos sustain
|
||||
auto a play p stop random r restart rr set pos sustain
|
||||
backwards b mistakes tempo speed inverse mirror octave oct echo transpose tp
|
||||
`.trim().split('\n').join(' ').split(' ');
|
||||
client1.on('a', msg => {
|
||||
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"mpp-client": "^0.2.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node nmpb-mirror.js"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user