<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Self referring script controller in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114577#M23490</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Note that the scripts are not instanced even if you clone the box to an instance. Changing the script on Box01 will not affect the script on Box02 &amp;amp;#40;assuming Box02 already exists, with it's own script, before you change the script on Box01&amp;amp;#41;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help, but this is precisely why it's not a solution to my problem. I need to the script to be instanced so that it can be edited from one central location. I also need to apply the script to objects that have already been created, so I'd have to 'Assign Node' for each object manually, of which there are hundreds.&lt;BR /&gt;&lt;BR /&gt;I think I'll probably just write a script that actually generates the script controllers for me and applies them to each node. That way I can still edit the code from one place, but could still have a self-referring node variable that is different for each object.</description>
    <pubDate>Wed, 23 Sep 2009 13:15:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-09-23T13:15:13Z</dc:date>
    <item>
      <title>Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114571#M23484</link>
      <description>I'm trying to make what seems like a pretty simple script controller. Lets say something simple like a script that scales the object based on the distance between it's parent node and the camera. The resulting script will be more complicated than that, but that's pretty much my first step.&lt;BR /&gt;&lt;BR /&gt;I wanted to be able to instance this same script to a bunch of different objects so that they would all behave the same way, but independent of each other, so I don't want to directly specify the node I'm working with &amp;amp;#40;other than the camera&amp;amp;#41;. And I definitely want to keep the script as an instance if possible.&lt;BR /&gt;&lt;BR /&gt;What i'm looking for something along the lines of a "this.parent_node" operator, where "this" refers to the script controller itself and "parent_node" refers to the node it is attached to, which would vary depending on exactly which instance of the controller is being evaluated.&lt;BR /&gt;&lt;BR /&gt;Is this possible, or am I heading down a dead end here?</description>
      <pubDate>Thu, 17 Sep 2009 13:45:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114571#M23484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-09-17T13:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114572#M23485</link>
      <description>Hi&lt;BR /&gt;have a look to mxs ref @&lt;BR /&gt;&lt;BR /&gt;Maxscript language reference // 3ds max objects // animation controllers // Controller types // Script controllers // "this" local variable in scripted controllers.&lt;BR /&gt;&lt;BR /&gt;indeed, you can't figure out wich instance of your script is attached to wich node. Maybe you can find a trick to make it by assigning unique ID to each instance...&lt;BR /&gt;&lt;BR /&gt;++</description>
      <pubDate>Sat, 19 Sep 2009 16:49:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114572#M23485</guid>
      <dc:creator>malikarn</dc:creator>
      <dc:date>2009-09-19T16:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114573#M23486</link>
      <description>It's along the right lines for sure.. The example they posted even does kinda what I'm looking for, but only for unique script controllers. As an instanced script controller, however, each controller returns an array of all the nodes in the scene it is attached to. So there is no way to evaluate exactly which node a particular instance of the script controller is controlling.&lt;BR /&gt;&lt;BR /&gt;I may be totally approaching this wrong. Perhaps instancing a script controller will always cause problems like this. Does a script controller exist as a completely independent node that is essentially the parent of the nodes it controls, or does it exist as something like the child of a regular node?&lt;BR /&gt;&lt;BR /&gt;For instance.. If I said:&lt;BR /&gt;&lt;BR /&gt;i = &amp;amp;#36;box01.controller&lt;BR /&gt;&lt;BR /&gt;I now have box01's controller as the variable 'i', but how do I resolve &amp;amp;#36;box01 from 'i'? It seems like &amp;amp;#36;box01 should be its parent of sorts, but it appears that it's much more complicated than that.</description>
      <pubDate>Tue, 22 Sep 2009 20:33:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114573#M23486</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-09-22T20:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114574#M23487</link>
      <description>Create a variable in the script controller, assign it to the node. If you only need access to a couple of of animatable values, use assign track instead, it's cheaper/quicker - nodes are quite "heavy".</description>
      <pubDate>Tue, 22 Sep 2009 20:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114574#M23487</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-09-22T20:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114575#M23488</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Create a variable in the script controller, assign it to the node. If you only need access to a couple of of animatable values, use assign track instead, it's cheaper/quicker - nodes are quite "heavy".&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Could you please elaborate on this. I'm not fully understanding what you are suggesting. I've explained why I can't assign a node variable directly. The script is being instanced over a number of different objects and each instance would need an independent variable.</description>
      <pubDate>Tue, 22 Sep 2009 21:06:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114575#M23488</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-09-22T21:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114576#M23489</link>
      <description>A simple example. Create a Box.&lt;BR /&gt;Command Panel | Motion Tab | expand Assign Controller | highlight z_Position | Assign a Float Script.&lt;BR /&gt;Create a variable mySelf, Assign Node and select &amp;amp;#36;Box01&lt;BR /&gt;Change the actual script to read "mySelf.position.controller.x_position". Move the box along the X axis and it moves in Z by the same amount.&lt;BR /&gt;Shift+Move the box to clone it. Both boxes move independently - both have the script attached. You can prove that by looking at the properties of Box02 and highlighting the "mySelf" variable - the variable references "&amp;amp;#36;Box02".&lt;BR /&gt;&lt;BR /&gt;Note that the scripts are not instanced even if you clone the box to an instance. Changing the script on Box01 will not affect the script on Box02 &amp;amp;#40;assuming Box02 already exists, with it's own script, before you change the script on Box01&amp;amp;#41;.</description>
      <pubDate>Wed, 23 Sep 2009 09:53:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114576#M23489</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-09-23T09:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114577#M23490</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Note that the scripts are not instanced even if you clone the box to an instance. Changing the script on Box01 will not affect the script on Box02 &amp;amp;#40;assuming Box02 already exists, with it's own script, before you change the script on Box01&amp;amp;#41;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help, but this is precisely why it's not a solution to my problem. I need to the script to be instanced so that it can be edited from one central location. I also need to apply the script to objects that have already been created, so I'd have to 'Assign Node' for each object manually, of which there are hundreds.&lt;BR /&gt;&lt;BR /&gt;I think I'll probably just write a script that actually generates the script controllers for me and applies them to each node. That way I can still edit the code from one place, but could still have a self-referring node variable that is different for each object.</description>
      <pubDate>Wed, 23 Sep 2009 13:15:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114577#M23490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-09-23T13:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Self referring script controller</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114578#M23491</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;I think I'll probably just write a script that actually generates the script controllers for me and applies them to each node. That way I can still edit the code from one place, but could still have a self-referring node variable that is different for each object.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;That would probably work. An alternative would be to use a dummy object and create a collection of the relevant nodes and simply loop through the list. Create the script on an animatable track which isn't used - like the Scale. Just remember to leave the default value as the last line of the script. I've not tried this &amp;amp;#40;a collection inside a script controller&amp;amp;#41; but it should work, and it means there really is only 1 copy of the script.</description>
      <pubDate>Wed, 23 Sep 2009 13:27:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/self-referring-script-controller/m-p/4114578#M23491</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-09-23T13:27:59Z</dc:date>
    </item>
  </channel>
</rss>

