The (5:301) DragonSpeak Line
There is a variable-related DS line that works a bit differently than one might expect, and it has a limitation that prevents it from working in certain circumstances:
(5:301) copy the value of variable % into variable %.
By default, this lets you copy both of a variable's values, including even unused .y values (it sets the receiving variable’s .y value to 0) into another variable, like this:
(5:301) copy the value of variable %var1 into variable %var2.
Using.x and.y in the first space works, but if you use it in the second space, it will cause unexpected behavior to occur. Here's how it works correctly:
(5:301) copy the value of variable %var1.x into variable %var2.
(5:301) copy the value of variable %var1.y into variable %var2.
But what if you need to copy .y of the first variable into .x of the second variable? Though it won't work with (5:301), you can work around this with (5:300). Here's an example:
(5:300) set variable %var2.y to the value %var1.x.
(5:300) set variable %var2.x to the value %var1.y.
The line(5:384) may also be useful here. Here’s an example:
(5:384) set variable %var2 to the x,y position (%var1.y, %var1.x).
Share this:
-
-
-