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 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

What is wrong here?

Hello what is wrong right here? I mean i typed world ID and my email, pass but the bot dont come to the world, i dont see it in minimap. It shows me console but nothing happens...

Im did everything that http://nimg.pf-control.de/BBtutorial/tut1.php said so...

This is code...

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="8cfae5f8ede0e5e6f9ffbdbacce5e2eee3f4a2e0f8">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website         }     } }


wn7I7Oa.png

Offline

#2 Before February 2015

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

Re: What is wrong here?

What you have to do is send 'init1' and 'init2', I'll show you how.

After the line

//For this, it gets the newest version from Krock's website

Add this:

con.OnMessage += new MessageReceivedEventHandler(onMessage); con.Send("init"); con.Send("init2");

So your code will be like this:

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="0b7d627f6a6762617e783a3d4b626569647325677f">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2")         }     } }

The tutorial doesn't mention it, but when you do 'Next Step', it stands there.

Well, I hope this helps. //forums.everybodyedits.com/img/smilies/smile Have fun programming your bot. //forums.everybodyedits.com/img/smilies/wink
912468


vF0MA5o.png

Offline

#3 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: What is wrong here?

912468 wrote:

What you have to do is send 'init1' and 'init2', I'll show you how.

After the line

//For this, it gets the newest version from Krock's website

Add this:

con.OnMessage += new MessageReceivedEventHandler(onMessage); con.Send("init"); con.Send("init2");

So your code will be like this:

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="c8bea1bca9a4a1a2bdbbf9fe88a1a6aaa7b0e6a4bc">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2")         }     } }

The tutorial doesn't mention it, but when you do 'Next Step', it stands there.

Well, I hope this helps. //forums.everybodyedits.com/img/smilies/smile Have fun programming your bot. //forums.everybodyedits.com/img/smilies/wink
912468

The name 'onMessage' does not exist in the current contextogram.cs      48      62      ConsoleApplication3

EDIT: Fixed, thanks!

Last edited by Vitalijus (Dec 11 2014 1:19:01 pm)


wn7I7Oa.png

Offline

#4 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: What is wrong here?

Vitalijus wrote:
912468 wrote:

What you have to do is send 'init1' and 'init2', I'll show you how.

After the line

//For this, it gets the newest version from Krock's website

Add this:

con.OnMessage += new MessageReceivedEventHandler(onMessage); con.Send("init"); con.Send("init2");

So your code will be like this:

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="62140b16030e0b0817115354220b0c000d1a4c0e16">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2")         }     } }

The tutorial doesn't mention it, but when you do 'Next Step', it stands there.

Well, I hope this helps. //forums.everybodyedits.com/img/smilies/smile Have fun programming your bot. //forums.everybodyedits.com/img/smilies/wink
912468

The name 'onMessage' does not exist in the current contextogram.cs      48      62      ConsoleApplication3

EDIT: Fixed, thanks!

Now can I ask how I can make that bot could answer the player with their names like...

Jake: !hi
Bot: Hello, Jake.


wn7I7Oa.png

Offline

#5 Before February 2015

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

Re: What is wrong here?

Vitalijus wrote:

Now can I ask how I can make that bot could answer the player with their names like...

Jake: !hi
Bot: Hello, Jake.

Note that that you use a console and I use a form. This may give some errors... Just tell me, and I'll try to fixe these.

First of all we have to save the players that join the room, so you will have to add a Dictionair. (I will write the whole code at the end.) This may seem difficult, but when you know it it is pretty easy. //forums.everybodyedits.com/img/smilies/wink

After these two lines:

Client cli; Connection con;

Add this

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

Next, you have to add a player to the dictionair when they join. You have to use your OnMessage for that one.
Whenever a player joins, PlayerIO will send you a message with the name (type) 'add'

private void onMessage(object sender, PlayerIOClient.Message m)         {              if (m.Type == "add")              {                   players.Add(m.GetInt(0), m.GetString(1));              }         }

You have to check wether someone said '!hi' in chat. When someone says something in chat, playerIO sends a message (like the 'add' one). The type of the message is "say". (pretty obvious).

if (m.Type == "say")     {      }

So, inside this if-statement, we can check if the person said '!hi'. (you can use m.GetString(1) for that)

