Hello Tread,
I think the problem here is that you're a bit confused about the domain of logic and the templating language as a whole.
The template language is NOT php, and is simplistic by design in order to keep logical operations as abstracted as possible (in their appropriate php classes, where they belong).
A simple equality evaluation is usually possible though. So part of the issue is likely just syntactical - as this is not php, the parentheses are not required (if you are not passing any parameters).
If a reference turns out to be an executable, the template processor will execute it to get the value.
You simply need $getAgent or even just $Agent (the 'get' part is __magic).
I cannot say for sure without getting some hints on your data structure, but it looks like you're trying something along the lines of:
function getAgent() { return $anObject; }
function getAgents() {return $keyedArray; }
foreach(getAgents() as $key => $value) {
if($value == getAgent())
//...
}
Which has several problems with it, because ViewableData goes into (is supplied to) the template, again, not php.
If my above assumption is (loosely) correct, you probably also need $Up or $Top, making $Up.Agent to break out of the loop scope.
Loop iterates through a list like foreach, but unlike foreach it also changes SCOPE to the current item (sort of like this in javascript, most notable in jquery collections)
It seems likely by the names of your variables that getAgent is probably redundant as you should be on the current agent as per the list returned by getAgents.
As just explained, each iteration you are in the scope of that agent already.
This would mean that $key and $value are properties of the $Agent (ie, $Agent->key / Agent.value)
To me it makes more sense on say, if I'm signed in as an Actor or something viewing a page that lists agents
<% loop $Agents %>
<% if $Me == $Top.MyAgent %>
...
<% end_if %>
<% end_loop %>
Where $Me is analogous to $this in php.
Hope that clears things up a bit (again, all provided my wild assumptions are correct. if not, I hope they're understandable enough to be ok examples).