<?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: MEL script not working in Maya Forum</title>
    <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624409#M45547</link>
    <description>&lt;P&gt;this is very confusing &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; when i add this at the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maya tells me that ive to delete this -&amp;gt;&amp;nbsp;$r&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 18.18: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 18.22: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 20.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 33.18: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 33.22: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 36.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 41.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 46.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: $h/=2;&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 50.6: "$h" is an undeclared variable. //&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 16:45:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-12-14T16:45:31Z</dc:date>
    <item>
      <title>MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7621906#M45539</link>
      <description>&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;I'm having a weird problem with an existing script. I copied and pasted it into MEL, pressed Strg+Enter..so far so good. I also pressed "execute" and now the script is supposed to show up into my scene but it doesnt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody tell me what am I doing wrong and can guide me? I also have TeamViewer. just saying&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 21:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7621906#M45539</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-13T21:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7621998#M45540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;and welcome to the community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please post the script here when you get a chance?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 21:43:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7621998#M45540</guid>
      <dc:creator>sean.heasley</dc:creator>
      <dc:date>2017-12-13T21:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7622088#M45541</link>
      <description>&lt;P&gt;hi, thanks for replying&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc diamondSquare(float $h)&lt;BR /&gt;{&lt;BR /&gt;polyPlane -w 1 -h 1 -sx 16 -sy 16 -ax 0 1 0 -cuv 2 -ch 1 -n "terrain";&lt;BR /&gt;int $SIZE=16+1;&lt;BR /&gt;&lt;BR /&gt;for ($sidelength = $SIZE-1; $sidelength &amp;gt; 1; $sidelength/=2)&lt;BR /&gt;{&lt;BR /&gt;int $halfside = $sidelength/2;&lt;BR /&gt;for ($x=0; $x&amp;lt;$SIZE-1; $x+=$sidelength)&lt;BR /&gt;{&lt;BR /&gt;for ($z=0; $z&amp;lt;$SIZE-1; $z+=$sidelength)&lt;BR /&gt;{&lt;BR /&gt;vector $p0 = `pointPosition -w terrain.vtx[$x + $z*$SIZE]`;&lt;BR /&gt;vector $p1 = `pointPosition -w terrain.vtx[$x + $sidelength + $z*$SIZE]`;&lt;BR /&gt;vector $p2 = `pointPosition -w terrain.vtx[$x + ($z+$sidelength)*$SIZE]`;&lt;BR /&gt;vector $p3 = `pointPosition -w terrain.vtx[$x + $sidelength + ($z+$sidelength)*$SIZE]`;&lt;BR /&gt;&lt;BR /&gt;float $avg = ($p0.y + $p1.y + $p2.y + $p3.y)/4.0;&lt;BR /&gt;$r = rand(-1.0*$h, $h);&lt;BR /&gt;select -r terrain.vtx[$x+$halfside + ($z+$halfside)*$SIZE];&lt;BR /&gt;move -y ($avg + $r);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;for($x=0; $x&amp;lt;$SIZE-1; $x+=$halfside)&lt;BR /&gt;{&lt;BR /&gt;for($z=($x+$halfside)%$sidelength; $z&amp;lt;$SIZE-1; $z+=$sidelength)&lt;BR /&gt;{&lt;BR /&gt;vector $p0 = `pointPosition -w terrain.vtx[($x-$halfside+$SIZE-1)%($SIZE-1) + $z*$SIZE]`;&lt;BR /&gt;vector $p1 = `pointPosition -w terrain.vtx[($x+$halfside)%($SIZE-1) + $z*$SIZE]`;&lt;BR /&gt;vector $p2 = `pointPosition -w terrain.vtx[$x + (($z+$halfside)%($SIZE-1))*$SIZE]`;&lt;BR /&gt;vector $p3 = `pointPosition -w terrain.vtx[$x + (($z-$halfside+$SIZE-1)%($SIZE-1))*$SIZE]`;&lt;/P&gt;&lt;P&gt;float $avg = ($p0.y + $p1.y + $p2.y + $p3.y)/4.0;&lt;BR /&gt;$r = rand(-1.0*$h, $h);&lt;BR /&gt;&lt;BR /&gt;select -r terrain.vtx[$x + $z*$SIZE];&lt;BR /&gt;move -y ($avg + $r);&lt;BR /&gt;&lt;BR /&gt;if ($x == 0)&lt;BR /&gt;{&lt;BR /&gt;select -r terrain.vtx[$SIZE-1 + $z*$SIZE];&lt;BR /&gt;move -y ($avg + $r);&lt;BR /&gt;}&lt;BR /&gt;if ($z == 0)&lt;BR /&gt;{&lt;BR /&gt;select -r terrain.vtx[$x + ($SIZE-1)*$SIZE];&lt;BR /&gt;move -y ($avg + $r);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;$h/=2;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 22:19:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7622088#M45541</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-13T22:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7622212#M45542</link>
      <description>&lt;P&gt;That's the proc definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To actually use it, you have to execute the proc like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;diamondSquare( 0.333 );&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Dec 2017 23:16:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7622212#M45542</guid>
      <dc:creator>Stephen.Blair</dc:creator>
      <dc:date>2017-12-13T23:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624203#M45543</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/534259"&gt;@Stephen.Blair&lt;/a&gt;&amp;nbsp;beat me to it &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.autodesk.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you get a chance, can you add the code&amp;nbsp;to yours so we can make sure it works for you as well?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:56:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624203#M45543</guid>
      <dc:creator>sean.heasley</dc:creator>
      <dc:date>2017-12-14T15:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624379#M45544</link>
      <description>&lt;P&gt;do i have to add this at the beginning or at the end?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:36:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624379#M45544</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-14T16:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624392#M45545</link>
      <description>&lt;P&gt;You can't go wrong by putting it at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) define proc&lt;/P&gt;
&lt;P&gt;2) call proc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will work in any language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In MEL, you could call the proc first, because Maya obviously parses the whole thing first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in Python, you'd get an error if the definition didn't come first.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:44:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624392#M45545</guid>
      <dc:creator>Stephen.Blair</dc:creator>
      <dc:date>2017-12-14T16:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624397#M45546</link>
      <description>&lt;P&gt;i add this at the very beginning of the script and this is what maya tells me&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Error: Line 51.6: "$h" is an undeclared variable.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:41:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624397#M45546</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-14T16:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624409#M45547</link>
      <description>&lt;P&gt;this is very confusing &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; when i add this at the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maya tells me that ive to delete this -&amp;gt;&amp;nbsp;$r&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 18.18: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 18.22: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 20.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 33.18: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: $r = rand(-1.0*$h, $h);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 33.22: "$h" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 36.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 41.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: move -y ($avg + $r);&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 46.19: "$r" is an undeclared variable. //&lt;BR /&gt;// Error: $h/=2;&lt;BR /&gt;//&lt;BR /&gt;// Error: Line 50.6: "$h" is an undeclared variable. //&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:45:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624409#M45547</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-14T16:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624414#M45548</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;diamondSquare( .1 );



proc diamondSquare(float $h)
{
polyPlane -w 1 -h 1 -sx 16 -sy 16 -ax 0 1 0 -cuv 2 -ch 1 -n "terrain";
int $SIZE=16+1;

for ($sidelength = $SIZE-1; $sidelength &amp;gt; 1; $sidelength/=2)
{
int $halfside = $sidelength/2;
for ($x=0; $x&amp;lt;$SIZE-1; $x+=$sidelength)
{
for ($z=0; $z&amp;lt;$SIZE-1; $z+=$sidelength)
{
vector $p0 = `pointPosition -w terrain.vtx[$x + $z*$SIZE]`;
vector $p1 = `pointPosition -w terrain.vtx[$x + $sidelength + $z*$SIZE]`;
vector $p2 = `pointPosition -w terrain.vtx[$x + ($z+$sidelength)*$SIZE]`;
vector $p3 = `pointPosition -w terrain.vtx[$x + $sidelength + ($z+$sidelength)*$SIZE]`;

float $avg = ($p0.y + $p1.y + $p2.y + $p3.y)/4.0;
$r = rand(-1.0*$h, $h);
select -r terrain.vtx[$x+$halfside + ($z+$halfside)*$SIZE];
move -y ($avg + $r);
}
}
for($x=0; $x&amp;lt;$SIZE-1; $x+=$halfside)
{
for($z=($x+$halfside)%$sidelength; $z&amp;lt;$SIZE-1; $z+=$sidelength)
{
vector $p0 = `pointPosition -w terrain.vtx[($x-$halfside+$SIZE-1)%($SIZE-1) + $z*$SIZE]`;
vector $p1 = `pointPosition -w terrain.vtx[($x+$halfside)%($SIZE-1) + $z*$SIZE]`;
vector $p2 = `pointPosition -w terrain.vtx[$x + (($z+$halfside)%($SIZE-1))*$SIZE]`;
vector $p3 = `pointPosition -w terrain.vtx[$x + (($z-$halfside+$SIZE-1)%($SIZE-1))*$SIZE]`;

float $avg = ($p0.y + $p1.y + $p2.y + $p3.y)/4.0;
$r = rand(-1.0*$h, $h);

select -r terrain.vtx[$x + $z*$SIZE];
move -y ($avg + $r);

if ($x == 0)
{
select -r terrain.vtx[$SIZE-1 + $z*$SIZE];
move -y ($avg + $r);
}
if ($z == 0)
{
select -r terrain.vtx[$x + ($SIZE-1)*$SIZE];
move -y ($avg + $r);
}
}
}
$h/=2;
}
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:46:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624414#M45548</guid>
      <dc:creator>Stephen.Blair</dc:creator>
      <dc:date>2017-12-14T16:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624423#M45549</link>
      <description>&lt;P&gt;god bless you&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now i have to figure out how to scale the terrain&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:49:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/7624423#M45549</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-14T16:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: MEL script not working</title>
      <link>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/9028300#M45550</link>
      <description>&lt;P&gt;If I copy and paste this script or code into the MAYA script editor will anything happen ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 19:42:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-forum/mel-script-not-working/m-p/9028300#M45550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-16T19:42:17Z</dc:date>
    </item>
  </channel>
</rss>

