A variable in a when message matches/when I get message rule which contains the message it is responding to
I’d use it for this type of project:
If you have a tower which you want to find the closest enemy within its range, it could send a message asking for it, and then the response could be sent back in another message. It would be easier to code and read if you include things like the tower’s position, range, and instructions on responding in the message itself, but without this we can’t get it from the message when we respond to it now… Even if we do get this suggestion, it wouldn’t be as easy to read as if we had Replace something with something in string, which can probably be easily enough used instead of this, so definitely add that as soon as you can.
Here are some examples of Hopscotch code that could be improved if we had this:
If you have a tower which you want to find the closest enemy within its range, it could send a message asking for it, and then the response could be sent back in another message. It would be easier to code and read if you include things like the tower’s position, range, and instructions on responding in the message itself.
You can already respond, what this would allow mostly is the ability to send a message like “find closest enemy to x: 100 y: 100” and the responding object would be able to know what x and y it is supposed to find the closest enemy ot.
Basically
You know the when matches message block right?
You can’t access exactly what message you got
This variable will give you exactly that: what message you got
A simple use-case would be messages like “speed=150” intended to control a swarm of clones. They have a “When Message Matches” rule with regex “speed=[0-9]+”, but then what? The message string is not available for further parsing, so how do they learn what speed to change to?
RIght now, I think you have to add more variables that will be read upon getting messages to tell you to read them, but that’s super clumsy: the number of variables has to match all the kinds of messages you’d send, which is a pain to maintain.
@Petrichor when you have these kinds of good ideas, and then nothing happens with them, what do you do? I hope you don’t give up.