5E Character Create Playlist
Page 2 of 3 First 123 Last

Thread: LUA Help

  1. #11
    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 get setValue: Database node type mismatch.

    I think it's trying to pass the source name for nAttrib, instead of the number.

  2. #12
    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

  3. #13
    Removed cause I'm dumb.
    Last edited by statik37; August 27th, 2019 at 23:40.

  4. #14
    Removed cause I'm dumb.
    Last edited by statik37; August 27th, 2019 at 23:39.

  5. #15
    That's all part of learning.

    Cheers,
    JPG

  6. #16
    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
    I am getting a Script Error: invalid key to 'next'

    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

  7. #17
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by statik37 View Post
    I am getting a Script Error: invalid key to 'next'

    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
    If you are layered on CoreRPG and you probably want to make changes to ActionManager you would generally make a new ActionManager2 and leave the original intact.
    I cant see an if statement in your code?

  8. #18
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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.

  9. #19

    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.

  10. #20
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in