[Closed] Very quick one: how to execute a script from inside another script…?
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 “
def=attributes Amyface
(
parameters faceP
(
)
)
custAttributes.add $.modifiers[1] def
” 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
[color=white]Can anyone please tell me how i can execute this script?
Thanks again
Spencer
[/color]
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??
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
[color=white]Hi Gravey,
I hadn’t thought of using that but it returned this error:
– Unable to convert: unsupplied to type: String
[/color]
Thanks for the suggestion
Spence
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
"
execute ca