Thread: LUA Help
-
August 27th, 2019, 20:55 #11
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
I feel like I am so close.
Code:function attribSelect(winFrame, nAttrib) local nodeWin = winFrame.getDatabaseNode(); Debug.chat("nodeWin:"); Debug.chat(nodeWin); nodeWin.createChild("attrib", "number"); local test = DB.setValue(nodeWin, "attrib", "number", nAttrib); Debug.chat("test:"); Debug.chat(test); return true; end
I think it's trying to pass the source name for nAttrib, instead of the number.
-
August 27th, 2019, 21:36 #12
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
You don't need to use both databasenode.createChild and DB.setValue. The DB.setValue call will create the child, if it doesn't exist already.
Most likely, the database mismatch is because of your previous code that created the "attrib" database node with no value type. You'll need to either delete that old character and create a new one for testing; or edit the campaign database to remove the offending node. If it still happens, then check your code for other places where "attrib" child might be created with no value type, or a different value type.
Regards,
JPG
-
August 27th, 2019, 23:01 #13
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
Removed cause I'm dumb.
Last edited by statik37; August 27th, 2019 at 23:40.
-
August 27th, 2019, 23:09 #14
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
Removed cause I'm dumb.
Last edited by statik37; August 27th, 2019 at 23:39.
-
August 28th, 2019, 04:57 #15
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
That's all part of learning.
Cheers,
JPG
-
August 28th, 2019, 14:02 #16
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
OK, another issue.
Her is my code:
Code:function taskcheck(winFrame) local nodeWin = winFrame.getDatabaseNode(); Debug.chat("nodeWin: ", nodeWin); local rRoll = {sType = "dice", aDice = {}, nMod = nodeWin.getChild("rollable.comprange").getValue()}; for i = 1, nodeWin.getChild("rollable.dicetoroll").getValue(), 1 do table.insert(rRoll.aDice, "d20"); end Debug.chat("rRoll:",rRoll); local rActor = ActorManager.getActor("pc", nodeWin); Debug.chat("rActor: ", rActor); local TN = nodeWin.getChild("rollable.targetroll").getValue(); Debug.chat("TN: ", TN); local FC = nodeWin.getChild("rollable.focusused").getValue(); Debug.chat("FC: ", FC); local comp = nodeWin.getChild("rollable.comprange").getValue(); Debug.chat("comp", comp); local rolling20 = nodeWin.getChild("rollable.dicetoroll").getValue(); Debug.chat("rolling20: ", rolling20); local msg = {font = "sheetlabel"}; msg.text = rActor.sName .. " rolls a task" Comm.deliverChatMessage(msg); local msg = {font = "sheetlabel"}; msg.text= "TN.." .. TN.." / FC.."..FC.."\nRolling "..rolling20.. "d20\n" Comm.deliverChatMessage(msg); for i = 1, rolling20, 1 do table.insert(rRoll, "d20"); end Debug.chat("rRoll", rRoll); resetdice(winFrame); ActionsManager.roll(nil, nil, rRoll); -- SkillDieHandler.handleDiceLanded(nodeWin, TN, rRoll); return true; end
When I comment out the ActionsManager line, the error goes away. I am using the ActionsManager from the CoreRPG set with no edits to it. My debug outputs are in the image below. I don't know what this error means. Usually it at least gives me a line to look at, this gives me nothing.
I even tried to throw some debug statement into the ActionsManager file, and it doesn't seem to get past the first if statement.
Outputs.png
-
August 28th, 2019, 14:10 #17
-
August 28th, 2019, 14:14 #18
Without going thru all of your code the only example in CoreRPG of ActionsManager.roll has 2 values + nil being passed to it and you are only passing 1 + 2 nil.
Its possible the first value cant be nil.
-
August 28th, 2019, 17:07 #19
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
I am away from computer so I cannot speak to the actionmanager problem until after work but I noticed the next problem you will have.
The roll call is not synchronous. When you call roll, (unless you are using non standard dice that cannot do 3d roll, in which case I still believe it dispatches to the landed handler) when it returns to your code, the dice will be rolling and you cannot handle the dice result as the next or any subsequent instruction in your code. You must register a handler that will take the results and deal with them. You should be able to find all kinds of examples of registering this handler and handling the results in Core RPG.
-
August 30th, 2019, 03:42 #20
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
I fixed this. I did not realize that MoreCore had a ton of custom dice codes. I found those yesterday, and with a little adjustment, they had exactly what I needed. I wish I found it earlier, and saved myself a lot of trouble. The more I work with the code, the easier it is getting for me to look at code and figure it out.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks