Type Selection

BlitzPlus Forums/BlitzPlus Programming/Type Selection

thalamus(Posted 2005) [#1]
Is there a way to select a specific Type?

Say, for instance, I didn't want to apply a change to all Types, just a specific one - is this possible?


Tyler(Posted 2005) [#2]
I think you'll have to flag the types with an extra variable if you want to do that. Or you can do the 'for x.chair = each chair' search for whatever characteristic you want to change.

for x.chair = each chair
if x\number = 1
x\model = "model1.x"
else
x\model = 0
end if
next

for instance, if you wanted all the objects in the room to be deleted except the ones marked "Permanent", you'd have to have a variable in your type named "permanent" (or something similar, for the sake of understanding) that was set to either 0 or 1 at creation, and could be changed, if you liked, but to delete only those that were marked with 1, you could cycle through them all, check if permanent = 1 or not, and deleting those that aren't. ... hope that was what you were asking for.


thalamus(Posted 2005) [#3]
That's the sort of solution I was thinking of, thank you :)

Pity there's no way to specify a Type directly, though (hint hint!).


Grey Alien(Posted 2005) [#4]
Or make an array of types like this Dim Men.Man(MAX_MEN), then later reference the man you want as Men(5) for example without having to loop. This works for me.