ScriptSpot

Forum topic · General Scripting

Function Testing Selection

By JokerMartini · 2010-11-24

Description

For example I have a selection of objects and I want to use a function to test if every object in the selection is compatible. Only if EVERY object is compatible (tests true) does the script then continue to the next function. Where as if even one object tests false then it skips running the second function for all objects.

example: only if every object in the selections wirecolor is blue does it run the second function for all objects. otherwise it does not run the second function at all.

the second function could be anything such as moving all the objects to the origin move obj [0,0,0]


for i = 1 to selection.count do
(
Obj = selection[i]
ObjWire = obj.wirecolor

)

Comments (1)

try this function... fn

Anubis · 2010-11-25

try this function...

fn isAllBlue objArray = (
	for obj in objArray do
		if obj.wirecolor != blue do return false
	true
)
goNext = isAllBlue selection
-- if goNext do ...