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.
Pages: 1
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 } } }
Offline
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. Have fun programming your bot.
912468
Offline
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.
Have fun programming your bot.
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)
Offline
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.
Have fun programming your bot.
912468The 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.
Offline
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.
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. 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)
Offline
912468
[EDIT] Added the scource to get EE information.
I love you <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
912468 wrote:912468
[EDIT] Added the scource to get EE information.
I love you
<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
Offline
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.
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 codeusing 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.
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!
Offline
xDeviLx wrote:912468 wrote:912468
[EDIT] Added the scource to get EE information.
I love you
<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
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'.
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)
Offline
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..
Offline
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.
912468
Offline
xDeviLx wrote:Yeah, i did that but here's what i get..
http://oi59.tinypic.com/vnim3a.jpgThe 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.
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
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
Offline
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
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" ?
Offline
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 sorry, I forgot to add 'worldstring ='
Are u trying to give edit for saying "!hi" ?
No, actually he/she is trying to place a block with a bot.
912468
Offline
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 nullI 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
sorry, I forgot to add 'worldstring ='
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;
Last edited by xDeviLx (Dec 12 2014 2:48:37 pm)
Offline
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!
![]()
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
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
Offline
Pages: 1
[ Started around 1743859356.3078 - Generated in 0.184 seconds, 10 queries executed - Memory usage: 1.92 MiB (Peak: 2.26 MiB) ]