Hey guys, I need a script node which runs this code Code: eventName = "XyZaBc.objPositionChanged"; Event.fire(eventName, this.entity().position()); } once every time the node is enabled. I really cant get it to work with my (nonexistent) js experience. Thanks in advance.
if you want it every time the "Enabled" input is fired then I think this would do it... Code: function signal(name, value) { if(name == "Enabled" && value == true) { eventName = "XyZaBc.objPositionChanged"; Event.fire(eventName, this.entity().position()); } } if you only have one input pin, you don't need to check the name really
glad it worked! note if you want you can actually pass an object as the value parameter eg Code: Event.fire(eventName, { position: this.entity().position(), foo: "bar" }); then in your event callback Code: otherPosition = value.position; otherFoo = value.foo; etc
Thanks for your input, unfortunately I am really not able to understand what you are trying to say (as I said I really dont understand much of programming). Can you recommend a resource to learn js?