if (m.GetString(1) == "!hi")     {      }

And that we can send a message to that speciffic player. (You get the name by doing player[m.Getint(0).)

con.Send("say", "Hello, " + players[m.Getint(0)]);

--------------------------------------------------------------
The whole code

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;         Dictionary<int, string> players = new Dictionary<int, string>();          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="82f4ebf6e3eeebe8f7f1b3b4c2ebece0edfaaceef6">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2")         }         private void onMessage(object sender, PlayerIOClient.Message m)         {              if (m.Type == "add")             {                   players.Add(m.GetInt(0), m.GetString(1));             }             else if(m.Type == "say")             {                  if (m.GetString(1) == "!hi")                      {                           con.Send("say", "Hello, " + players[m.Getint(0)]);                      }              }         }     } }

I hope you understand it and that your bot will be awesome. //forums.everybodyedits.com/img/smilies/wink By the way, you can get the EE Information (like the 'add' and the 'say' at this website by Capashe (this one is more complete) or at Crock's one. Look at this post how to use it.

912468

[EDIT] Added the scource to get EE information.
[EDIT] Fixed error.

Last edited by 912468 (Dec 12 2014 4:02:05 am)


vF0MA5o.png

Offline

#6 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:

912468

[EDIT] Added the scource to get EE information.

I love you //forums.everybodyedits.com/img/smilies/smile <3
Edit: one more question... if i wanted to place blocks, i would have to add this (http://capasha.boards.net/post/6) code, right?
Could you please add this to the previous code , as i cant get it to work..
Thank you very much for the previous code too, it helped me alot!

Last edited by xDeviLx (Dec 11 2014 4:34:02 pm)

Offline

#7 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: What is wrong here?

xDeviLx wrote:
912468 wrote:

912468

[EDIT] Added the scource to get EE information.

I love you //forums.everybodyedits.com/img/smilies/smile <3
Edit: one more question... if i wanted to place blocks, i would have to add this (http://capasha.boards.net/post/6) code, right?
Could you please add this to the previous code , as i cant get it to work..
Thank you very much for the previous code too, it helped me alot!

This is console aplication not windows form


wn7I7Oa.png

Offline

#8 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: What is wrong here?

912468 wrote:
Vitalijus wrote:

Now can I ask how I can make that bot could answer the player with their names like...

Jake: !hi
Bot: Hello, Jake.

Note that that you use a console and I use a form. This may give some errors... Just tell me, and I'll try to fixe these.

First of all we have to save the players that join the room, so you will have to add a Dictionair. (I will write the whole code at the end.) This may seem difficult, but when you know it it is pretty easy. //forums.everybodyedits.com/img/smilies/wink

After these two lines:

Client cli; Connection con;

Add this

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

Next, you have to add a player to the dictionair when they join. You have to use your OnMessage for that one.
Whenever a player joins, PlayerIO will send you a message with the name (type) 'add'

private void onMessage(object sender, PlayerIOClient.Message m)         {              if (m.Type == "add")              {                   players.Add(m.GetInt(0), m.GetString(1));              }         }

You have to check wether someone said '!hi' in chat. When someone says something in chat, playerIO sends a message (like the 'add' one). The type of the message is "say". (pretty obvious).

if (m.Type == "say")     {      }

So, inside this if-statement, we can check if the person said '!hi'. (you can use m.GetString(1) for that)

if (m.GetString(1) == "!hi")     {      }

And that we can send a message to that speciffic player. (You get the name by doing player[m.Getint(0).)

con.Send("say", "Hello, " + players[m.Getint(0)]);

--------------------------------------------------------------
The whole code

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         //PlayerIO stuff         Client cli;         Connection con;         Dictionary<int, string> players = new Dictionary<int, string>();          string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="e0968994818c898a9593d1d6a0898e828f98ce8c94">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "...",             world_id = "PW9Zjz-rbZbkI";          public Engine()         {             //Gets called when creating a new Engine class              string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version, true, null, null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2")              private void onMessage(object sender, PlayerIOClient.Message m)             {                  if (m.Type == "add")                  {                       players.Add(m.GetInt(0), m.GetString(1));                  }                  else if(m.Type == "say")                  {                      if (m.GetString(1) == "!hi")                          {                               con.Send("say", "Hello, " + players[m.Getint(0)]);                          }                  }             }         }     } }

I hope you understand it and that your bot will be awesome. //forums.everybodyedits.com/img/smilies/wink By the way, you can get the EE Information (like the 'add' and the 'say' at this website by Capashe (this one is more complete) or at Crock's one. Look at this post how to use it.

912468

[EDIT] Added the scource to get EE information.

There were some errors, but I fixed them, thanks!


wn7I7Oa.png

Offline

#9 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

Vitalijus wrote:
xDeviLx wrote:
912468 wrote:

912468

[EDIT] Added the scource to get EE information.

I love you //forums.everybodyedits.com/img/smilies/smile <3
Edit: one more question... if i wanted to place blocks, i would have to add this (http://capasha.boards.net/post/6) code, right?
Could you please add this to the previous code , as i cant get it to work..
Thank you very much for the previous code too, it helped me alot!

This is console aplication not windows form

Well, how do I make my bot place blocks in a world then?

Last edited by xDeviLx (Dec 12 2014 4:03:14 am)

Offline

#10 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

if i wanted to place blocks, i would have to add this (http://capasha.boards.net/post/6) code, right?

Yes, this is the 'edit key'.

xDeviLx wrote:

Oh.... So how do i make my bot place blocks in a world then?

Just do this:

con.Send(worldkey, 0 or 1, X-value, Y-value, BlockID);

Where 0 or 1 is background(=1) or foreground(=0).
X-value and Y-value are the coordonates where you want to place that block.
You can get the block-ID here.
912468

Last edited by 912468 (Dec 12 2014 4:27:02 am)


vF0MA5o.png

Offline

#11 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:
xDeviLx wrote:

if i wanted to place blocks, i would have to add this (http://capasha.boards.net/post/6) code, right?

Yes, this is the 'edit key'.

xDeviLx wrote:

Oh.... So how do i make my bot place blocks in a world then?

Just do this:

con.Send(worldkey, 0 or 1, X-value, Y-value, BlockID);

Where 0 or 1 is background(=0) or foreground(=1).
X-value and Y-value are the coordonates where you want to place that block.
You can get the block-ID here.
912468

Yeah, i did that but here's what i get..
vnim3a.jpg

Offline

#12 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

Yeah, i did that but here's what i get..
http://oi59.tinypic.com/vnim3a.jpg

The problem is that you didn't add a value to your 'worldkey' string.

You should add this behind your dictionair:

static string worldkey;

Next, you should add a way to get the value of the key (add this behind your OnMessage):

static string derot(string arg1)         {             int num = 0;             string str = "";             for (int i = 0; i < arg1.Length; i++)             {                 num = arg1[i];                 if ((num >= 0x61) && (num <= 0x7a))                 {                     if (num > 0x6d) num -= 13;                     else num += 13;                 }                 else if ((num >= 0x41) && (num <= 90))                 {                     if (num > 0x4d) num -= 13;                     else num += 13;                 }                 str = str + ((char)num);             }             return str;         }

And finally, we have to add a way to receive the code (this goes inside the OnMessage):

if (m.Type == "init")     {     derot(m.GetString(5));     } }

If you want an example on this inside a bot, look here.

if you want to get just the 'derot', look here

If you want to see another tutorial, look here
I hope it worked. //forums.everybodyedits.com/img/smilies/smile
912468


vF0MA5o.png

Offline

#13 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:
xDeviLx wrote:

Yeah, i did that but here's what i get..
http://oi59.tinypic.com/vnim3a.jpg

The problem is that you didn't add a value to your 'worldkey' string.

You should add this behind your dictionair:

static string worldkey;

Next, you should add a way to get the value of the key (add this behind your OnMessage):

static string derot(string arg1)         {             int num = 0;             string str = "";             for (int i = 0; i < arg1.Length; i++)             {                 num = arg1[i];                 if ((num >= 0x61) && (num <= 0x7a))                 {                     if (num > 0x6d) num -= 13;                     else num += 13;                 }                 else if ((num >= 0x41) && (num <= 90))                 {                     if (num > 0x4d) num -= 13;                     else num += 13;                 }                 str = str + ((char)num);             }             return str;         }

And finally, we have to add a way to receive the code (this goes inside the OnMessage):

if (m.Type == "init")     {     derot(m.GetString(5));     } }

If you want an example on this inside a bot, look here.

if you want to get just the 'derot', look here

If you want to see another tutorial, look here
I hope it worked. //forums.everybodyedits.com/img/smilies/smile
912468

Well i did every single one of theese... at least i think... and it still doesnt work.
Here's the code:

using System; using System.Collections.Generic; using System.Text; using PlayerIOClient;  namespace MyBot {     class Program     {         static void Main(string[] args)         {             //Get rid off the static             new Engine();             //Do not close the window             Console.ReadLine();         }     }      class Engine     {         static string worldkey;         //PlayerIO stuff         Client cli;         Connection con;         Dictionary<int, string> players = new Dictionary<int, string>();         string login_email = "<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="e984888085a984888085c784888085">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>",             login_password = "pw",             world_id = "PWJqQlsJLvbEI";          public Engine()         {             //Gets called when creating a new Engine class             string EE_version = "";             System.Net.WebClient web_cli = new System.Net.WebClient();             try             {                 EE_version = web_cli.DownloadString("http://nimg.pf-control.de/bbk_data/ee_vers.txt");             }             catch             {                 EE_version = "dummy";             }              cli = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", login_email, login_password,null);             con = cli.Multiplayer.CreateJoinRoom(world_id, "Everybodyedits" + EE_version,true,null,null);             //CreateJoinRoom requires a valid room type to open a new world             //For this, it gets the newest version from Krock's website             con.OnMessage += new MessageReceivedEventHandler(onMessage);             con.Send("init");             con.Send("init2");         }          private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }         }         static string derot(string arg1)         {             int num = 0;             string str = "";             for (int i = 0; i < arg1.Length; i++)             {                 num = arg1[i];                 if ((num >= 0x61) && (num <= 0x7a))                 {                     if (num > 0x6d) num -= 13;                     else num += 13;                 }                 else if ((num >= 0x41) && (num <= 90))                 {                     if (num > 0x4d) num -= 13;                     else num += 13;                 }                 str = str + ((char)num);             }             return str;         }     } }

Offline

#14 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

Well i did every single one of theese... at least i think... and it still doesnt work.

Well, you didn't add the init part...
(I mean this)

if (m.Type == "init")     {     derot(m.GetString(5));     } }

Your OnMessage will look like this:

private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }             else if (m.Type == "init")             {                 derot(m.GetString(5));             }         }

912468


vF0MA5o.png

Offline

#15 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:
xDeviLx wrote:

Well i did every single one of theese... at least i think... and it still doesnt work.

Well, you didn't add the init part...
(I mean this)

if (m.Type == "init")     {     derot(m.GetString(5));     } }

Your OnMessage will look like this:

private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }             else if (m.Type == "init")             {                 derot(m.GetString(5));             }         }

912468

And after adding this, i'm still getting the same warning as before:
Field 'MyBot.Engine.worldkey' is never assigned to, and will always have its default value null

Offline

#16 Before February 2015

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: What is wrong here?

xDeviLx wrote:
912468 wrote:
xDeviLx wrote:

Well i did every single one of theese... at least i think... and it still doesnt work.

Well, you didn't add the init part...
(I mean this)

if (m.Type == "init")     {     derot(m.GetString(5));     } }

Your OnMessage will look like this:

private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }             else if (m.Type == "init")             {                 derot(m.GetString(5));             }         }

