Message passing and addressing

I think the confusion lies in the difference between the file name and the address name of the collection. Those are two separate things. The file name doesn’t matter. The name of the collection that matters for addressing is in the properties panel, if you click on the “Collection” object at the top of the outline.

Having this URL:

main:/codebreaker/level_go#script

means your collection is not named “level”, it’s named “codebreaker”.

They’re in the same bootstrap collection, so you can remove “main:”. So " /codebreaker/level_go#script" should work.

Since you’re trying to go “up” one level (to access an object in the parent collection), you can’t use relative addressing. So I think you have two options:

  1. Make sure the collection is always named “codebreaker” and hard-code in that address.

  2. Since the keypad is in a sub-collection and can be addressed relatively from “level_go”, reverse the first message. Have the script on “level_go” send a message to “keypad/keys#keypad” to “subscribe” to keypad input. The keypad takes the sender URL for that message and saves it to use later (so, like Alex says, you never care what the URL actually is).

5 Likes