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-09-03 06:41:23

NovaEx
Member
From: Two Steps From Hell
Joined: 2015-08-09
Posts: 136
Website

Get system text with a bot?

I'm trying to make a bot that gets the players position, with perhaps /getpos, and then teleports them 200 units up, after they give a command.

Does #say work for system text? And if it does not, how else can I get a player's position without the user doing anything?

Offline

#2 2015-09-03 10:02:15, last edited by Zumza (2015-09-03 10:04:28)

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

Re: Get system text with a bot?

When you send a "say" message with the argument "/getups <player>" you receive a PlayerIO message with the type "write".
http://capasha.com/eeinformation.php#write
write: [0] title
         [1] message
In your case the title would be "*System" and the message  will be something like "is located at 10x10" which you have to parse it.
And yes the "/getpos" works without player moving too.
If you don't have access to room commands you would need an EE Physics engine to calculate player position. Processor made an SDK which contains it:
http://botbits.yonom.org


Everybody edits, but some edit more than others

Offline

#3 2015-09-03 13:59:12

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

Re: Get system text with a bot?

Zumza wrote:

When you send a "say" message with the argument "/getups <player>" you receive a PlayerIO message with the type "write".
http://capasha.com/eeinformation.php#write
write: [0] title
         [1] message
In your case the title would be "*System" and the message  will be something like "is located at 10x10" which you have to parse it.
And yes the "/getpos" works without player moving too.
If you don't have access to room commands you would need an EE Physics engine to calculate player position. Processor made an SDK which contains it:
http://botbits.yonom.org

This won't work.
In the new update, /getpos is a client-sided command, meaning that if your bot doesn't keep track of the player positions, it won't return anything but an error. (just tested it)

The solution to this would be to intergrate EE inside the bot and somehow communicate between your bot and the .swf, in case you manage to pull this off, I would love to know more information on how to do it.

Offline

#4 2015-09-03 15:03:47

Processor
Member
Joined: 2015-02-15
Posts: 2,246

Re: Get system text with a bot?

It depends on how accurate you want things to be. You can get a player's location inaccurately by saving their location whenever they move. This value might be outdated because the players might have been in free fall / getting pushed by arrows etc. If the move locations arent percise enough for you, you should look into simulating physics:

den3107 wrote:

The solution to this would be to intergrate EE inside the bot and somehow communicate between your bot and the .swf, in case you manage to pull this off, I would love to know more information on how to do it.

No need to think so complicated. //forums.everybodyedits.com/img/smilies/tongue Just a simulation of EE physics is enough, and there are C# implementations of it available.

Quick tutorial using BotBits (Just like Zumza pointed out)
1. Install BotBits from NuGet (http://botbits.yonom.org/tutorials/setup)
2. Install BotBitsExt.Physics from NuGet
3. Get a player's location using:

Point location = player.GetExactPosition();
int blockX = WorldUtils.PosToBlock(location.X);
int blockY = WorldUtils.PosToBlock(location.Y);
Console.WriteLine("{0}x{1}", blockX, blockY);

I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.

Offline

Wooted by:

#5 2015-09-03 18:44:42

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

Re: Get system text with a bot?

Processor wrote:

No need to think so complicated. //forums.everybodyedits.com/img/smilies/tongue Just a simulation of EE physics is enough, and there are C# implementations of it available.

My experience tells me they're quite slow at simulating graphics, besides they aren't as accurate.
Them being so slow could've also been because of my laptop, because I couldn't draw at a 10ms delay either (which I can do now).

Long story short: if it would be possible to communicate to the swf through a bot many things could be done, not just more reliable but also faster.

Offline

#6 2015-09-03 19:28:46

Processor
Member
Joined: 2015-02-15
Posts: 2,246

Re: Get system text with a bot?

There have been some inaccuracies with physics in the past, but a lot of them have been fixed recently. Due to the way they are written, they shouldn't be any slower than the game itself (they are both system-time based).

It is possible (with a ton of hacks) to "communicate" with the SWF, but it will be neither more reliable nor faster. Not even worth trying.

---

Off-topic:

den3107 wrote:

Them being so slow could've also been because of my laptop, because I couldn't draw at a 10ms delay either (which I can do now).

Due to the way windows API behaves ("Thread.Sleep(10)" means wait AT LEAST BUT NOT EXACTLY 10ms) it is not reliable to use it.
Many programs do in fact raise the timer resolution but your bot probably didn't. Even with a low timer resolution, it is possible that you end up waiting longer due if the CPU is busy. That's why you should always use a timer and calculate the time past since the last time your timer ticked.
My bot framework BotBits for example, does this and places 100 blocks a second even on overloaded CPUs.


I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.

Offline

#7 2015-09-03 22:08:06

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

Re: Get system text with a bot?

Processor wrote:

There have been some inaccuracies with physics in the past, but a lot of them have been fixed recently. Due to the way they are written, they shouldn't be any slower than the game itself (they are both system-time based).

It is possible (with a ton of hacks) to "communicate" with the SWF, but it will be neither more reliable nor faster. Not even worth trying.

---

Off-topic:

den3107 wrote:

Them being so slow could've also been because of my laptop, because I couldn't draw at a 10ms delay either (which I can do now).

Due to the way windows API behaves ("Thread.Sleep(10)" means wait AT LEAST BUT NOT EXACTLY 10ms) it is not reliable to use it.
Many programs do in fact raise the timer resolution but your bot probably didn't. Even with a low timer resolution, it is possible that you end up waiting longer due if the CPU is busy. That's why you should always use a timer and calculate the time past since the last time your timer ticked.
My bot framework BotBits for example, does this and places 100 blocks a second even on overloaded CPUs.

Thanks a lot for both pieces on information! Will try it out for the next version of my bot... See if it improves...

Offline

den31071441314486538201

Board footer

Powered by FluxBB

[ Started around 1714249133.4682 - Generated in 0.061 seconds, 13 queries executed - Memory usage: 1.49 MiB (Peak: 1.64 MiB) ]