-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Well now i am trying the bot army and everything goes fine except it doesnt release the trooper bot. It returns the message in the log so I dont know. can you help?
var ROOMID = 'xxxxxxxxxxxxxxx';
var USERID = 'xxxxxxxxxxxxxxx';
// BOT ARMY INFO
var num_army_bots = 1; // Update this when adding more bots
var botArmyIDs = 'xxxxxxxxxx';
var botArmyAuths = 'xxxxxxxx';
var control_army= true;
var currently_sending_trooper = false;
var trooper_sent = 0;
// Log in woofus' army
var botArmy = new Array();
for (botIndex=0;botIndex<num_army_bots;botIndex=botIndex+1) {
botArmy[botIndex] = new Bot(botArmyAuths[botIndex], botArmyIDs[botIndex], ROOMID);
}
bot.on('speak', function(data) {
if( data.userid == USERID ) {
return;
} else {
for( botIndex=0; botIndex<num_army_bots; botIndex=botIndex+1 ) {
if( data.userid == botArmyIDs[botIndex] ) {
return;
}
}
}
// Get the data
var name = data.name;
var text = data.text;
// Hide troops
if (data.text.match('hide troops')) {
console.log('\nGetting rid of the troops\n\n', data);
for( botIndex=0; botIndex<num_army_bots; botIndex=botIndex+1 ) {
botArmy[botIndex].roomDeregister();
}
control_army = false;
handled_command = true;
}
// Bring back troops
if (data.text.match('bring troops')) {
console.log('\nBringing the troops back\n\n', data);
for( botIndex=0; botIndex<num_army_bots; botIndex=botIndex+1 ) {
botArmy[botIndex].roomRegister(current_room);
}
control_army = true;
handled_command = true;
}