DICE PACKS BUNDLE
  1. #1

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344

    Copy the hit location roll button

    This is a "hack" that inserts a hit-location roll button on the main tab of the character sheet that I'd like to share. The solution is not perfect. Since the button is tied to the frame you will have to resize the character sheet if you add a lot of weapons. But it will save some time since there are fewer mouse clicks and the user needs to move the mouse pointer less.

    Note. This feature doesn't, of course, make any sense if you don't use hit locations, only use it if you do. Also, when using the extension you have to click once on the button on the armor tab before the button on the main tab works, why that is I don't know.

    Either use the provided extension (BRP Hit Location Button.ext) at the bottom of this post or use the method described below.

    How-to
    1) Preparations
    1.1) Start by making a backup copy of the ruleset file (Basic Roleplaying.pak).
    1.2) Then create a dev directory somewhere. Mine is called "dev" and it's in the root of the Fantasy Grounds folder.
    1.3) Copy Basic Roleplaying.pak to the dev folder.
    1.4) Change the name of Basic Roleplaying.pak to Basic Roleplaying.zip
    1.5) Unzip the zip-file


    2) Copy existing code
    2.1) Open campaign/record_char_armor.xml in an editor (such as notepad++)
    2.2) From record_char_armor.xml copy this code:
    Code:
    <genericcontrol name="hitlocationbutton">
    	<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
    	<icon>indicator_hitlocation</icon>
    	<script>
    		function onClickDown(...)
    		       rollHitLocation(Input.isShiftPressed());
    		       return true;
    		end
    
    		function rollHitLocation(flag)
    			local charnode = window.getDatabaseNode();
    			local name = charnode.getChild("name").getValue();
    			local listnode = charnode.getChild("hitlocations");
    			if listnode then
    				Global.RollHitLocation(name,listnode,flag);
    			end
    		end
    	</script>
    	<tooltip>
    		<text>Roll hit location</text>
    	</tooltip>
    </genericcontrol>
    3) Paste into record_char_main
    3.1) Open campaign/record_char_main.xml
    3.2) Insert in record_char_main.xml, under weaponFrame", like this:
    Code:
    <frame_char name="weaponframe">
    	<anchored>
    		<left parent="" anchor="left" offset="15" />
    		<top parent="statframe" anchor="bottom" />
    		<right parent="" anchor="right" offset="-25" />
    		<bottom anchor="bottom" />
    	</anchored>
    </frame_char>
    <genericcontrol name="hitlocationbutton">
    	<anchored to="mainframe" position="insidebottomright" offset="17,16" width="20" height="21" />
    	<icon>indicator_hitlocation</icon>
    	<script>
    		function onClickDown(...)
    		       rollHitLocation(Input.isShiftPressed());
    		       return true;
    		end
    
    		function rollHitLocation(flag)
    			local charnode = window.getDatabaseNode();
    			local name = charnode.getChild("name").getValue();
    			local listnode = charnode.getChild("hitlocations");
    			if listnode then
    				Global.RollHitLocation(name,listnode,flag);
    			end
    		end
    	</script>
    	<tooltip>
    		<text>Roll hit location</text>
    	</tooltip>
    </genericcontrol>
    3.3) Save

    4) Save and re-package the ruleset.
    4.1) Zip the contents of the ruleset folder. Do this when "inside" the folder.
    4.2) Rename the zip-file to Basic Roleplaying.pak

    5) Replace the existing pak
    5.1) Move the Basic Roleplaying.pak to the ruleset folder

    6) Reload the ruleset
    6.1) Type "/reload" in the chat window
    Attached Files Attached Files
    Last edited by peterb; March 9th, 2023 at 15:15. Reason: Swapped static text res for text

  2. #2

  3. #3

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344
    I know, I have just not mastered joining/merging... This is a piece of code that sits inside a big chunk of code, so either I override record_char_main or I do some joining. There's an example in record_char_inventory but I have never been able to duplicate it. Also, I use a layered ruleset on top of Basic Roleplaying for my changes (including this one), and those are extensive since I added text resource strings so that I can translate the ruleset to, in my case, Swedish. So for me, it's not much of a problem.

  4. #4

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344
    Tested creating an extension with a join. This time I got it right. I'm going to update the first post.

  5. #5

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344
    Use this extension instead of the process described in the first post. Oddly you have to click on the button on the armor tab once and then the button on the main tab starts working. Don't really know why this is.
    Attached Files Attached Files
    Last edited by peterb; March 9th, 2023 at 14:50.

  6. #6
    Might be best to attach the extension to the first post and add a comment that either option is available.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  7. #7

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344
    Couldn't find a "attach file" button on the first post, so I did a work around.

  8. #8
    edit Post > Go advanced and it should be available.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  9. #9

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    344
    Aha, I didn't scroll far down enough...

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
  •  
STAR TREK 2d20

Log in

Log in