Stamp for toggling agents


(Mark Anderson) #1

In discussion off-forum a Tinderbox user asked, how can I toggle agent’s on/ff with a stamp. So:

if($AgentPriority==-1){
   $AgentPriority=;
   $NameStrike=;
}else{
   $AgentPriority=-1;
   $NameStrike=true;
}

Notes:

  • If an agent is ‘off’ it is reset to the default, i.e. ‘on’ at normal priority, and the strike-through of $Name is reset.
  • If an agent is ‘on’, it is set to off and its title is struck-though.
  • Turning an agent ‘off’ doesn’t (by design) remove all the aliases in the agent. If you do want to the latter, you’ll need to select the aliases and delete them manually.

Thus, here ‘agent1’ is running and ‘agent2’ is turned off:

agent-toggle1

You don’t have to use strike-though. you could use $Color or a $Badge instead. However, unless your eyesight is good it can be hard to quickly assess agent state just from the note icon (and that icon isn’t used in Map view, anyway).

The question came back, “Can’t I just stamp the container, as wouldn’t that affect all the agents in it?”. Actually, “No”. But there is a way"

if($AgentPriority==-1){
   $AgentPriority=;
   $NameStrike=;
   $AgentPriority(children)=;
   $NameStrike(children)=;
}else{
   $AgentPriority=-1;
   $NameStrike=true;
   $AgentPriority(children)=-1;
   $NameStrike(children)=true;
}

Thus, all ‘on’ - by stamping just the container:

agent-container-toggle1

All ‘off’:

agent-container-toggle2

All off, container collapsed - note how the strike-through helps indicate state:

agent-container-toggle3

From the images, which just use 2 agents this might seem like overkill, but if you’ve say 10 agents, then a stamp like this begins to make sense.

Notes:

  • In the second example, the state for agents is taken from the $AgentPriority in the parent container although the latter attribute has no other effect on the parent. thus is an individual agent is turned on/off discretely from its siblings the toggle will put them all back in alignment in terms of on/off state.
  • Any child notes, as opposed to agent, will have their $AgentPriority set (to now effect) and the title strike-through will be affected.

I hope that helps those beginning to use larger numbers of agents and wondering how to control their state.