No.
Is there a way to create loop structure when using the findBy... and findResult?
For example, if I wanted to add the mass of all the "prop_physics" into one variable.
In other languages I would do this like this.
Code:For X = 1 to findByClass("prop_physics") Weight+=findResult(X):mass() Next X
You cannot loop in expressions (too easy to bog down a server).
But you can achieve the same effect using interval/timers.
Here's an example that will store the masses of everything found in an array.
NOTE: This method will flip the array, so the first mass will be from the last entity found.
[highlight=e2]@name Loop example
@inputs Start
@outputs IsLooping Results:array
@persist Counter
interval(10)
if(~Start & Start){
IsLooping = 1
Counter = NumResults
#do whatever find function here
}
if(!IsLooping){ #Don't do anything else when the loop is being run
#commands
#...
}else{
Results:setNumber(Counter, findResult(Counter):mass())
Counter = Counter - 1
if(Counter < 1){IsLooping = 0} #If there is nothing left, stop looping.
}
[/highlight]
Last edited by Peewee; 02-09-2009 at 01:34 PM. Reason: E2 highlighting is IN!
Bookmarks