Jump to content

How do bots communicate to each other?


Zor

Recommended Posts

34 minutes ago, Zor said:

So I was thinking about it and the only way I can think of is to have bot1 write to a text file. And have bot2 reading that text file. Is that how most people make auto muling etc or how is it done? (I am new to scripting so I may just not know of some easy method)

This would lead to race conditions, so it would probably not work.

  • Like 1
Link to comment
Share on other sites

38 minutes ago, Zor said:

So I was thinking about it and the only way I can think of is to have bot1 write to a text file. And have bot2 reading that text file. Is that how most people make auto muling etc or how is it done? (I am new to scripting so I may just not know of some easy method)

That's how I deal with it for now, not the best way but definitely works.

Link to comment
Share on other sites

30 minutes ago, Vilius said:

As @Alek said having multiple threads write/read one file would create a data race. You could setup a server which would communicate with the clients over sockets and such. This would eliminate that because a server could handle the data requests accordingly.

 

19 minutes ago, MalikDz said:

Client/server networking

Clients (bots) send data to the server and according to the data received, server will send back directive for the client to execute.

Can you actually allow socket permissions thru CLI? I know it's blocked by default

  • Like 1
Link to comment
Share on other sites

It sort of depends on what you're communicating.

If I had 10 bots all running on the same machine and I required them to communicate locally, then I'd do one of the following:

  • In-game clan chat/direct messaging. This is the simplest method to implement which removes any other external dependencies (like hosting server). However, you risk exposing your entire bot network to JaGeX.
  • Sockets and ports. This is by far the best method, because you can communicate on a local network and public network. However, I'm not sure OSBot enables this.
  • External SQL servers. This is good if you have multiple networks that need a single place to communicate. However, you risk the server breaking and going offline, or being hacked.
  • Flat-files per bot. Good if you need simple local communication only. However, race conditions (as @Alek mentioned) will be a problem.

 

I'd probably go with flat files:

Each bot would create a flat file. The bot that owns that file is the only bot permitted to write to said file. The bot has read-only permissions for the other bot's files.

The bot would write communications in JSON format:

[
	{ "when":3424310251234, "to":"someRandomUsername2", "from":"someRandomUsername1", "what":"Hi!" },
	{ "when":3424310276666, "to":"someRandomUsername2", "from":"someRandomUsername1", "what":"Awesome!" }
]

Implement a file system listener to check for newly created/updated files, then require all (except the bot that created/updated the file) to read it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...