SamIWas Posted October 18, 2009 Share Posted October 18, 2009 (edited) I have written a lot of Vectorscript. I'm no stranger to it, but this problem has gotten me exasperated! I must be missing something ridiculously simple, or my brain is just not functioning. Here's the idea...an object is selected. If it meets certain criteria, one thing is done. If it meets other criteria, something else is done. One of the things it should check is if the selected object is of a certain type (Lighting Device in Spotlight) and if it has a certain other record assigned to it (here, it's "Strut Info") I've written a hundred scripts it seems that can select an object based on those criteria, but now having it try to check if the object meets those criteria just isn't working. Here's the current section: if ((T='Lighting Device') & (R IN ['Strut Info'])) then begin strutname:=getrfield(h,'Strut Info','Name'); DSelectAll; SelectObj((R IN ['Strut Info']) & (S='Strut') & ('Strut Info'.'Name'=strutname)); end; I get errors with it saying for the "T" and the "R" that "identifier is not declared". Well, of course it's not. In this case, "T" is type of object and "R" is Record. It's a criteria. Apparently this does not work in an If/Then statement. Other than that one line, the script compiles. The object is selected. I do have a handle to the object in the script..I apparently just don't know how to apply the handle towards an "IF". What am I missing? What simple thing is wrong here? Edited October 18, 2009 by SamIWas Quote Link to comment
JBenghiat Posted October 19, 2009 Share Posted October 19, 2009 Sam, You can only use criteria inside a procedure or function that accepts criteria, like Count or Select. Try this: IF Eval(h, ((T='Lighting Device') & (R IN ['Strut Info'])))>1 THEN... -Josh Quote Link to comment
SamIWas Posted October 19, 2009 Author Share Posted October 19, 2009 Thanks Josh...that was the ticket! "Eval" is one I haven't used before, but I think I will be using it more soon! Sam Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.