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-07-18 22:53:12

Gooberg
Member
From: Andromeda Galaxy
Joined: 2015-02-26
Posts: 81

GooBot Help Thread

This is my first bot, and I'm not much of a "tutorial" kind of guy, so I decided instead of creating alternate threads for each issue, how about just use 1 thread.

#1 - My commands don't work. IDK why. Does not give errors, when someone says .help,

My code:

List<eeplayer> playerList = new List<eeplayer>();

public void handlemsg(object sender, PlayerIOClient.Message m)
        {
            if (m.Type == "init")
            {
                say("Connected");
            }

            if (m.Type == "add")
            {
                playerList.Add(new eeplayer() { userID = m.GetInt(0), username = m.GetString(1) });
            }

            if (m.Type == "left")
            {
                foreach (eeplayer p in playerList)
                {
                    if (p.userID == m.GetInt(0))
                    {
                        playerList.Remove(p);
                    }
                }
            }

            if (m.Type == "say")
            {
                if (m.GetString(1) == ".help")
                {

                    foreach (eeplayer p in playerList)
                    {
                      con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");
                       
                        if (m.GetString(1) == ".unafk")
                        {
                            {
                                if (p.userID == m.GetInt(0))
                                {
                                    con.Send("say", "/kill " + p.username);

                                }
                            }

                            if (m.GetString(1) == ".afk")
                            {
                                if (p.userID == m.GetInt(0))
                                {
                                    con.Send("say", "/godon " + p.username);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}


Owner of GooCrew
GooCrew Worlds:
GooCrew Art World

Offline

#2 2015-07-18 22:57:42

Jabatheblob1
Member
Joined: 2015-03-01
Posts: 856

Re: GooBot Help Thread

So i don't understand, are you trying to make a help command? Because right now you have the curly braces in the wrong places, tell me what commands you want, because idk what is in the middle and what is going on with the foreach loop


If you would like me to make a bot for you, go here.

Offline

#3 2015-07-18 22:59:43, last edited by Era (2015-07-18 23:04:43)

Era
Member
From: ::1
Joined: 2015-05-06
Posts: 884

Re: GooBot Help Thread

1. if the string is already .help it cannot be .afk or .unafk , they have to be seperate , you could uses switch (m.getstring(1)) for example

edit: you arent sending init2 !! this meens the server won't send you the "add" messages ;
send "init2" in the "init" section

Offline

#4 2015-07-18 23:25:23

Gooberg
Member
From: Andromeda Galaxy
Joined: 2015-02-26
Posts: 81

Re: GooBot Help Thread

Era, thank you for this. I thought that was the issue, but my friend ninjasupeatsninja denied that it was that issue earlier today. (Screw you ninja)                  I hope it works!

JabatheBlob1: Yes I am trying to create a help function that lists the player's permissions, an afk function that enables godmode on the player and an unafk function that kills the player.


Owner of GooCrew
GooCrew Worlds:
GooCrew Art World

Offline

#5 2015-07-18 23:50:52, last edited by ewoke (2015-07-18 23:52:43)

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: GooBot Help Thread

 if (m.Type == "say")
            {
                if (m.GetString(1) == ".help")//someone says help
                {
                    foreach (eeplayer p in playerList)
                    {
                      con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");//all players get spammed with help command
                        
                        if (m.GetString(1) == ".unafk")//stuff that doesnt really belong in this if statement
                        {//stuff that doesnt really belong in this if statement
                            {//stuff that doesnt really belong in this if statement
                                if (p.userID == m.GetInt(0))//stuff that doesnt really belong in this if statement
                                {//stuff that doesnt really belong in this if statement
                                    con.Send("say", "/kill " + p.username);//stuff that doesnt really belong in this if statement
                                }//stuff that doesnt really belong in this if statement
                            }//stuff that doesnt really belong in this if statement
                            if (m.GetString(1) == ".afk")//stuff that doesnt really belong in this if statement
                            {//stuff that doesnt really belong in this if statement
                                if (p.userID == m.GetInt(0))//stuff that doesnt really belong in this if statement
                                {//stuff that doesnt really belong in this if statement
                                    con.Send("say", "/godon " + p.username);//stuff that doesnt really belong in this if statement
                                }//stuff that doesnt really belong in this if statement
                            } //stuff that doesnt really belong in this if statement
                        }//stuff that doesnt really belong in this if statement
                    }
                }
  
if (m.GetString(1) == ".help")//someone says help
                {
                    foreach (eeplayer p in playerList)
                    {
                              if (p.userID == m.GetInt(0))
                                {
                                    con.Send("say", "/godon " + p.username);
                                }
                    }
                }
                if (m.GetString(1) == ".help")//someone says help
                {
                 foreach (eeplayer p in playerList)
                    {
                              if (p.userID == m.GetInt(0))
                                {
                                    con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");
                                }
                    }
                 }

if you can read this....good for you

Offline

#6 2015-07-19 02:45:58

Gooberg
Member
From: Andromeda Galaxy
Joined: 2015-02-26
Posts: 81

Re: GooBot Help Thread

I see what was wrong the whole time. I took a break for a while.

The bot starts the list for players who enter and leave, I start the bot after I enter, so commands do not work for me, therefore, I cannot test them.


Owner of GooCrew
GooCrew Worlds:
GooCrew Art World

Offline

#7 2015-07-19 06:57:33

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: GooBot Help Thread

It should get players who are  in the level already, unless you are doing it wrong.


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#8 2015-07-19 09:14:18

John
Member
Joined: 2019-01-11
Posts: 1,987

Re: GooBot Help Thread

>Ewoke: Don't spoon-feed code. How will he learn? I didn't learn to code from copy and pasting from a forum. Next time give him a task description. If you are going to spoon-feed, you should possibly take a screenshot so he has to type it manually. (Which would help him learn.)

On Topic:
You should use a Dictionary to store your players, I find it useful and convenient.


PW?scale=2

Offline

Wooted by: (3)

#9 2015-07-20 05:57:20

Gooberg
Member
From: Andromeda Galaxy
Joined: 2015-02-26
Posts: 81

Re: GooBot Help Thread

Thanks everyone :3 I got it working, though now I am trying to find out how to have a bot command work like this for secret, hidden, or just non-spammy commands.

/pm gooberg123 [command variable here]

I have been reading up on it and watching tutorials and I have been getting help, I am aware I should use the write function in EE Information created by capasha.

Though I am not sure how to get this working.

Thanks again! ^^


Owner of GooCrew
GooCrew Worlds:
GooCrew Art World

Offline

#10 2015-07-20 07:19:01

Xfrogman43
Member
From: need to find a new home
Joined: 2015-02-15
Posts: 4,174

Re: GooBot Help Thread

Yes, you would use case "write":

Here's how you figure out what to do:

call string(0) first, and see what it produces, name that something easy for you to know. Do the same thing with the string(1). Go on from there.


zsbu6Xm.png thanks zoey aaaaaaaaaaaand thanks latif for the avatar

Offline

#11 2015-07-20 15:07:51

Gooberg
Member
From: Andromeda Galaxy
Joined: 2015-02-26
Posts: 81

Re: GooBot Help Thread

Xfrogman43 wrote:

Yes, you would use case "write":

Here's how you figure out what to do:

call string(0) first, and see what it produces, name that something easy for you to know. Do the same thing with the string(1). Go on from there.

Thank you, I will start trying to get this working.


Owner of GooCrew
GooCrew Worlds:
GooCrew Art World

Offline

#12 2015-07-20 23:45:40

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: GooBot Help Thread

Emalton wrote:

>Ewoke: Don't spoon-feed code. How will he learn? I didn't learn to code from copy and pasting from a forum. Next time give him a task description. If you are going to spoon-feed, you should possibly take a screenshot so he has to type it manually. (Which would help him learn.)

On Topic:
You should use a Dictionary to store your players, I find it useful and convenient.

some people learn by doing, others learn by reading on how to do it. ill use the screenshot method next time //forums.everybodyedits.com/img/smilies/wink


if you can read this....good for you

Offline

ewoke1437432340523158

Board footer

Powered by FluxBB

[ Started around 1715761969.7823 - Generated in 0.078 seconds, 10 queries executed - Memory usage: 1.53 MiB (Peak: 1.71 MiB) ]