You cannot lock them until a certain transaction exists. However, what you can do is have a script can only be spent from when a certain secret is known. That secret could be published in another transaction.
Interesting.
Which opcodes are involved in this "lock-until-secret-published" strategy? Is this P2SH?
I'd love to learn more about this.
The address to lock the coins in is a p2sh address.
The script itself may look something like:
OP_SHA256 <sha256(secret)> OP_EQUALVERIFY
<pubkey> OP_CHECKSIG
This would mean that the person who is spending it must own the private key for the <pubkey> and must know the secret so that when the secret is put through the SHA256 hash, you get <sha256(secret)>.