Tinderbox Forum

Linking only to aliases inside two agents

Dear all,
I have the following structure:

---originals
------1
------2
------3
---agent1
------1
------2
------3
---agent2
------1
------2
------3

The two agents pull aliases from the same notes inside the originals container, and I am trying to get some aliases inside agent1 to link only to some aliases inside agent1; and the same for agent2 – this depending on the value of a certain variable ($var).

I’m trying with the following action code inside the agents:

if($IsAlias & $var){$var.each(listValue){linkTo(find(inside("agent1") & $IsAlias & $Name==listValue),"var");};};

if($IsAlias & $var){$var.each(listValue){linkTo(find(inside("agent2") & $IsAlias & $Name==listValue),"var");};};

However, for example, alias “1” inside “agent1” connects to alias “3” inside “agent1” AND ALSO to alias “3” inside “agent2” and I’d like to keep things independent. Something is missing here, all help appreciated.

Thanks!

inside() has an an expansive meaning (see here). so rather than this:

Try:

$Name(parent)=="agent1"

noting the $Name(parent) are different values for an alias and its original note. Thus:

linkTo(find($Name(parent)=="agent1" & $IsAlias & $Name==listValue),"var");

Given all the moving parts here, it might be useful if you posted a small reference TBX so we could test against a common baseline. Anyway, I hope that helps…

Thank you Mark. Wasn’t aware of the expansive meaning, that was the problem. $Name worked great. I’m posting the sample TBX file with this working for future reference.

in short: agent1 and agent2 collect two different sets of events from EVENTS(originals) and acts on the aliases linking them to the value of their $link list-based attribute. Now agent1 no longer links to aliases inside agent2 (and vice-versa).

Thanks once again!

linking_only_to_aliases_inside_two_agents.tbx (65.2 KB)

1 Like