CinnamonMetal Posted February 5, 2018 Share Posted February 5, 2018 I'm hoping I can get a second input on a problem; int max; float radi; addattrib(0,"Cd","PpColor",{0.3,0.6,0.2}); for(int k=6;k<=@primnum;k++){ append(i[]@pprimList,@primnum); foreach(int primms;i[]@pprimList){ removeprim(0,primms,1); for(int v=5;v<=@primnum;v++){ append(i[]@pprimList,@primnum); if(i[]@pprimList<=4){ printf("%g\n",@pprimList); break; } } } } The first loop, loops over all the primitives stores them in an array then deletes those primitives greater then 6. Considering the array is now empty, the second loop, loop over all the primitives less then 5 and stores them in the previous array; then checks if the array is less then equal to 4, print the items in the array. Except it's not working ? Quote Link to comment Share on other sites More sharing options...
acey195 Posted February 6, 2018 Share Posted February 6, 2018 functions like removeprim() only get executed at the very end of the code, so the @primnum and @numprim values will not update during code execution. if you really want to build it like this, you have to store them in temporary variables and keep track of the current primitive number in that way Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 6, 2018 Author Share Posted February 6, 2018 (edited) I have sorted it out. Edited February 7, 2018 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.