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 2016-03-08 17:58:23

PATRIK
Member
From: Czech Republic
Joined: 2015-02-20
Posts: 57

Help with bot.

Hello guys i have a big problem with my bot. there i send screenshot.
PS: I need somehow make alive and dead system, to see who is dead and who is alive..

http://prnt.sc/acpuod

Thx for help :*


QvDTHaA.png
pkpSoTa.png
gF3kMbs.png
l1skAPB.png
                                                ^ Made by Bobithan thx. ^

Offline

#2 2016-03-08 18:30:21, last edited by capasha (2016-03-08 18:33:51)

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Help with bot.

PATRIK wrote:

Hello guys i have a big problem with my bot. there i send screenshot.
PS: I need somehow make alive and dead system, to see who is dead and who is alive..

http://prnt.sc/acpuod

Thx for help :*


Instead of a for loop. Why doesn't you use a dictionary that use your OOP?
Like:

Dictionary<int,players> player = new Dictionary<int,players>();

switch (m.Type) {
    case "add":
    player.Add(m.Getint(0),new players() { username = m.GetString(1), alive = true });
    break;
    case "kill":
    if (player.ContainsKey(m.GetInt(0)) 
    {
      if (player[m.GetInt()].alive) player[m.GetInt(0)].alive = false;
    }
    break;


}

class players
{
public string username { get; set; }
public bool alive { get; set; }
}

Offline

#3 2016-03-08 19:27:13

PATRIK
Member
From: Czech Republic
Joined: 2015-02-20
Posts: 57

Re: Help with bot.

Thx but another error pup ups..
http://prntscr.com/acrhdo


QvDTHaA.png
pkpSoTa.png
gF3kMbs.png
l1skAPB.png
                                                ^ Made by Bobithan thx. ^

Offline

#4 2016-03-08 20:17:03

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

Re: Help with bot.

PATRIK wrote:

Thx but another error pup ups..
http://prntscr.com/acrhdo

Maybe you would consider telling us what the error is.


Everybody edits, but some edit more than others

Offline

#5 2016-03-08 20:31:13

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

Re: Help with bot.

PATRIK wrote:

Thx but another error pup ups..
http://prntscr.com/acrhdo

I think the error is cause because you add the player two times to the dictionary, which causes the dictionary to have two items with the same key, so just delete one of the two.
j08Hq86.png


vF0MA5o.png

Offline

#6 2016-03-08 21:09:12

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Help with bot.

PATRIK wrote:

Thx but another error pup ups..
http://prntscr.com/acrhdo

You should save the coins in the players list too. I don't see a reason to have so many dictionarys.
And what 912468 said. It's shouldn't be added twice.

Offline

#7 2016-03-08 21:57:37

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

Re: Help with bot.

i usually create a separate list with players and add everyone into the game

Each time when someone dies on case "kill"
delete the player until there is 1 player left and that 1 player wins


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

#8 2016-03-09 02:30:34

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Help with bot.

Here is an example how I would do it.
http://pastebin.com/GJ9YHGuy

Offline

#9 2016-03-10 16:55:12, last edited by Tomahawk (2016-03-10 16:55:29)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,847

Re: Help with bot.

capasha wrote:

Here is an example how I would do it.
http://pastebin.com/GJ9YHGuy

Yay, unnecessary functionality. You can't be a pro programmer without it.

~ I think this post would be better answered with a tutorial about certain collections, such as class dictionaries, as lack of core C# knowledge seems to be the difficulty here rather than using EE's messages.

Teach a man to fish. Don't just hand him fish.

If motivation to work harder than absolutely necessary was a common attribute among newbie botmakers, sites like these would be more helpful than spoonfed code:
http://www.dotnetperls.com/
http://stackoverflow.com/
http://www.homeandlearn.co.uk/csharp/csharp.html
https://msdn.microsoft.com/en-us/librar … s.71).aspx

Peer learning's great and all, but it's not done quite right in this forum in the [Help] threads.


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

#10 2016-03-10 17:02:33

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

Re: Help with bot.

Tomahawk wrote:

Teach a man to fish. Don't just hand him fish.

"Teach men to fish and then fishermen will be less paid." Fishermen quote.
"Quantity its better than quality." Chinese quote.


Everybody edits, but some edit more than others

Offline

#11 2016-03-10 17:09:16, last edited by Tomahawk (2016-03-10 17:09:41)

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,847

Re: Help with bot.

Zumza wrote:

"Teach men to fish and then fishermen will be less paid." Fishermen quote."Quantity its better than quality." Chinese quote.

I have no idea what you're arguing.

And your signature image is annoyingly big <3


One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.

Offline

Tomahawk1457626156587709

Board footer

Powered by FluxBB

[ Started around 1732514258.9184 - Generated in 0.068 seconds, 13 queries executed - Memory usage: 1.61 MiB (Peak: 1.8 MiB) ]