Redefining a Variable Node via a script

Moderator: Moderator Group

Redefining a Variable Node via a script

Postby alexbright » Thu Sep 11, 2014 7:18 pm

I’m trying to change what Variable a Variable node is referencing using a custom script and the “WDNodeSetParam” script

Here is my problem, if I have a Variable called “Hello” with the current value of “World”, and I use the "WDNodeSetParam,NodeID,ParamID,Value” script to try and reassign what variable the node is referencing, instead of actually getting the variable there, I get the current Value stored in the variable. So if I used “WDNodeSetParam,1,1,Hello”, then The Variable node 1, would have the value of “world” stored in Peram 1, rather then my variable.

Is there a different script I should be using, or is there some way to escape the variable?

Thanks in advance,

Alex Bright
alexbright
 
Posts: 12
Joined: Mon Aug 30, 2010 9:37 pm

Re: Redefining a Variable Node via a script

Postby Dennis Kuypers » Thu Sep 11, 2014 10:28 pm

Hello Alex,

there currently is no way of "escaping a variable name". Literals (plain) are not distinguishable from variable names. That is one drawback of the way the Widget Designer makes things easy for the user.

I can think of two workarounds to solve this (I have not tested any of them as I am not at the office right now):

1. Create another variable (for example hello_var) with the value "hello". So when using the script with hello_var it will resolves to actual "hello" variable name.
2. Write the variable name in hex, you can use this tool to convert it:Textconverter tool You should get something like [h68h65h6Ch6Ch6F]. Try using this as the variable name

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm

Re: Redefining a Variable Node via a script

Postby alexbright » Thu Sep 11, 2014 11:11 pm

Option1 works, creating a proxy variable does in fact insert the correct text.

Option2 (while I like it) does not work. It inserts the actual text "[h68h65h6Ch6Ch6F]" rather then hello... Which I found surprising.

I'm talking about 60 variables, so this creating these proxy variables isn't necessarily the answer I wanted to hear.

If you can think of anything else, please let me know.

Thank you!
Alex
alexbright
 
Posts: 12
Joined: Mon Aug 30, 2010 9:37 pm

Re: Redefining a Variable Node via a script

Postby alexbright » Fri Sep 12, 2014 3:27 pm

Markus from tech support had the answer using Node Commands.

The following script will insert the the value "hello" into into index 1 of node 1, without any of it's context.

node1.1@hello
alexbright
 
Posts: 12
Joined: Mon Aug 30, 2010 9:37 pm


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 5 guests