View Full Version : Very quick one: how to execute a script from inside another script...?
Snape 08-13-2007, 07:31 PM Hi,
I cant seem to execute a new script from inside my script. I am basically trying to add a new custAttribute to an object that will be generated from my main script. This is the barebone code i am using in the main script:
ca = newScript()
print "\n def=attributes Amyface
(
parameters faceP
(
)
)
custAttributes.add $.modifiers[1] def \n" to:ca
execute ca
-------------------
The parameter block will be generated from my main script.
This code returns in the listener:
-- No ""execute"" function for ##keys
Can anyone please tell me how i can execute this script?
Thanks again
Spencer
|
|
Snape
08-13-2007, 10:08 PM
Having spent some more time with this I am not sure if I am going arund this the best way.
All Im really trying to achieve is the ability to add custom attributes to an object where the attributes are dynamic and are generated by the script.
So if this is the script:
def=attributes Amyface
(
parameters faceP
(
--This is the part that I need to be dynamic and generate from
--somewhere else in the script
)
)
custAttributes.add $.modifiers[1] def
The green text shows where I need to generate the parameter block from somewhere else in the script.
The thing is in writing any code inside this at all it becomes part of the definition and I cant find a way to place a variable there that just calls a string without the "" leaving a line of text like:
FCNT_R_EyebrowX type:#float
I am still quite new to maxscript and do not see any other way around this problem, can anyone PLEASE help??
Gravey
08-14-2007, 02:56 AM
Have you tried something like this:
myVariable = "FCNT_R_EyebrowX type:#float"
def=attributes Amyface
(
parameters faceP
(
execute myVariable
)
)
custAttributes.add $.modifiers[1] def
I think it SHOULD work but I haven't tried it myself
Snape
08-14-2007, 09:14 AM
Hi Gravey,
I hadn't thought of using that but it returned this error:
-- Unable to convert: unsupplied to type: String
Thanks for the suggestion
Spence
Gravey
08-14-2007, 11:02 AM
ok dude i just had a play with it and this works:
myVariable = "FCNT_R_EyebrowX type:#float"
ca = "def=attributes Amyface
(
parameters faceP
(
" + myVariable + "
)
)
custAttributes.add $.modifiers[1] def \n"
execute ca
Snape
08-14-2007, 12:28 PM
Great! Thanks for all your help. Can't wait to try it!
Spence
CGTalk Moderation
08-14-2007, 12:28 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.