Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-04-24 13:41:22

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

[Question] Get player list

Obviously you have to keep track of a list/array/etc. and add the players to it everytime they join.
But what if your bot joins a bit late and somebody is already inside?
I might be blind or plain correct, but I can find no place to request the players that are currently in the map.

In case people are wondering why I would like this function:
The interface of my bot will have the chat log displayed.
I guess people joining before the bot does wouldn't be that much of a problem, I could always kick them automatically and tell them to rejoin so I can catch their add event.
But when the bot joins, he won't catch his own add event. So everytime he sais something, the interface will crash, unless I wouldn't display his messages at all, but then I won't have the complete chat...

Any suggestions, fixes or parts that I didn't see?

Offline

#2 2015-04-24 13:51:11

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: [Question] Get player list

1. You get an add message for every user that is in the room and have joined after you connected the bot.
    Maybe you forgot to send "init2"?
2. You also get the info of the world and your bot in the "init" type message.


Everybody edits, but some edit more than others

Offline

#3 2015-04-24 13:58:24

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Question] Get player list

Zumza wrote:

1. You get an add message for every user that is in the room and have joined after you connected the bot.
    Maybe you forgot to send "init2"?
2. You also get the info of the world and your bot in the "init" type message.

Yep, as I thought, looked over something...
Thanks for the init2, the tutorial didn't really show you'd have to use it. They just put it in the example program when putting it all together.
Thanks again and sorry for the trouble.

Offline

#4 2015-04-24 15:51:54

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Question] Get player list

Alright, so the init2 makes it so that the bot now gets all players that were there before him...
But for some odd reason he can't find himself?
Should I just use a hack and say: "Oh, you can't find that id? It's you! //forums.everybodyedits.com/img/smilies/big_smile"
Or post the code snippets that matter and hope somebody can find the problem?

Offline

#5 2015-04-24 16:16:00

912468
Member
Joined: 2015-02-21
Posts: 212
Website

Re: [Question] Get player list

den3107 wrote:

But for some odd reason he can't find himself?
Should I just use a hack and say: "Oh, you can't find that id? It's you! //forums.everybodyedits.com/img/smilies/big_smile"
Or post the code snippets that matter and hope somebody can find the problem?

Your userID and username are send in "init":

case "init":
    int myUserID = m.GetInt(6); // Your userID
    string myPlayerName = m.GetString(12); // Your username
    break;

vF0MA5o.png

Offline

#6 2015-04-24 16:33:24

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Question] Get player list

Thanks yet again, and sorry for my idiotness...

Offline

#7 2015-04-24 19:32:54

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: [Question] Get player list

Your not an idiot. Good luck with your bot, Im sure i will see nice things coming from you!


Everybody edits, but some edit more than others

Offline

#8 2015-04-24 19:42:46

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Question] Get player list

Zumza wrote:

Your not an idiot. Good luck with your bot, Im sure i will see nice things coming from you!

Being honest I have no idea so far, just fiddling around, looking how much C# looks like Java.
Been a member almost all the while and never really found a way how to make bots...

But if there're any tutorials, documentations or bot ideas that need some work done I guess I'm down to help.

Offline

#9 2015-04-24 20:53:31

darkblades
Member
From: New MLG City/Weed Town
Joined: 2015-03-21
Posts: 122

Re: [Question] Get player list

if you want use this
http://capasha.com/notafraud/index.php
good luck!! that explains every case and its purpose.


Sample Text.

Doritos/Mountain Dew eater.
420 No scoping 69 scrubs per day
Always smoke weed everyday.

Known for: #getrekt Bot (possible revive with new stuff?)

Offline

#10 2015-04-24 22:38:07

DarkDragon4900
Member
Joined: 2015-03-17
Posts: 251

Re: [Question] Get player list

Damn, I was making a mini-physics class for players when I saw this.
Apparently too late to answer :p

Asking questions shows that you have passion in what you're doing.
I'd rather look like an idiot at first and become a pro coder later on than stay a nub.

Offline

#11 2015-04-24 23:27:20

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: [Question] Get player list

DarkDragon4900 wrote:

Damn, I was making a mini-physics class for players when I saw this.
Apparently too late to answer //forums.everybodyedits.com/img/smilies/tongue

Asking questions shows that you have passion in what you're doing.
I'd rather look like an idiot at first and become a pro coder later on than stay a nub.

What exactly do you mean by mini-phisics?

And I do agree, but I think that if I looked better I could've find it myself too, so that's why I call myself idiotic for this question.

Offline

#12 2015-04-25 07:12:04

DarkDragon4900
Member
Joined: 2015-03-17
Posts: 251

Re: [Question] Get player list

Well, Several people have made apis under the name "physics" which would allow you to keep all the data you get sorted.
So adding a single line in your OnMessage EventHandler would allow you to have an automatically updated Dictionary<int, Player> Players where Player
is a class made in the api.

Though when I said I'm making a mini-physics class, I meant that it's a single class rather than a .dll file.
You can take a look at how it works if you want. though, I only added things I would need in my bot.

http://pastebin.com/NjaufKKe

Offline

DarkDragon49001429942324498487

Board footer

Powered by FluxBB

[ Started around 1732810739.6587 - Generated in 1.786 seconds, 14 queries executed - Memory usage: 1.53 MiB (Peak: 1.7 MiB) ]