-
March 3rd, 2015, 10:46 #1
- Join Date
- Aug 2012
- Posts
- 40
Calling function from attached script
Hello, I'm trying different permutations of how to call function on a field from attached script but to no avail.
field is defined like:
Code:<number_linked name="attribute"> <source> <name>attributes.dexterity.user</name> <op>+</op> </source> </number_linked >
What I need to do is to add another source from lua script from "completely" different part of ruleset. number_linked.lua has function "AddSourceWithOp" defined. So I try do something like:
Code:window.getDatabaseNode().getChild("attribute").addSourceWithOp("attributes.strength.step", "+");
Code:attempt to call field 'addSourceWithOp' (a nil value)
-
March 3rd, 2015, 10:55 #2
- Join Date
- Aug 2012
- Posts
- 40
Ok.. As soon as I posted it, I figured it out.
-
March 3rd, 2015, 12:33 #3
please, please, please post your solution - even if its super simple...
every little learn helps the rest of us!
-
March 6th, 2015, 17:22 #4
- Join Date
- Aug 2012
- Posts
- 40
In fact this was elemental, if you think about it. Value you get from DB is just that - a value. Script is attached to control. So, instead of trying to run function on value for few hours (like an idiot), I should have run it on the control with code like:
Code:window.attribute.addSourceWithOp("attributes.strength.step", "+");
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks