DICE PACKS BUNDLE
Page 3 of 4 First 1234 Last
  1. #21
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,407
    Quote Originally Posted by DMFirmy View Post
    I will give this fix a try later today when I get home, but I am curious how I would implement the "not-so-quick-fix" and actually make it so my rolld result IS recognized as a number. Thanks a million for the advice though... this one was driving me bananas.
    See the supported types in the dragdata entry - 2nd paragraph here: https://www.fantasygrounds.com/refdoc/dragdata.xcp

    The not-so-quick-fix would be to write an onDrop() handler on the target control/s to get the correct data out of your custom dragdata object - this is a lot of work and would require messing around with base ruleset templates/definitions for a controls. It's much better to simply change the resulting chat message type to "dice" so that any control in the ruleset that can accept a number from a dice dragdata object will be able to accept it. And the result of your rolld code is a set of dice anyway, so this makes sense...
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  2. #22
    Quote Originally Posted by Trenloe View Post
    See the supported types in the dragdata entry - 2nd paragraph here: https://www.fantasygrounds.com/refdoc/dragdata.xcp

    The not-so-quick-fix would be to write an onDrop() handler on the target control/s to get the correct data out of your custom dragdata object - this is a lot of work and would require messing around with base ruleset templates/definitions for a controls. It's much better to simply change the resulting chat message type to "dice" so that any control in the ruleset that can accept a number from a dice dragdata object will be able to accept it. And the result of your rolld code is a set of dice anyway, so this makes sense...
    I agree, that is a lot more work than would fit this extension. Thank you again for the help. I plan on putting together an updated version of this extension file and posting a release in the main forums some time later this evening. I am sure this is a bit of functionality that will find good use amongst the community.

  3. #23
    JohnD's Avatar
    Join Date
    Mar 2012
    Location
    Johnstown ON
    Posts
    5,320
    Blog Entries
    1
    Will this work with the current version of Castles & Crusades?
    "I am a Canadian, free to speak without fear, free to worship in my own way, free to stand for what I think right, free to oppose what I believe wrong, or free to choose those who shall govern my country. This heritage of freedom I pledge to uphold for myself and all mankind."

    - John Diefenbaker

    RIP Canada, February 21, 2022

  4. #24
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,407
    Quote Originally Posted by JohnD View Post
    Will this work with the current version of Castles & Crusades?
    Yeah it will. Get the latest extension from here: https://www.fantasygrounds.com/forum...west-Extension and add Castles and Crusades as a ruleset to extension.xml.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #25
    Quote Originally Posted by Trenloe View Post
    Yeah it will. Get the latest extension from here: https://www.fantasygrounds.com/forum...west-Extension and add Castles and Crusades as a ruleset to extension.xml.
    I just updated the download file on my website to include "Castles and Crusades" in the ruleset list, but since I don't own this ruleset myself I cannot confirm for sure that this will work. I certainly can't see why it wouldn't, but it is the first one included I myself didn't test on my machine. Other than that, the only other change is a minor type-o correction.

  6. #26

  7. #27
    @damned: Thanks a ton!

  8. #28
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    DMFirmy - what is the code that makes your Dice Result draggable?
    I have a need to be able to drag some dice rolls for my Maelstrom ruleset.
    I can drag your Dice Result into the target field ok - but my particular rolls dont drag.

  9. #29
    Quote Originally Posted by damned View Post
    DMFirmy - what is the code that makes your Dice Result draggable?
    I have a need to be able to drag some dice rolls for my Maelstrom ruleset.
    I can drag your Dice Result into the target field ok - but my particular rolls dont drag.
    @damned: This is the thing that I had the hardest time figuring out as well. Trenloe pointed my at the answer further up the thread:

    Quote Originally Posted by Trenloe View Post
    The ability score number field only accepts drops that are a number. It doesn't recognise your customer type of "rolld" as having a number portion and so doesn't do anything with it. A quick fix is to change the rMessage.type in the createChatMessage function to be "dice", i.e. rMessage.type = "dice"; This will allow you to drag a rolld result to an ability score field and the total of the roll will be populated in the field.

  10. #30
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    hes kinda helpful isnt he...

    I/we might need him again to point me in teh right direction....

    My campaign\template_char.xml contains:
    Code:
    <!-- PC Init Roll -->
    	<template name="number_pcinitroll">
    		<basicnumber>
    			<tooltip><text>Initiative. Double Click to Roll. 2d10+Speed. Highest Initiative Acts First.</text></tooltip>
    			<rollable />
    			<anchored width="40" height="20" offset="0,100">
    			</anchored>
    
    		</basicnumber>
    	</template>
    <!-- END Init Roll -->
    and my campaign\record_char_combat.xml contains:
    Code:
    			<number_pcinitroll name="pcinit" source="char.init">
    				<anchored to="initframe" position="insidetopleft" offset="85,17" />
    
    			<script>
    				function action(draginfo)
    					local nodeWin = window.getDatabaseNode();
    					if nodeWin then
    						local rActor = ActorManager.getActor("pc", window.getDatabaseNode());
    						Debug.console("rActor:");
    						Debug.console(rActor);
    						Debug.console("end rActor!");
    						local nSpeed = window.Speed.getValue();
    						Debug.console("nSpeed:" .. nSpeed .. "!");
    						Debug.console(nSpeed);
    						local nPenalty = window.penalty.getValue();
    						Debug.console("nPenalty:" .. nPenalty .. "!");
    						Debug.console(nPenalty);
    						local nTotal = getValue();
    						local sDesc = "[INIT 2d10 + Speed - Armour Penalty] result ";
    						local rRoll = { sType = "init", sDesc = sDesc, aDice = {"d10","d10"}, nMod = nSpeed-nPenalty };
    						ActionsManager.performAction(draginfo, rActor, rRoll);
    	
    					end
    					return true;
    				end
    				
    				function onDragStart(button, x, y, draginfo)
    					return action(draginfo);
    				end
    
    				function onDoubleClick(x,y)	
    					return action();
    				end
    			</script>
    			</number_pcinitroll>
    			<number_charabilitytemp name="Speed" source="abilities.speed.temp">
    				<anchored to="initframe" position="right" offset="100"/>
    			</number_charabilitytemp>		
     			<number_armourpenalty name="penalty" source="ac.totals.penalty" />
    So Im having some difficulty identifying the right type to change....

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
  •  
FG Spreadshirt Swag

Log in

Log in