Random Spheres Script Creator

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2007   #1
Random Spheres Script Creator

Hi guys

I am learning Mel script,and I am starting to create my scripts...well,actually trying to create scripts
I am doing basic stuff.In this script I try to create a sphere random generator based on the value on the intField.So I create the UI,but when I call the procedure from the button "create Balls" I am running in to that problem :
// Error: Line 1.16: Wrong number of arguments on call to CreateRudiBalls. //

I donŽt know what I am missing.Can you help me please?
Here is the code.Thanks


 if (`window -q -ex "rudiBallsCreator_W"`) deleteUI  "rudiBallsCreator_W";
 window -t "Rudi Balls Creator" "rudiBallsCreator_W";
  rowLayout -nc 2 -columnWidth2 125 100 "sphereCreator_RL";
    button -l "create Random Balls" -c "CreateRudiBalls";
    intField "ballIntField";
 
    $ballsNumber = `intField -q -value "ballIntField"`;
 
 global proc CreateRudiBalls (int $ballsNumber)
 
 {
   
   for ($i=0;$i<=$ballsNumber;$i++)
 	 {
 	  float $randomRadius =`rand 0.5 5`;
 	  float $randomPosX = `rand 0 20`;
 	  float $randomPosY = `rand 0 20`;
 	  float $randomPosZ = `rand 0 20`;
 
 	  polySphere -r $randomRadius;
 	  move -r -os -wd $randomPosX $randomPosY $randomPosZ;
 	  }
  }
 
 showWindow;
 
 
Old 05 May 2007   #2
I think it is because you aren't passing anything to your creator function....you query the button before it is ever created at the bottom of the script in showWindow.....stick the int query into the procedure and that will be fetched by the creator.....
 
Old 05 May 2007   #3
thanks man.IŽll keep trying.But I havenŽt fixed it yet.mmm...
what am I missing....IŽll tell you guys if it finally find what is wrong.
 
Old 05 May 2007   #4
There you go:

    if (`window -q -ex "rudiBallsCreator_W"`) deleteUI  "rudiBallsCreator_W";
    window -t "Rudi Balls Creator" "rudiBallsCreator_W";
     rowLayout -nc 2 -columnWidth2 125 100 "sphereCreator_RL";
   	button -l "create Random Balls" -c "CreateRudiBalls";
   	intField "ballIntField";
    
   	$ballsNumber = `intField -q -value "ballIntField"`;
     showWindow;
    global proc CreateRudiBalls()
    
    {
      int $ballsNumber = `intField -q -v "ballIntField"`;
   
      for ($i=0;$i<=$ballsNumber;$i++)
   	  {
   	   float $randomRadius =`rand 0.5 5`;
   	   float $randomPosX = `rand 0 20`;
   	   float $randomPosY = `rand 0 20`;
   	   float $randomPosZ = `rand 0 20`;
    
   	   polySphere -r $randomRadius;
   	   move -r -os -wd $randomPosX $randomPosY $randomPosZ;
   	   }
     }
    

The query of how namy balls i moved INTO the actuall proc'.
You had proc XxX(giveValue).
when actually in the button u just calld the proc withOUT giving in any value, thats why u got the error.
__________________
What The... !@%#




 
Old 05 May 2007   #5
hey sickSpider!
Damn!I just found the solution and I was just going to put it when I saw your reply! lol
Thanks man.I have been 1 hour looking for the problem and I did the exact thing you did.
Next time IŽll be faster!

Moving on to the next:Loops with While-Do(I know I know...newbie stuff)
 
Old 05 May 2007   #6
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:17 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.