Eval() statements

Blitz3D Forums/Blitz3D Programming/Eval() statements

tonydillon49(Posted 2004) [#1]
Hi all,

Is there any way in Blitz3D to run an Eval() statement? I have a number of Entities that have the same name and a numeric identifier (BP1, BP2, BP3 etc) and I'll like to run a loop to assign information to them. In most languages I can run something like:

For x=1 to 10
Eval("Entitycolor BP" + x + ", red, green, blue")
Next

and it will loop through all 10. Can this be done?


koekjesbaby(Posted 2004) [#2]
not as far as i know. use types it will make your life easier.

type bp
  field entity
end type

for x.bp = each bp
  EntityColor x\entity, red,green,blue
next


or something similar. :)


SoggyP(Posted 2004) [#3]
Hi folks,

I think investigating the use of types would be useful. For example you could then have something like:

Type beasty
  field e
  field r,g,b
end type

global b.beasty

for i = 1 to 100
  b = new beasty
  b\e = createsphere()
next

for b = each beasty
  b\r = rnd(255)
  b\g = rnd(255)
  b\b = rnd(255)
next


Is that what you're trying to acheive?

Later,

Jes


tonydillon49(Posted 2004) [#4]
Thanks - I'll have a look into it!

Tony D