question

JoseVM avatar image
0 Likes"
JoseVM asked Matthew Gillespie commented

how to code old expresions such as "setnodenum" and "setvarnum"

Hello everyone,

I was used to used flexsim in past vesions and I have recently come back. As I can see, flexscript has changed a little bit and I have some questions about its new code.

I would like to use the expression "setnodnum(node,value)" and "setvarnum(object, var, value)" but I can see that now they are deprecated. I see that they still work anyway but I would like to get use to the new code. I have looked to the guide but I find it a little bit unclear to me (it says that I should use treenode.value). Could anyone help me? thanks in advance!

Thanks a lot in advance


FlexSim 19.1.0
flexsim 19.1.0setvarnumsetnodenum
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Matthew Gillespie commented

to set

Node.value = 1.2;

to get

double myVar = Node.value;
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·

The new dot syntax is a bit longer for variables

obj.attr.variables.subnodes[“variable_name”]

or

obj.attr.variables.subnodes[num node_rank]
0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Joerg Vogel commented ·

In 19.2 we added some variable methods to the Object class:

obj.setVariable("maxspeed", 5);
double speed = obj.getVariable("maxspeed");
2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.