How to reference a property variable in Haxe Scripting


#1

I have used nodes so that on startup, the game will create a global object property called CS. I was wondering how I can reference the CS property in my scripting. In my case I want to be able to do an if statement to see if its a certain value and if so change the value. Thanks in advance.


#2

look here … I think you will find your answer Trace several data during execution of nodes in the Viewport


#3

I’m sorry to tell you but I didn’t, I didn’t understand what it meant. When looking at the script below the image I understood the inputs were from the array you had plugged in but I didn’t know how you were using var V and if it was only declared within the script or was a property you had created.


#4

This is an example to put you on the path (one of all possible :slight_smile: ) … in your case if you connect your CS property in one of the inputs of this array node with it’s script, and then do your test of value in the script on the first input [0], the turn is played it seems to me.


#5

Hi, thought I had a problem but I didn’t, I think I have it working only issue is that I seem unable to select the script to run in the script node. Any reason for this? Thanks again


#6

Here is the script which does not work: could you please suggest a fix as i’m struggling:
package arm;

class CSpell extends armory.Trait {
public function new() {
super()
if input [0] = 1;
return 0
else if input [0] = 0;
return 1
}
}


#7

as written in comment in the script example, have you verified if “Make sure ‘Properties - Armory Project - Hscript’ is enabled”

then considering your script, after setting the ; seems that you work with a boolean and test true or false is shorter.
(could test to set a boolean or integer node at entry too to be sure)