912468

And after adding this, i'm still getting the same warning as before:
Field 'MyBot.Engine.worldkey' is never assigned to, and will always have its default value null

Are u trying to give edit for saying "!hi" ?


wn7I7Oa.png

Offline

#17 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

And after adding this, i'm still getting the same warning as before:
Field 'MyBot.Engine.worldkey' is never assigned to, and will always have its default value null

I see what's wrong.

Try this:

private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }             else if (m.Type == "init")             {                 worldkey = derot(m.GetString(5));             }         }

It was my fault //forums.everybodyedits.com/img/smilies/big_smile sorry, I forgot to add 'worldstring =' //forums.everybodyedits.com/img/smilies/wink



Vitalijus wrote:

Are u trying to give edit for saying "!hi" ?

No, actually he/she is trying to place a block with a bot.
912468


vF0MA5o.png

Offline

#18 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:
xDeviLx wrote:

And after adding this, i'm still getting the same warning as before:
Field 'MyBot.Engine.worldkey' is never assigned to, and will always have its default value null

I see what's wrong.

Try this:

private void onMessage(object sender, PlayerIOClient.Message m)         {             if (m.Type == "add")             {                 players.Add(m.GetInt(0), m.GetString(1));             }             else if (m.Type == "say")             {                 if (m.GetString(1) == "!hi")                 {                     con.Send(worldkey, 0, 5, 5, 11);                 }             }             else if (m.Type == "init")             {                 worldkey = derot(m.GetString(5));             }         }

