PlatinumFishy Posted April 6, 2018 Share Posted April 6, 2018 (edited) Trying to access a dynamically generated parameter from my control node and eventually put it into an array. I just do not understand why using the path variable is any different from just reading the string directly. here it is in text form btw int maxi = 2; for(int i = 1; i < maxi; i++){ string path = sprintf("../control/parm%g", i); s@path = path; //works^ float param = `chs("../control/parm1")`; f@param = param; //works^ float value = `chs(path)`; f@value = value; //doesnt work^ } Edit : Ive added a simple project file vex calling.hiplc Edit2: Okay I figured It out, I need to get rid of the back quotes encasing the chf() in order for it to work properly. This probably has to do with me copying the parameter and pasting relative reference in order to get the syntax. Edited April 6, 2018 by PlatinumFishy Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted April 6, 2018 Share Posted April 6, 2018 what does the error says ? Is it a problem a problem of casting of types ? maybe try chf() instead of chs()... depending on the type returned by the channel Quote Link to comment Share on other sites More sharing options...
davpe Posted April 6, 2018 Share Posted April 6, 2018 the problem is that you cant have a string in a float attribute. floats can only be numbers. Quote Link to comment Share on other sites More sharing options...
PlatinumFishy Posted April 6, 2018 Author Share Posted April 6, 2018 15 minutes ago, StepbyStepVFX said: what does the error says ? Is it a problem a problem of casting of types ? I'm sorry I should've included that, it says: "Syntax error, unexpected ';'. Quote Link to comment Share on other sites More sharing options...
PlatinumFishy Posted April 6, 2018 Author Share Posted April 6, 2018 5 minutes ago, davpe said: the problem is that you cant have a string in a float attribute. floats can only be numbers. What do you mean? I am using the path variable to store the reference nor the actual value. When getting the value for the param variable I also used a string within the chs() and it worked. Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted April 6, 2018 Share Posted April 6, 2018 (edited) your value variable is cast as a float, but you assign it the value of a string by using `chs()` Edited April 6, 2018 by Jesper Rahlff Quote Link to comment Share on other sites More sharing options...
PlatinumFishy Posted April 6, 2018 Author Share Posted April 6, 2018 (edited) 16 minutes ago, Jesper Rahlff said: your value variable is cast as a float, but you assign it the value of a string by using `chs()` Again, am I not doing the same thing for the param variable? this works: float param = `chs("../control/parm1")`; That is also using the chs() and it reads into a float. Edit: Okay I figured It out, I need to get rid of the back quotes encasing the chf() in order for it to work properly. This probably has to do with me copying the parameter and pasting relative reference in order to get the syntax. Edited April 6, 2018 by PlatinumFishy 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.