How to send three separate number values in a single frame

So, I have to send the position of a player from a specific detector object to it’s parent enemy object. I have this set up such that the detector objects (which are emitted from the enemy objects) have a starting value that is the same as its parent (this number can be anything from 0 to infinity, or whatever flowlab’s maximum number count is), so in order to ensure the orb sends the message to the right parent object, it sends it’s starting value to the enemy, which compares the detector starting value to the enemy starting value to make sure they are the same. My problem is trying to send the position information using this system. The way I previously had it was that the detector object would just simply send two messages to the enemy object, the player’s X position and the player’s Y position (both of which can also be anything from 0 to infinity), but that doesn’t work anymore when there are multiple enemies. This problem is further complicated by the fact that all of the required information (the player’s position and the starting value) has to be sent and processed simultaneously, within a single frame or less because all of the other detector objects are ALSO going to be sending their messages at the same time with all of their information. Does anyone know of a way that I could send all of this information within a single message while also making it possible to separate out all of the necessary information and pass it through a filter before another message can come in (potentially during the exact same frame)? I feel like @CodeAlpaca might know, because I think it is going to end up having something to do with doing some weird text conversions or something, maybe.

you could simply just send 3 messages to the object

1 Like

But wouldn’t the other messages being sent at the same time interfere with that? The position messages need to be directly associated with the Starting value information to make sure that it goes to the right enemy, but if another detector sends its own position information or its own starting value at the same time, it could cause everything to mess up

no

1 Like

Multiple numbers can go through at one time, so if you send 3 inputs at once to a router set to randomize it will go through 3 different outputs (I think, I haven’t actually needed to use the randomize feature)

1 Like

Ok, but it needs to not be random. I need one detector’s information to be processed before any other numbers go through the message, because these numbers will be going into a filter that decides whether or not the enemy is receiving information from the right detector object, and if it is then it turns on a switch that allows for the following position information to go through and be processed. If information from a different detector object happens to slip through into the wrong enemy object, it could break the entire game, hence the need for it to be instantaneous and/or all connected in a single message. I’ve had an idea that I think might solve the problem, although I’m not entirely sure of the best way to implement it. If I add one to all of the numbers and then convert them all to binary code, then combine them all into a text block, andI can use “00000000” as a separator, because there wouldn’t be any numbers that include that exact string. Then I can convert this into a number and send it through the message and then convert it back into the original numbers once it all gets to the enemy, allowing it to all be processed simultaneously. However, this brings up the problem that many of the numbers will probably be larger than 256, so simple 8 bit binary won’t work properly. I can use 16 bit binary, and just accept that the game will break after level 500, but I just realized that it will be possible for the numbers to end up having that separator string at that point. For instance, 1000000000000000 (32768), followed by 0000000000000000 (the separator), followed by 0100011010000000 (18084) would end up being read as 1, 0000000000000000, 100011010000000, which completely changes the numbers. However, I also just realized that I could make it split every 16 characters and just make sure that I fill the beginning with 0’s if need be. This would solve that problem, I think. I don’t know, just brainstorming right now. I already have the code written to convert the numbers into binary (it was actually surprisingly easy), now I just have to figure out how to get it formatted properly and make sure that they end up in the correct order and have the correct amount of characters.

In Alpaca Raceway I have a ton of objects send their rotation, position, and if they have an edge at the exact same time and it works fine. I gave the example with the router to say that it would process each one. If you have a switch that needs to be turned on by the first thing it processes that will work fine.

I would send a Global like a message, sending text data like 256-16-32.
You can split “-” and get each number.

depending on the system a global might not work, but from what you said of your system it seems like it should work.

Or you could send a message with a specific combination and you can use an expression to split the digits into the numbers you need. If you do this method, I suggest to always leave a 1 in front of the combined number.

For example:
1 256 016 032 or 1256016032

Expression:
(A+"").substr(A,B)
A = Index, B = Length

(A+"").substr(1,3) = 256
(A+"").substr(4,3) = 016 = 16
(A+"").substr(7,3) = 032 = 32

image

3 Likes