algorithmic modeling for Rhino
Hello, I'm scripting for the first time in my life.
I'm replicating a script that i found on a tutorial but with a little addition: I'm trying to create a component that tracks down the lowest variable between x,y,z and u and gives me a result (0,1,2,3) based on which variable it is.
I don't know why it doesn't work, because I'm not accustomed to script.
I showed it to a friend of mine that is studying a little of programming in high school but he too can't find the mistake.
This is what I wrote:
{
// private void RunScript(double x, double y, double z, double u, ref object A)
if ((x < y) && (x < z) && (x < u))
{A = 0;}
else if ((y < x) && (y < z) && (y < u))
{A = 1;}
else if ((z < x) && (z < y) && (z < u))
{A = 2;}
else
{A = 3;}
}
Could you help me?
Tags:
I uploaded a couple of images, the second one shows the error text I get.
Thanks in advance to everyone :)
I can not reproduce this error. But by the error message, it seems that you have not declared the data type in some input, although the code you samples appear correctly. Anyway, check it (right click-Type Hint>Double) and run the code.
I too don't see anyting out of line, except perhaps: have you actually typed in "// private void run script...."? It looks like it from the image you have posted. All inputs and outputs are auto-generated by the script editor. For your script, you should be explicity managing the data types on the inputs to the script component...so right-click on each of your x,y,z,u values and ensure that they are set to input type "double."
@Daniel & @David
Thank you very much to both of you guys! You were right, I forgot to set the u input to double.
Thank you again!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by