Thread: Skill Hotkey with die
-
November 1st, 2007, 03:17 #1
- Join Date
- Oct 2007
- Posts
- 3
Skill Hotkey with die
I wanted to be able to just drag a skill total down to the hotkey bar and be able to click for a check making those all too often skill checks like listen and spot a little quicker. While I worked out the code to drag the skill total down and it sets a labeled hotkey that you can click and it will then roll a d20 and add the modifer for the skill and displaying the skill name it only has the modifer from when you dragged it down so with a skill level change you have to reset the hotkey.
Locate the following code in charsheet_skills.xml and then highlight the entire selection
Code:draginfo.setType("number"); draginfo.setDescription(desc); draginfo.setNumberData(getValue());
Once you have the above segment selected paste in the code from below replacing the above text.
Code:draginfo.setType("dice"); draginfo.setDieList({"d20"}); draginfo.setNumberData(getValue()); draginfo.setDescription(desc);
You will also want to go throught setting up your chatmanager.lua via joshua's post
https://www.fantasygrounds.com/forum...ead.php?t=6015Last edited by georgethebob; November 1st, 2007 at 17:53.
-
November 1st, 2007, 07:40 #2
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
To avoid having to reset the hotkey after you add skill ranks, you can use the code I posted here.
Maybe there is a way to combine the two.... I'll see if I can find the time to figure it out!
-
November 1st, 2007, 17:06 #3
- Join Date
- Oct 2007
- Posts
- 3
Initiative now
Sounds good Hamish that would be much better.
I worked out the code for the initiative field so that you can perform the same exercise of adding a d20 when you drag from the field.
Find this section of the initiative code in both the charsheet_main.xml and charsheet_combat.xml . On my xml editor it's around line 968 for combat and 1239 for main.
Code:<source> <name>initiative.misc</name> <op>+</op> </source>
Code:<script> function onDrag(button, x, y, draginfo) draginfo.setType("dice"); draginfo.setDieList({"d20"}); draginfo.setNumberData(window.initiative.getValue()); draginfo.setDescription("initiative"); return true; end </script>
Last edited by georgethebob; November 1st, 2007 at 17:59.
-
November 1st, 2007, 18:33 #4
- Join Date
- Oct 2007
- Posts
- 3
Saves
Here is the info for setting up saves.
Find the saves section for charsheet_combat.xml and charsheet_main.xml
My editor has them at lines 1064 main and 1352 combat.
First for the combat sheet:
Find theCode:</modifiernumber>
Code:<script> function onDrag(button, x, y, draginfo) draginfo.setType("dice"); draginfo.setDieList({"d20"}); draginfo.setNumberData(window.fortitudesave.getValue()); draginfo.setDescription("Fortitude Save"); return true; end </script>
Code:<name>saves.fortitude.misc</name> <op>+</op> </source> <script> function onDrag(button, x, y, draginfo) draginfo.setType("dice"); draginfo.setDieList({"d20"}); draginfo.setNumberData(window.fortitudesave.getValue()); draginfo.setDescription("Fortitude Save"); return true; end </script> </modifiernumber>
After this repeat the entire process on the charsheet_combat.xml the only difference is where you put the code. In this .xml file you look for the following code in the saves section for each particular save:
Code:<description> <text>Fortitude save</text> </description> </save>
Code:</description>
Code:</save>
Code:<description> <text>Fortitude save</text> </description> <script> function onDrag(button, x, y, draginfo) draginfo.setType("dice"); draginfo.setDieList({"d20"}); draginfo.setNumberData(window.fortitudesave.getValue()); draginfo.setDescription("Fortitude Save"); return true; end </script> </save>
Last edited by georgethebob; November 1st, 2007 at 18:46.
-
November 6th, 2007, 09:17 #5
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
I tried combining our features, and it seems possible. I'm working on it, I still have problems with skills with sublabels.
Last edited by Hamish; November 6th, 2007 at 09:22.
-
November 6th, 2007, 10:28 #6
I posted this code in the thread regarding automatic die rolling on a double-click. This code shows the sublabel of cascade skills like Knowledge and Craft. It may help.
e.g.
Knowledge (History)
Craft (Weaponsmith)
Profession (Herbalist)
Code:function onDoubleClick(x,y) local label = window.getDatabaseNode().getChild("label").getValue(); local sublabel = window.getDatabaseNode().getChild("sublabel").getValue(); local desc = label; if not sublabel or sublabel ~= "" then desc = label .. " (" .. sublabel .. ")"; end ChatManager.d20Check("d20", getValue(), desc); return true; end
Using Ultimate license - that means anyone can play.
Valarian's Fantasy Grounds Rulesets
-
November 6th, 2007, 14:19 #7
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Thanks Valarian, but the problem is I have to do the reverse, I have to find a specific skill node in the database. For example, I know the skill I want to roll is Knowledge (Arcane), but I have to find the node number under skilllist that holds the correct value. I have a function set up to do this, but I never thought about the sublabels, so it doesn't handle those.
I'll look into it, I don't think it will be very difficult.Last edited by Hamish; November 6th, 2007 at 14:24.
-
November 14th, 2007, 20:17 #8
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Well, it was a little harder than it looked, and it turns out it was in my original coding of the database queries. I posted an update on the code here. You must implement those changes if you want to use what I post below.
As for combining our features, I have it set up for skills and abilities at the moment.
For skills change the onDrag function of the numberfield "total" to:
Code:function onDrag(button, x, y, draginfo) local label = window.getDatabaseNode().getChild("label").getValue(); local sublabel = window.getDatabaseNode().getChild("sublabel").getValue(); local desc = label; if not sublabel or sublabel ~= "" then desc = label .. " (" .. sublabel .. ")"; end draginfo.setType("string"); draginfo.setIcon("d20icon"); draginfo.setStringData("/die 1d20+{skilllist.[" .. string.gsub(desc, " ", "_") .. "].total} " .. desc); draginfo.setDescription(desc); return true; end
Code:<script> function onDrag(button, x, y, draginfo) draginfo.setType("string"); draginfo.setIcon("d20icon"); draginfo.setStringData("/die 1d20+{abilities.strength.bonus} Strength"); draginfo.setDescription("Strength"); return true; end </script>
Last edited by Hamish; November 14th, 2007 at 20:53.
-
November 15th, 2007, 10:03 #9
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
For saving throws, add the following block of code to the "modifiernumber" fields (in charsheet_main.xml) and the "save" fields (in charsheet_combat.xml): (I've shown Fortitude, just replace all occurences of fortitude for the other saves)
Code:<script> function onDrag(button, x, y, draginfo) draginfo.setType("string"); draginfo.setIcon("d20icon"); draginfo.setStringData("/die 1d20+{saves.fortitude.total} Fortitude Save"); draginfo.setDescription("Fortitude Save"); return true; end </script>
Last edited by Hamish; November 15th, 2007 at 10:07.
-
November 15th, 2007, 10:14 #10
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
For initiative rolls, add the following block of code to the linkednumber "initiative" field (in charsheet_main.xml) and to the sheetbonus "initiative" field (in charsheet_combat.xml):
Code:<script> function onDrag(button, x, y, draginfo) draginfo.setType("string"); draginfo.setIcon("d20icon"); draginfo.setStringData("/die 1d20+{initiative.total} Initiative"); draginfo.setDescription("Initiative"); return true; end </script>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks