-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question about nickname #35
Comments
or how is it possible to get the x and y coordinate of my cell in the browser ? |
I'm not sure i correctly understood your question. Don't know that is
If you want really "around" balls, lets count this like "balls on screen". setTimeout(function(){ //timer for 5 seconds
console.log('SEARCHING FOR BALLS AROUND ME!');
for(var ball_id in client.balls) {
if(!client.balls.hasOwnProperty(ball_id)) continue; //prototype can get in the way
var ball = client.balls[ball_id];
if(!ball.visible) continue; //this ball is not on the screen
if(!ball.name) continue; //this ball don't have a nickname
if(ball.mine) continue; //this is our ball
console.log('I see ball with nickname near me! ID ' + ball_id + ' and nickname ' + ball.name);
}
}, 5000);
Can't help with that. I code my own lib without using original code from browser. I don't know where and what stored there. |
@pulviscriptor that's exactly what i want, but don't know why it doesn't work for me (picture above)...and how can i add this to multiple ? |
Also here is code for client.on('ballAppear', function(ball_id) {
var ball = client.balls[ball_id];
if(ball.name) console.log('NEW BALL WITH NICKNAME APPEARED! ID ' + ball_id + ', nickname ' + ball.name);
}); agarioBotDev, i pasted code to end of the file
Its up to you, i don't know where you want it. |
Try to replace |
thanks, works |
one last question... bot.client.on('ballAppear', function (ball_id) {
var ball = bot.client.balls[ball_id];
if (ball.name == "[Dm] Master")
{
console.log('Master appeared !');
bot.interval_id = setInterval(function () { bot.recalculateTarget() }, 1000000000); // to give the bot enough time to move to me --> next line
bot.client.moveTo(ball.x, ball.y); // here the bot have to move to me, but it doens't work, he still search for this little pieces...?
}
}); PS: it displays the message, so the event work fine |
I don't know what is wrong there, but i see what you trying to do. var ball = bot.client.balls[ball_id];
if(ball.virus) continue;
if(!ball.visible) continue;
if(ball.mine) continue;
if(ball.name == 'yourname') return bot.client.moveTo(ball.x, ball.y); //add this line here
if(ball.size/my_ball.size > 0.5) continue; Didn't tested, but should work. |
hey Dude !
your script is very usefull for me, but i really tried hard to get the nickname from the other balls around
, adding sth to the appear in agario-client.js....is there a way to get the nickname of a ball, or is it anywhere stored in the packet? (i don't mean the nickname of your bots) i want them to go into sb, when appear
thanks,
David
The text was updated successfully, but these errors were encountered: