Thread: 7th Sea / Roll & Keep?
-
February 3rd, 2015, 14:18 #21
You can replace the rolled dice list inside a die handler, intercepting the results and replacing them with a new die list for output to the chat message. This is what I do for Yggdrasill. Replace the rolled list (of 3 or 4 dice) with the sorted list (of 2 or 1). Inside the die handler, I choose the highest results to display to the chat log.
The issue I'm currently struggling with is the modifier stack. It seems to work for dragging the dice but not for the double-click (where I use Comm.throwDice instead of draginfo). I can't seem to create a draginfo object for the double-click function to use, and the separated throwDice function seems to clear and overwrite the modifier stack.Code:-- This file is part of the Fantasy Grounds Open Foundation Ruleset project. -- For the latest information, see https://www.fantasygrounds.com/ -- -- Copyright 2008 SmiteWorks Ltd. -- -- This file is provided under the Open Game License version 1.0a -- Refer to the license.html file for the full license text -- -- All producers of work derived from this material are advised to -- familiarize themselves with the license, and to take special -- care in providing the definition of Product Identity (as specified -- by the OGL) in their products. -- -- All material submitted to the Open Foundation Ruleset project must -- contain this notice in a manner applicable to the source file type. function onInit() ActionsManager.registerResultHandler("skilldice", handleSkillDice); end function handleSkillDice(rSource, rTarget, rRoll) local reroll = false; local total = {}; local firstResult = 0; local secondResult = 0; local dicetable = rRoll.aDice; if dicetable then for n = 1, table.maxn(dicetable) do if dicetable[n].type == "d10" then if firstResult > 0 and dicetable[n].result > secondResult then secondResult = dicetable[n].result; total[2] = dicetable[n]; elseif dicetable[n].result > firstResult then firstResult = dicetable[n].result; total[1] = dicetable[n]; end end end end if firstResult == 10 or secondResult == 10 then repeat local reroll = false; local dieRoll = math.random(1,10); local explode = {}; explode.type = "d10"; explode.result = dieRoll; table.insert(total, explode); -- Purely for effect - roll a d10 local dice = {}; table.insert(dice, "d10"); Comm.throwDice("explode", dice, 0, "explode"); if dieRoll == 10 then reroll = true; end until not reroll end local rMessage = ChatManager.createBaseMessage(rSource, rRoll.sUser); rMessage.type = rRoll.sType; rMessage.text = rMessage.text .. rRoll.sDesc; rMessage.dice = total; rMessage.diemodifier = rRoll.nMod; -- Check to see if this roll should be secret (GM or dice tower tag) if rRoll.bSecret then rMessage.secret = true; if rRoll.bTower then rMessage.icon = "dicetower_icon"; end elseif User.isHost() and OptionsManager.isOption("REVL", "off") then rMessage.secret = true; end -- Show total if option enabled if OptionsManager.isOption("TOTL", "on") and total and #(total) > 0 then rMessage.dicedisplay = 1; end Comm.deliverChatMessage(rMessage); ModifierStack.reset(); return true; endUsing Ultimate license - that means anyone can play.
Valarian's Fantasy Grounds Rulesets
-
February 3rd, 2015, 14:31 #22
That example is how you usually do it, but in my case I want to truely intercept with existing handlers. For instance, you have 4E ruleset which implements "ability" handlers. What I wanted to do is intercept "ability" handlers by managing rolled dices as exploded ones and replace results with new ones, then let the flow continue in original handlers. I don't want to affect existing handlers at all, just apply interceptors between them. This way you could easily implement new dice interceptors such as exploding dices outside the core logic. However like mentioned, I was not able to succeed on this. Maybe I will double check since I cannot see reason why setDieList after onDiceLanded would kill this approach. Maybe it's something beyond visible API
"Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness
Post your SavageWorlds ruleset feature requests and issue reports here!
-
February 13th, 2015, 05:06 #23Crusader
- Join Date
- Jun 2014
- Posts
- 17
There wasn't one, really - I just got very offended by some rather insulting comments directed at me and the way the mods handled it and left the boards to cool off for a while.
Since this thread now shows up high on Google when simply looking for virtual tabletops supporting R&K, I figured I should probably clarify that.
Initiative remains the main stumbling block for automating this ruleset, and I'm contemplating using Tabletop Simulator of all things to handle it, possibly next to FG as a diceroller to help with the math overload R&K can cause.
-
June 15th, 2016, 13:25 #24
Hello gurus - can anyone help me modify this script so that it displays the characters portrait and name when the roll is executed?
I can add the name but all other rolls also display the portrait and I cant work it out...
Im also trying to expand the /rnk to use any d?? that is passed to it and while that is a whole other story feel free to chime in if you have some pointers there too!
If you want the code at the point I have it to let me know...
Im pulling these into the MoreCore ruleset so they are more easily available.
-
December 5th, 2016, 02:25 #25Ongoing Campaigns:Zeitgeist Adventure Path|:|4e Tyranny of Dragons || Finished Campaigns:Tyranny of Dragons|:|Rage Of Demons
-
December 5th, 2016, 02:39 #26
-
December 5th, 2016, 07:00 #27
Thanks damned. I plan to try figuring this out this week. I hope you're all prepared for more questions when I inevitably break something.
Ongoing Campaigns:Zeitgeist Adventure Path|:|4e Tyranny of Dragons || Finished Campaigns:Tyranny of Dragons|:|Rage Of Demons
-
December 5th, 2016, 09:26 #28
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)

Reply With Quote


Bookmarks