It was my fault //forums.everybodyedits.com/img/smilies/big_smile sorry, I forgot to add 'worldstring =' //forums.everybodyedits.com/img/smilies/wink



Vitalijus wrote:

Are u trying to give edit for saying "!hi" ?

No, actually he/she is trying to place a block with a bot.
912468

I was actually trying to place a block for saying "hi!"
And thank you once again.. It workted P-E-R-F-E-C-T-L-Y, just the way I wanted it to!
I dont exactly know how some parts of this code actually operate, but i do know some things, so if anyone needs
any -> logical help, feel free to ask.
Btw, here's the code for the bot placing blocks sorted by ID's [ascending 1 for each next block, so there are some empty spaces meaning that there is no block with that id] at (3,3) to (13,3), and then from (4,3) to (4,13) etc.

if (m.GetString(1) == "!start")                 {                     x = 3; //start from x = 3                     y = 3; //start from y = 3                     for (int blokq = 0; blokq < 10; blokq++) // repeat this step 10 times (for +1 y axis)                     {                         for (int blokw = 0; blokw < 15; blokw++) // repeat 15 times (for +1 x axis)                         {                             blok++; // ascend block value each time it puts one block in the world                             con.Send(worldkey, 0, x, y, blok); // put block in the world (worldkey,foreground, x axis, y axis, block value)                             x++;  //ascend x axis value                             System.Threading.Thread.Sleep(50); //wait 50 milisecounds (so you see block getting placed progressively)                         }                         System.Threading.Thread.Sleep(200); //wait 200 secounds so the rows dont get spammed (just for visual effect)                      y++; // ascend y axis (go to next row)                      x = 3; // make x axis = 3 ( start over from the beggining of the row)                     }                 }

code result; nm0tvp.jpg

Last edited by xDeviLx (Dec 12 2014 2:48:37 pm)

Offline

#19 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

And thank you once again.. It workted P-E-R-F-E-C-T-L-Y, just the way I wanted it to!

Nice that your bot worked! //forums.everybodyedits.com/img/smilies/wink
912468


vF0MA5o.png

Offline

#20 Before February 2015

Ang3L
Member
Joined: 2015-06-13
Posts: 121

Re: What is wrong here?

912468 wrote:
xDeviLx wrote:

And thank you once again.. It workted P-E-R-F-E-C-T-L-Y, just the way I wanted it to!

Nice that your bot worked! //forums.everybodyedits.com/img/smilies/wink
912468

Just one more question... I get all of the commands and stuff, but how would i make the bot 'memorize' data?
Because lets say, i would want the bot to track player's wins, and each time a player wins to add it to player's total win count, and that the win counts get preserved even after the bot goes offline...
Where would i store that data? In a .txt file, excel? What's the easyest way to do it for multiple players?

Offline

#21 Before February 2015

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

Re: What is wrong here?

xDeviLx wrote:

Just one more question... I get all of the commands and stuff, but how would i make the bot 'memorize' data?
Because lets say, i would want the bot to track player's wins, and each time a player wins to add it to player's total win count, and that the win counts get preserved even after the bot goes offline...
Where would i store that data? In a .txt file, excel? What's the easyest way to do it for multiple players?

I could explain it here, bu I found a good link which says how to store data to a file.

912468


vF0MA5o.png

Offline

Vitalijus1423758844202588

Board footer

Powered by FluxBB

[ Started around 1714801254.9527 - Generated in 0.160 seconds, 12 queries executed - Memory usage: 1.91 MiB (Peak: 2.25 MiB) ]