Send arguments with messages

A feature I’d like to see in Hopscotch is:

When you send a message you can include some variables that could be used in the rule that listens for a message

I’d use it for this type of project:

Literally every type of project

Here are some examples of Hopscotch code that could be improved if we had this:

  • Telling some object to move to someplace different
  • Sending user input to the player character
  • Asking (and answering) “What is the closest object to this point?” and similar questions
18 Likes

Marvelous idea! This could be used to detect if an enemy is close by, and then it could give a warning. Now that I think about it, I believe there is already a topic like this. I seem to have forgotten what it’s called, though.

2 Likes

Isn’t that just like:

Object 1: when{something}happens:
Broadcast message{something}
Set {:iphone: variable} to {something}

Object 2: when I get a message{content of message}:
check once if {variable} = {something}

But good idea though… less code would be needed and then, the loading time will be less!

2 Likes

Yes, that is how I do it now, and it works if you are using those variables only once per frame. But what if you have many objects, and you send messages to a specific object by including a variable that is unique to that object in the message name? What if you do this to several objects at the same time? You can’t easily do that right now.

1 Like

Yeah… as I said, it would make it much easier!

1 Like

I like this idea.

1 Like