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-08-13 22:23:38

soulrunner
Member
Joined: 2015-03-10
Posts: 185

[HELP] Multi Client Difference

How would I separate the different clients from each other so they do different things. This is probably something easily easy but... I'm a scrub.
Here's my connection code :

static void Main(string[] args)
        {
            try
            {
                //Don't forget to set up PlayerIO.
                string worldId = "PWVANwQ-Vwb0I";
                #region pass 
                client = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "s************[email protected]"/* email */, "THECORRECTPASSWORDGOESHERE"/* password */, null);
                #endregion
                string serverVersion = (worldId.StartsWith("BW") ? "Beta" : "Everybodyedits") + client.BigDB.Load("config", "config")["version"];
                connection = client.Multiplayer.CreateJoinRoom(worldId, serverVersion, true, null, null);
                connection.OnMessage += OnMessage;
                connection.Send("init");
                string worldId2 = "PWsj-y71kMbEI";
                #region pass 
                client = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "[email protected]"/* email */, "botaccount"/* password */, null);
                #endregion
                connection = client.Multiplayer.CreateJoinRoom(worldId2, serverVersion, true, null, null);
                connection.OnMessage += OnMessage;
                connection.Send("init");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }

l141.gif

Offline

#2 2015-08-13 22:32:39

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: [HELP] Multi Client Difference

Hmm was someone else that requested the same. Use lists, dictionary or array for the connections.

Offline

Wooted by:

#3 2015-08-13 23:02:16

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [HELP] Multi Client Difference

Yeah, that'll be fun to sort out. Regardless of how you manage, the one thing you can't do is overwrite your connection reference (which you did)
You could create a new variable or something.

Offline

#4 2015-08-14 01:01:07

Anch
Member
Joined: 2015-02-16
Posts: 5,447

Re: [HELP] Multi Client Difference

Account info leaked

Offline

Wooted by:

#5 2015-08-14 11:55:02, last edited by AlphaJon (2015-08-14 12:04:08)

AlphaJon
Member
From: Who knows
Joined: 2015-07-21
Posts: 1,297

Re: [HELP] Multi Client Difference

You are putting this piece of code twice:

connection.OnMessage += OnMessage;

Like capasha said, use a an array, a list or whatever you like using to store multiple data,(or different variables for the 2 connections), then set the second one to be linked to a different OnMessage, something like

connection2.OnMessage += OnMessage2;

Offline

#6 2015-08-14 11:58:05

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [HELP] Multi Client Difference

Would it be possible to use the same function for the onmessage? I'm thinking yes. (but haven't tried)

Then you won't have to create 50 of teh same function for no reason!

Offline

#7 2015-08-14 12:05:58

AlphaJon
Member
From: Who knows
Joined: 2015-07-21
Posts: 1,297

Re: [HELP] Multi Client Difference

hummerz5 wrote:

Would it be possible to use the same function for the onmessage? I'm thinking yes. (but haven't tried)

Then you won't have to create 50 of teh same function for no reason!

It should behave normally if you bind all connections to the same OnMessage(not tested), but I'm giving him this solution because he wants to make 2 different scripts.

Offline

#8 2015-08-14 17:14:27

soulrunner
Member
Joined: 2015-03-10
Posts: 185

Re: [HELP] Multi Client Difference

anch159 wrote:
Account info leaked

super legit account info that has all the blocks and everything on here.


l141.gif

Offline

#9 2015-08-14 18:56:26

Different55
Forum Admin
Joined: 2015-02-07
Posts: 16,575

Re: [HELP] Multi Client Difference

Locked on request of owner.


"Sometimes failing a leap of faith is better than inching forward"
- ShinsukeIto

Offline

Different551439574986530444

Board footer

Powered by FluxBB

[ Started around 1732468194.3892 - Generated in 0.155 seconds, 12 queries executed - Memory usage: 1.46 MiB (Peak: 1.61 MiB) ]