PDA

View Full Version : Another simple script problem...


Opeth
08-31-2002, 05:18 PM
hey everyone, i'm afraid i'm having a little more trouble with scripting.
this time what im trying to do is the following:
a edit text box, which will select the object in the scene whose name is equal to the string entred in the box.
how do i make a string into a named selection?
here's what i tried doing:

on edt2 entered text do
select $text

i also tried
select $edt2.text
select $[edt2.text]
select $(edt2.text)

what am i supposed to do?!
please advise! thanx.

Bobo
08-31-2002, 08:31 PM
Originally posted by Opeth
hey everyone, i'm afraid i'm having a little more trouble with scripting.
this time what im trying to do is the following:
a edit text box, which will select the object in the scene whose name is equal to the string entred in the box.
how do i make a string into a named selection?
here's what i tried doing:

on edt2 entered text do
select $text

i also tried
select $edt2.text
select $[edt2.text]
select $(edt2.text)

what am i supposed to do?!
please advise! thanx.


utility testselection "Test Selection"
(
edittext edt2
on edt2 entered text do
select (execute ("$'"+text+"'"))
)

Note that the resulting string will be $'Box01'.
The ' ' are there in order to catch any special characters in the name which would cause problems with the execute command, for example dot, backslash etc.

Execute takes a string and evaluates it to a MAXScript expression as if it was a line of code in the editor. So you basically build your code in a string and then call execute to turn it into a MAXScript expression. This can be VERY powerful when creating custom rollouts on the fly etc.

Opeth
09-01-2002, 08:42 AM
alright man, thanx :)
i tried the execute action, just wrong syntex...
IDF thanks you...

censored
09-02-2002, 10:21 PM
Originally posted by Opeth
IDF thanks you...


o_O

CGTalk Moderation
01-13-2006, 03:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.