PDA

View Full Version : Advantages Extension (FGU 5E)



SilentRuin
February 28th, 2021, 04:22
Advantages Extension (FGU 5e) (https://forge.fantasygrounds.com/shop/items/9/view) (in the Forge now)
My personal grab bag I add simple stuff into that I want for my campaigns. Use at your own risk "as is".
Now the Forge delivery will contain 3 different extensions (broke out the more risky stuff so it could be separately loaded/unloaded without losing other functionality. This code is free for anyone to take and use even FGU.

"5e - Advantages" - Advantages.ext


V1.16 - Update - support of new chat command "/chatLogWhisperer [search string]" where [search string] is a string used to do a find on the current chatlog.html in the campaign directory and then output any session blocks that contained that string while bold/italic/underline each matching string in the Chat Log Whisperer Output window. Which is fully editable so you can mangle the text and its format (like story format) to then copy/paste to notes and share with players or put someplace else. Just something I wanted for me to freely display and edit history of chatlogs with. Delete the campaign's chatlog.html if you want it to start over (save it someplace first if you want to hold onto it). You can lock up your machine if you have a huge chatlog or some search that hits a lot of it or is formatted poorly (have to kill FGU app or sign out or reboot). The search string "raw" will get the whole chatlog.html output. Use at your own risk.



V1.17 - FGU Update - update broke templates used by chatLogWhisperer - stopped using their templates as they shift around to much.
V1.18 - FGU Update - removed ability to store group selections from record list between sessions as FGU has finally implemented it - so I no longer have to support it myself.


"5e - Advantages CharacterWizard" - AdvantagesCW.ext



https://youtu.be/ll_fXXiNo3o



V2.0 - FGU changes - major rewrite to preserve ability to use module priorities to insure that there are no duplicates in Character Wizards data lists (one with priority is only one used). Also, implemented node and childList changes to code that SW wanted.
V2.1 - FGU changes - the function I used to hook in and override the record lists was removed completely from CW - so I had to choose another function to override the records with. While this fixes the record lists for race/class/etc. the spell list they use has been rewritten to only display one spell now which they randomly choose (previously it had all spells listed with duplicate names from different modules) - I can't fix this as my code here goes through records and chooses the one based on the priority module. But if they have removed all duplicates with no rhyme or reason then CW will only provide that randomly chosen list. You can see this with or without this extension as some will be spells from PHB others from other modules. Can't fix that. I'll provide a generic fix which fixes the problem where my code was no longer executing but the way they implemented the spell list it can no longer properly respect any module priority. Nothing I can do about that for now. Other record lists in CW will contain all data so can have module priority respected - just not spell lists.

"5e - Advantages Pointer Areas" - AdvantagesPA.ext

V1.0 - Feature - New option "Target Pointer Area" that is defaulted to "off". Will store the last active pointer area you defined and use it to target any tokens within that area in the same way map target mode indicator does. In fact, the target mode icon on the map toolbar is hijacked when this option is turned on so that if it has a stored last pointer area (defined by right/mouse held down with shift/alt/ctr key held down or with right mouse draw pointers option) and there are tokens in that area it will select them unless all are already selected then it unselects them (just like normal targeting mode behavior). If nothing is found inside the stored pointer area or no stored last pointer area exists then it will do normal targeting mode behavior. The only way I could find to remove the last active pointer after all user pointers are removed from map was to turn off and back on the option. No code to determine when a pointer was removed could be found, so this was "good enough". This is User based so is only relevant for the users last active pointers regardless where that graphics originated from (if its on your map its yours as far as your map is concerned - no way to determine who "did it"). In case you are unfamiliar with pointer areas they are the temporary graphics of a circle, square, or cone that you can place in your map. Risky modification hijacking some code not meant to do what I'm doing with it (all the pointer logic I really need is buried in the engine and not exposed for access) so I'm putting this in here - free - guarded with option. Use at own risk.
Feature - for the V1.5 feature having CTR key pressed while selecting map toolbar targeting icon while an active pointer area is present will only select tokens that are same faction as selected token(s). Having ALT key pressed will only select tokens that are different faction from selected token(s). Both keys will not allow things that are not in CT to be selected. Same behavior as V1.5 - will target tokens unless all are currently targeted then it will unselect them.

https://www.youtube.com/watch?v=SEBMWAusq3Q



V1.7 - Update - set loadorder to 151 as I'm told other extensions are whacking my code. I do call partial original code when the pointers are not actually in play and or my option is off. If it conflicts disable this one or turn off the option to do pointers. As it appears usually other things work if I'm a higher load order and only my stuff does not when I'm a lower one I'll try it this way.
V1.8 - FGU update - fixes to enable this to work again in new FGU update.

Reported Conflicts:
Advantages PA does not work with Critical Awesome Essentials.

Extensions = RISK: This note is added to all the extensions I maintain. I want users to understand that extensions are code that is added to or overrides portions of code in the Fantasy Grounds Unity (FGU) application. When the underlying code in FGU changes it can break an extension. When you run with other extensions they can conflict by trying to overwrite the same parts of the FGU code. I will keep my extensions working with FGU changes, and the extensions I use (listed in my FGU signature) as I have direct control over those things. I cannot make the same promise with other extensions. If I am notified of an incompatibility I will attempt to resolve it - but if I cannot I will list what the known extension incompatibilities are. Understand before you get any extensions that it comes with RISK. Not just my extensions - any extension. These extensions are also maintained by me for me. I provide them outside of my own games purely to those who wish to take advantages of things I use for myself.

Included is original text used for describing this extension - provided for reference if needed.

SilentRuin
February 28th, 2021, 06:00
Forgot to add in the extension (sigh) Fixed.

SilentRuin
February 28th, 2021, 14:35
Added text (host only) to remembering groups between sessions.

SilentRuin
February 28th, 2021, 17:53
Caveat: If you have an empty group name then FGU does not really treat it as really in the list when you come back up. If this was the last one chosen it will show in list but pulldown will not show it - just pick a valid one or recreate the group name. This is just how those group/category lists work.

SilentRuin
March 10th, 2021, 18:00
V1.2 - Fix: needed to fake/translate DB active_category value "**" as uncategorized(true category is "") so that it could be stored in DB.

SilentRuin
April 19th, 2021, 02:48
I should warn about using hot keys that require CTRL, ALT, or SHIFT to trigger because if you put anything in a hot key that also reacts to CTRL, ALT, or SHIFT you can't really trigger it without those effects being applied. For example, with this extension if you had a CTRL hot key with some kind of dice roll it would always roll it with advantage. If you had an ALT hot key with some kind of dice roll it would always roll it with disadvantage. And if you are in regular FGU even with no extensions you had a SHIFT hot key with some kind of damage roll it would always make it a critical roll.

This is going to be true with anything you put in CTRL, ALT, or SHIFT hot key triggers because those keys will be detected by the simple act of trying to put something in that reacts to them in there.

Tatershal
May 25th, 2021, 23:47
My personal grab bag I add simple stuff into that I want for my campaigns. Use at your own risk "as is". Set for "5E - Advantages" but probably could have extension.ext file changed to support any ruleset as its pure CoreRPG code modifications I think. This code is free for anyone to take and use even FGU.

V1.0 - New Feature: Holding CRL key during button press will give ADVantage. Holding ALT key during button press will give DISadvantage.

V1.1 - New Feature: All Group selections from last session (host only) will be remembered.

V1.2 - Fix: needed to fake/translate DB active_category value "**" as uncategorized(true category is "") so that it could be stored in DB.


Extensions = RISK: This note is added to all the extensions I maintain. I want users to understand that extensions are code that is added to or overrides portions of code in the Fantasy Grounds Unity (FGU) application. When the underlying code in FGU changes it can break an extension. When you run with other extensions they can conflict by trying to overwrite the same parts of the FGU code. I will keep my extensions working with FGU changes, and the extensions I use (listed in my FGU signature) as I have direct control over those things. I cannot make the same promise with other extensions. If I am notified of an incompatibility I will attempt to resolve it - but if I cannot I will list what the known extension incompatibilities are. Understand before you get any extensions that it comes with RISK. Not just my extensions - any extension.

Included is original text used for describing this extension - provided for reference if needed.

This extension is in conflict with elven accuaracy. When we hold the ctrol to advantage, it gives an error if the elven accuaracy extension is on

SilentRuin
May 25th, 2021, 23:57
This extension is in conflict with elven accuaracy. When we hold the ctrol to advantage, it gives an error if the elven accuaracy extension is on

Not enough information to go on. You'll have to supply the error in my code here. This is a very simple extensions in that part and calls the original code - so if they are doing the same (calling the original code in what they do) there should be no issue. Super simple. Not sure what it can conflict with. UNLESS you already have the advantages set some other place - then of course you'd not want this extension.



function encodeAdvantage(rRoll, bADV, bDIS)
if Input.isControlPressed() then
bADV = true;
else
if Input.isAltPressed() then
bDIS = true;
end
end
saveencodeAdvantage(rRoll, bADV, bDIS);
end

Tatershal
May 26th, 2021, 00:02
Not enough information to go on. You'll have to supply the error in my code here. This is a very simple extensions in that part and calls the original code - so if they are doing the same (calling the original code in what they do) there should be no issue. Super simple. Not sure what it can conflict with. UNLESS you already have the advantages set some other place - then of course you'd not want this extension.



function encodeAdvantage(rRoll, bADV, bDIS)
if Input.isControlPressed() then
bADV = true;
else
if Input.isAltPressed() then
bDIS = true;
end
end
saveencodeAdvantage(rRoll, bADV, bDIS);
end


the log https://drive.google.com/file/d/1FQkm101eHbB6pfvxT8ADRY0Dc0NtBWz0/view?usp=sharing
47083

SilentRuin
May 26th, 2021, 00:11
Yeah that is not this code. I would have no idea why they are not guarding against nil values for data. You will have to check with the author or not use this code. I can fix my stuff - I can't fix someone else's. It's possible they are doing something with the other part of this code involving master index and saving of the group name - but I really have no idea. Sorry.

Tatershal
May 26th, 2021, 01:49
Yeah that is not this code. I would have no idea why they are not guarding against nil values for data. You will have to check with the author or not use this code. I can fix my stuff - I can't fix someone else's. It's possible they are doing something with the other part of this code involving master index and saving of the group name - but I really have no idea. Sorry.

Tks

SilentRuin
May 29th, 2021, 16:40
V1.3 - Fix: Changed load order to 80 to work with elven accuracy

Stv
May 29th, 2021, 16:53
Thanks for the edit Silentruin. I've just tested it and it now seems Elven Accuracy works alongside this extension correctly now.

Cheers, Steve

ghen
September 14th, 2021, 17:21
Ctl + Alt are opposite in Foundry. Any desire to make Alt = Advantage since they both start with A?

SilentRuin
September 14th, 2021, 18:18
Ctl + Alt are opposite in Foundry. Any desire to make Alt = Advantage since they both start with A?

Just switch the code in the red square in image below and you can have your own version. Unzip the .ext - edit manager_advantages.lua - reverse the flags or put in what you wish. I myself won't add confusion to those who have already been using it by adding any option to reverse them as simply changing it yourself is so simple.

49141

SilentRuin
December 22nd, 2021, 00:58
V1.4 - Feature - Charwizard has annoyed me that it hardcoded what I get to choose from. As all the global searches in FGU take the first module name match (race,class,feat,spell,background) that they hit I'm making the charwizard list choices do the same. If you have local definition that will always be taken first (how that FGU global search works). There is a new option with this extension now "Use first name match for CharWizard lists" which will not do this stuff if you turn it off (will do default hardcoded choice behavior of original code). It is defaulted to be on.

In another example of something to simple to be worth selling I add it to my example extension on what is to easy to justify selling. CharWizard is constantly giving me issues - but this one was just not worth putting up with as I use supplemental modules to the core modules and need those spells etc. presented as THE choices for the character creation. So it annoyed - so it was rewritten. Till it breaks again. Option is there in case they change it as I had to copy an entire function just to move one line up one line. Copying stuff always increases risk.

SilentRuin
January 2nd, 2022, 01:36
V1.5 - Feature - New option "Target Pointer Area" that is defaulted to "off". Will store the last active pointer area you defined and use it to target any tokens within that area in the same way map target mode indicator does. In fact, the target mode icon on the map toolbar is hijacked when this option is turned on so that if it has a stored last pointer area (defined by right/mouse held down with shift/alt/ctr key held down or with right mouse draw pointers option) and there are tokens in that area it will select them unless all are already selected then it unselects them (just like normal targeting mode behavior). If nothing is found inside the stored pointer area or no stored last pointer area exists then it will do normal targeting mode behavior. The only way I could find to remove the last active pointer after all user pointers are removed from map was to turn off and back on the option. No code to determine when a pointer was removed could be found, so this was "good enough". This is User based so is only relevant for the users last active pointers regardless where that graphics originated from (if its on your map its yours as far as your map is concerned - no way to determine who "did it"). Risky modification hijacking some code not meant to do what I'm doing with it (all the pointer logic I really need is buried in the engine and not exposed for access) so I'm putting this in here - free - guarded with option. Use at own risk.

If you ever can't get your icon to behave normally its probably because you have a last stored active pointer area still in the cache - which I can't get rid of to match when graphics goes away - so you have to turn option on and off to get it gone or close the map and bring it back up (only options for players as they don't have option as toggle) and normal behavior will be restored. Or just turn it off.

SilentRuin
January 2nd, 2022, 03:33
A note on the RISKYness of this latest update - I had to clone the <template name="image_toolbar_mode_toggle"> code so if something else changes that its incompatible with this.

SilentRuin
January 2nd, 2022, 16:44
V1.6 - Feature - for the V1.5 feature having CTR key pressed while selecting map toolbar targeting icon while an active pointer area is present will only select tokens that are same faction as selected token(s). Having ALT key pressed will only select tokens that are different faction from selected token(s). Both keys will not allow things that are not in CT to be selected. Same behavior as V1.5 - will target tokens unless all are currently targeted then it will unselect them.

SilentRuin
January 2nd, 2022, 17:41
V1.7 - Bug - Cone calculation had to be corrected for target pointer area.

SilentRuin
January 2nd, 2022, 20:51
A note about V1.5 feature - this is a kludge where I could only intercept the pointer area by some function not intended for that use. I also have no way of knowing who created the original pointer (which user) or when it is removed from the map. Different users can put in different pointers and only the last one (from the user's map's perspective) is going to be used as the active area. These pointers are constantly updated via the function I've hijacked even when you do anything to them so only the last one from the user's map's perspective is ever used. If no area is visible in graphics that does not mean one is not defined - only way to clear that data is to close the map and reopen it (its all tied to user map) or to have host turn off and on the option for enabling this behavior.

You can definitely have two different user's maps thinking they saw some other pointer "last" in their display (network, etc.) so beware. If your just using one pointer at a time it will be obvious which is active. But if lots of users are doing them at same time your area may be hijacked by the last one displayed in your map.

BushViper
January 3rd, 2022, 10:01
The recent changes to Advantages created a conflict somewhere with another extension that produces this error -- [ERROR] Script execution error: [string "image"]:10: attempt to call field 'onDrop' (a nil value)

However, I don't use Advantages and don't intend to so I don't have much interest in figuring out where the conflict lies.

SilentRuin
January 3rd, 2022, 15:10
V1.8 - Bug - Moved buttonPress template override to a higher level template in the nested FGU code for toolbars - was to try to avoid a conflict. As its as high as I can go and still function, if it still conflicts then it just does.

ColinBuckler
January 3rd, 2022, 16:50
Any chance of a quick video demo'ing the new "Risky" stuff .....

SilentRuin
January 3rd, 2022, 17:17
Any chance of a quick video demo'ing the new "Risky" stuff .....

Sure... though I only do them when I can also entertain myself at the expense of my users ;) Will post here when done.

SilentRuin
January 3rd, 2022, 18:15
Any chance of a quick video demo'ing the new "Risky" stuff .....

Will eventually get done processing in youtube... till then might be blurry.

https://www.youtube.com/watch?v=SEBMWAusq3Q

SilentRuin
January 4th, 2022, 20:22
V1.9 - Feature - provided new option "Allow CTR/ALT held key for ADV/DIS" defaulted to "on" in order to let that feature be optional.

Raddu
January 5th, 2022, 21:17
I just installed this and keep getting this error when I try targeting an area:
[1/5/2022 2:07:05 PM] [ERROR] Script execution error: [string "campaign/scripts/imagewindow_toolbar.lua"]:26: attempt to call field 'hasLastActivePtrs' (a nil value)

SilentRuin
January 6th, 2022, 01:34
I just installed this and keep getting this error when I try targeting an area:
[1/5/2022 2:07:05 PM] [ERROR] Script execution error: [string "campaign/scripts/imagewindow_toolbar.lua"]:26: attempt to call field 'hasLastActivePtrs' (a nil value)

Not sure why your image file would not have that function attached if your using my stuff. Are you using other extensions that mess with the image toolbar?

SilentRuin
January 6th, 2022, 01:50
V1.10 - Bug - some conflicts could cause image not to have my functions so guard against giving a console error (still won't work though if conflicted). Also fixed an issue with character wizard when brought up through LVL UP button in charsheet class.

Raddu
January 6th, 2022, 04:36
I don't think so, but I do have quite a few extensions. I'll have to do the old turn off/turn off with each one to see where the conflict is.

SilentRuin
January 7th, 2022, 04:12
V1.11 - Conflict - added some code to resolve a conflict with Diablobob's stuff.

SilentRuin
January 7th, 2022, 19:25
No version number update but added CW feats loading limitation for things with "AE5E" in module name just for me.

SilentRuin
January 7th, 2022, 22:40
V1.12 - Bug - had to clone entire image.lua (risky) in order to get factional drag/drop to work.

Raddu
January 7th, 2022, 23:38
I think I've found the culprit extension. Although it's no longer throwing errors, it just doesn't allow targeting in the shape. The extension is your own Combat Groups for FGU, which I updated two days ago from the DMsGuild's latest update.

SilentRuin
January 8th, 2022, 00:06
I think I've found the culprit extension. Although it's no longer throwing errors, it just doesn't allow targeting in the shape. The extension is your own Combat Groups for FGU, which I updated two days ago from the DMsGuild's latest update.

Works for me and others with combat groups as of an hour ago.

Raddu
January 8th, 2022, 00:49
OK. Went through and narrowed it down for sure. It's B9-Spell Token Extension. https://forge.fantasygrounds.com/shop/items/149/view

SilentRuin
January 9th, 2022, 00:37
V1.13 - Feature - new option to "Remove CharWizard add actions logic" defaulted to "off" that will remove the ability of CW to add its own features and traits into the action tab as extensions can already be doing that from a different source (notably my Equipped Effects and Aridhro's PHB supplemental modules).

bratch9
January 9th, 2022, 20:28
OK. Went through and narrowed it down for sure. It's B9-Spell Token Extension. https://forge.fantasygrounds.com/shop/items/149/view

I'll try and take a look, but I suspect it will be the 'image.lua' file, as Spell Tokens also interacts with this file. Assuming from your report on my forum, that 'advantage' looses its ability, this implies my extension overrides what as added by this one.

I should be able to 'detect' and pre-patch the required calls to the functions in my version to re-establish functionality. But will have to take a look to make sure the 2 extensions can operate on top/with each others.

I'll try and take a look on monday.

-pete

SilentRuin
January 9th, 2022, 22:00
I'll try and take a look, but I suspect it will be the 'image.lua' file, as Spell Tokens also interacts with this file. Assuming from your report on my forum, that 'advantage' looses its ability, this implies my extension overrides what as added by this one.

I should be able to 'detect' and pre-patch the required calls to the functions in my version to re-establish functionality. But will have to take a look to make sure the 2 extensions can operate on top/with each others.

I'll try and take a look on monday.

-pete

Yeah the changes I'm making are super RISKY because image.lua seems to have no way to partially override it - I'd not invest to heavily in making my stuff work. The image.lua file I had only my stuff I was adding in - but it kept requiring me to drag more and more in to get other things to work until I had cloned the entire file. It has an onDrop addition from Diablobob I added in - but really its a huge pain to tie things to the image file in terms of being able to use super calls etc.

bratch9
January 10th, 2022, 00:39
Yeah the changes I'm making are super RISKY because image.lua seems to have no way to partially override it - I'd not invest to heavily in making my stuff work. The image.lua file I had only my stuff I was adding in - but it kept requiring me to drag more and more in to get other things to work until I had cloned the entire file. It has an onDrop addition from Diablobob I added in - but really its a huge pain to tie things to the image file in terms of being able to use super calls etc.

Yep I know, as I also had to pull a lot of that file in. I think I replace most of it and dont bother to call the super side, which is probably why your extension breaks when loaded with mine....

Just some of the files in the ruleset are a pain to work with...

Its been a while since I looked at that specific file, so I need to refresh myself with the changes I did to make my extension work. Once I've looked at both extensions a bit I might be able to see a solution or a way to patch so both extensions can work. But its always an issue when multiple extensions play with the same sort of area of ruleset.

-pete

SilentRuin
January 10th, 2022, 01:37
Yep I know, as I also had to pull a lot of that file in. I think I replace most of it and dont bother to call the super side, which is probably why your extension breaks when loaded with mine....

Just some of the files in the ruleset are a pain to work with...

Its been a while since I looked at that specific file, so I need to refresh myself with the changes I did to make my extension work. Once I've looked at both extensions a bit I might be able to see a solution or a way to patch so both extensions can work. But its always an issue when multiple extensions play with the same sort of area of ruleset.

-pete

No literally I tried to call the super side - it does not work in all cases. Had to pull in diablobobs change to it just to get his stuff to work. Here is my description of my trials and tribulations with super and precedence - Moon gave some good answers.
https://www.fantasygrounds.com/forums/showthread.php?72053-Can-someone-explain-quot-super-quot-and-how-it-works-in-FGU

SilentRuin
January 10th, 2022, 04:30
Going to let the final stage of my changes to CW simmer a bit especially as I will be duplicating the module priority logic in my equipped effects extension.

But... I have a picture for what is coming next to make CW more like I want it to be. Whether you want it that way? Meh. You have options. You can edit out the code. You can stop using the extension ;)

No explanations. Read the panels from left to right, top to bottom. If you can figure out what I've done - grats! Probably deliver it once I'm sure its harmless to implement in EE. Then will deliver both with this ability. Gist being - in my world - when my players are faced with a myriad of duplicate spell names... well... THERE CAN BE ONLY ONE!!! (insert highlander struck by lighting in your "theater of the mind" ;) )

50885

bratch9
January 10th, 2022, 11:11
No literally I tried to call the super side - it does not work in all cases. Had to pull in diablobobs change to it just to get his stuff to work. Here is my description of my trials and tribulations with super and precedence - Moon gave some good answers.
https://www.fantasygrounds.com/forums/showthread.php?72053-Can-someone-explain-quot-super-quot-and-how-it-works-in-FGU

Yep super and the scope rules are a bit of a pain. I always look at the function I want to change and look down that code to what functions it calls, as I know those functions will be bound to a previous scope and can cause issues. Which then as you are finding out, you have to 'pull' that 'not required' function up-into your code to get the binding to work. ( Same with variables, this can cause you to have to pull loads of function and ripple out to more variables and functions to pull in... )

Also if I recall with the way the scope also works.... if the original code had pre-fixed all the function calls with 'self' it could break out of the scope on an overridden file. ( But dont quote me on this, its been a while since I was playing with this... it also has consistency issues depending on the code... )

so like this,



fileA.lua

function y()
end


function x()
local a = y();
end


overrides different to if the code was written as,



fileA.lua

function y()
end


function x()
local a = self.y();
end


Because the 'self' access the current 'scope context' at the time, which allows



fileB.lua

function y()
end


to allow your fileB.lua to override the reference call in fileA.lua 'function x' scope call to function y, which without the 'self.y' would always call the fileA.lua 'function y' and not yours.

'self' and 'super' are 'special' and in lua are not fundamental, mainly 'suggestions' on how you can 'wrap' previous context into the new script to 'extend'... its very 'how application implements' this that then can make it not like a 'virtual' type c++ keyword that you know ends up in the function table and can be changed in the sub-class as you would expect. Lua can be 'how the code was written' depends if things like 'super' variables/functions actually call as expected or not.

this sort of thing...

https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644496/Ruleset+-+Scripting



super = When scripts are layered, then the super variable is defined and can access a script which this object is based on.

self = Always refers to the outermost object with all layers applied, even if called from a lower layer.


So it would be nice if by default the ruleset and extensions always 'self.functionName' called as this would allow 'outermost' object to override 'lower layer' referenced functions..

but 'good luck' asking for that sort of 'fix' across the every bit of lua code !!

and in some cases you might want to make sure your code is 'local scope' function call to 'local scope' function..

But the way the ruleset code is current written without the use of 'self.' function calls, then 'scope' of a function calling tree can cause issues and pull code/variables into extension code that would be nice to then not have to do and take on 'merging' when things change.. pain...

-pete

SilentRuin
January 11th, 2022, 19:52
Heads up Advantages users - later today this extension will actually break into three extensions. They will still all be in Page 1 here - and in Forge "Advantages" but now they will be in 3 different .ext files due to the RISKY stuff in doing character wizard module priority and pointer areas. So page 1 will change to reflect these three things - and they will all be added to the Forge "Advantages" and need to each be selected in your load campaign to get their functionality...

Advantages.ext - will revert to its original Advantage/Disadvantage based on holding CTRL/ALT keys.
AdvantagesCW.ext - will have only the character wizard parts of the old Advantages plus new module priority stuff.
AdvantagesPA.ext - will only have pointer area stuff.

Stay tuned for later today when this happens.

SilentRuin
January 11th, 2022, 20:18
Advantages is now in 3 different extensions - still delivered in page 1 and in Forge under "Advantages Extension".

"5e - Advantages" - Advantages.ext

Holding CRL key during button press will give ADVantage. Holding ALT key during button press will give DISadvantage. All Group selections from last session (host only) will be remembered.


"5e - Advantages CharacterWizard" - AdvantagesCW.ext

Will add in Module Priority ability and allow CharacterWizard to choose only one race, class, background, spell, or feat is used in selection lists build based on first come first serve in list of modules and their priorities.


"5e - Advantages Pointer Areas" - AdvantagesPA.ext

Pointer Areas (cone, square, circle) can be used to select token targets. Caveats - Even if last placed pointer area is not visible it will still be used - only closing image window will clear it. Best have only one pointer area visible if using this.

SilentRuin
January 11th, 2022, 22:41
Quick cut paste error fixed in Advantages.ext - no version update or notification - just file in Page 1 and Forge copy.

SilentRuin
January 12th, 2022, 04:49
FGU update to CW - updated a file in AdvantagesCW.ext - no version change - page 1 and forge updated.

SilentRuin
January 12th, 2022, 05:24
Cut and paste error in update from FGU - fixed in AdvantagesCW.ext - in page 1 and forge.

meadegendar
January 12th, 2022, 15:29
Advantages PA does not work with Critical Awesome Essentials and Token Height Indication. I had to turn these off to use this feature.

bratch9
January 12th, 2022, 15:34
Advantages PA does not work with Critical Awesome Essentials and Token Height Indication. I had to turn these off to use this feature.

I suspect it will have issues with nearly every extension that plays with the map... as they all have to mess with the non-super merge-able image side of the code...

I'm sure between us all we will end up cut'n'paste some code for other extensions to make these work sort of together..

I'll be taking a look at how my extension spell_tokens interacts with the new split out version. ( I was going to check the single extention version but Silent said to wait.... )

-pete

SilentRuin
January 12th, 2022, 15:39
Advantages PA does not work with Critical Awesome Essentials and Token Height Indication. I had to turn these off to use this feature.

Put in Page 1 as listed conflicts near bottom thanks. Yes, image file overrides are likely being stomped by these things. Why I broke those modifications out into their own .ext so you could just not use it but still use other parts of advantages.

SilentRuin
January 12th, 2022, 15:41
I suspect it will have issues with nearly every extension that plays with the map... as they all have to mess with the non-super merge-able image side of the code...

I'm sure between us all we will end up cut'n'paste some code for other extensions to make these work sort of together..

I'll be taking a look at how my extension spell_tokens interacts with the new split out version. ( I was going to check the single extention version but Silent said to wait.... )

-pete

For sure - but image files are not very shareable as we discussed. Only way would be to start dragging in code from whomever is lowest on load order totem pole. The sad part is that we all are probably doing our own things safely - but we have to "add them into" something that can only be inserted with a clone of some part of the code. Which of course kills the other guy.

SilentRuin
January 12th, 2022, 19:12
Yet another CW FGU fix that needed cloning - updated here and in Forge. No version change for these things.

bratch9
January 12th, 2022, 20:33
For sure - but image files are not very shareable as we discussed. Only way would be to start dragging in code from whomever is lowest on load order totem pole. The sad part is that we all are probably doing our own things safely - but we have to "add them into" something that can only be inserted with a clone of some part of the code. Which of course kills the other guy.

Yep I've taken a look, and basically I'd have to pull most of your extension into my code. ( As much of the work is in image.lua, much like in mine.. )

One way that might be possible, would be if you reduced the code in image.lua by adjusted things like check_point and onMeasurePointer, so they passed the 'local LastActivePtrs' into a global file script call function.



image.lua file...

function onMeasurePointer(pixellength, pointertype, startx, starty, endx, endy)
-- We are hijacking this label code to know when pointers we are interested in are placed or changed
local retStr = nil; -- we will not do anything with label but if someone ever does we can handle the that code first
if super and super.onMeasurePointer then
retStr = super.onMeasurePointer(pixellength, pointertype, startx, starty, endx, endy);
end
imagePA.onMeasurePointer(pixellength, pointertype, startx, starty, endx, endy)
return retStr;
end

function point_check(checkPt)
imagePA.point_check(checkPt, LastActivePtrs)
end


So that your image.lua only has the 'local LastActivePtrs' and mainly just stub functions that call out passing the data around...

That way I can do a function check in my extension for 'if imagePA and imagePA.point_check' (etc..) and include the required calls to 'imagePA.onMeasurePointer(pixellength, pointertype, startx, starty, endx, endy)' in my image.lua file and have them call your functions against a 'local LastActivePtrs' data in my image.lua.

At least in this way only a very slim part of your extension functions exist in the image.lua, and that code I can simply copy into my image.lua and 'call' into your global script that does the work. ( Without duplicating the bulk of the 'work' code.. )

But I'm not sure if this is a suitable thing to do. I dont know if people would use the 'PA' part with my spell tokens extension as they can target off the spell token for the shape and it tracks 'who' that belongs to so targets get added/removed to the 'owner' of the spell. And your 'PA' version is just replicating that by grabbing the last measure pointer on the map. ( I guess maybe on a spell/action type that does not have a registered spell token in my system, that needs a target shape would use your PA part. )

So I think now you have 'split' out the 'PA' part users can decide to have most of your other extensions and pick to use your 'PA' part or my 'spell tokens' side. I'm not sure that we need to 'make both work' when active, it seems like a very very small user case now.

If you do feel like moving the bulk adding/processing/clear functions from image.lua into a '<script name="imagePA" file="scripts/imagePA.lua" />' and stub these into a slim image.lua file... then just ping me a DM once done and I'll look to call these from my image.lua side so that both extensions can co-exist.

I'm not sure its a worth while thing to do, maybe your users and my spell token users can comment if they want us to make these work together or if now its split they are happy to pick one or the other....

-pete

SilentRuin
January 12th, 2022, 21:03
Yep I've taken a look, and basically I'd have to pull most of your extension into my code. ( As much of the work is in image.lua, much like in mine.. )

One way that might be possible, would be if you reduced the code in image.lua by adjusted things like check_point and onMeasurePointer, so they passed the 'local LastActivePtrs' into a global file script call function.



So that your image.lua only has the 'local LastActivePtrs' and mainly just stub functions that call out passing the data around...

That way I can do a function check in my extension for 'if imagePA and imagePA.point_check' (etc..) and include the required calls to 'imagePA.onMeasurePointer(pixellength, pointertype, startx, starty, endx, endy)' in my image.lua file and have them call your functions against a 'local LastActivePtrs' data in my image.lua.

At least in this way only a very slim part of your extension functions exist in the image.lua, and that code I can simply copy into my image.lua and 'call' into your global script that does the work. ( Without duplicating the bulk of the 'work' code.. )

But I'm not sure if this is a suitable thing to do. I dont know if people would use the 'PA' part with my spell tokens extension as they can target off the spell token for the shape and it tracks 'who' that belongs to so targets get added/removed to the 'owner' of the spell. And your 'PA' version is just replicating that by grabbing the last measure pointer on the map. ( I guess maybe on a spell/action type that does not have a registered spell token in my system, that needs a target shape would use your PA part. )

So I think now you have 'split' out the 'PA' part users can decide to have most of your other extensions and pick to use your 'PA' part or my 'spell tokens' side. I'm not sure that we need to 'make both work' when active, it seems like a very very small user case now.

If you do feel like moving the bulk adding/processing/clear functions from image.lua into a '<script name="imagePA" file="scripts/imagePA.lua" />' and stub these into a slim image.lua file... then just ping me a DM once done and I'll look to call these from my image.lua side so that both extensions can co-exist.

I'm not sure its a worth while thing to do, maybe your users and my spell token users can comment if they want us to make these work together or if now its split they are happy to pick one or the other....

-pete

Personally I'd just prefer FGU did it. As there is no reason those pointer areas should not be useable as I've shown (and they have access to the engine code so could do it a lot cleaner). And yes its broken out so nobody has to use it (but me) :) The check point code is not the conflicting bit so won't solve the problem as its arbitrary where I put it. Its the fact I have to have the pointer area associated with individual imagecontrol's image data and that onMeasurePointer seems to force me to drag in a bunch of stuff I don't use or need to work. We likely will just have to conflict as I have to have that onMeasurePointer trigger in there - and for whatever reason that forces every other trigger to be dragged in with it in order to work. No idea why. But that is what I found out when I tried to only put in things I needed to override.

Like I said earlier - touching image.lua is just a very conflicty thing to do. Same with characterwizard - why those parts are both their own .ext so people can "not use them at all". I'm fine with them as I don't use anything else but what is in my signature. If there is a way to intercept the onMeasuerPointer without having to drag in the world I'm all for it. But for whatever reason I could not find it.

SilentRuin
January 13th, 2022, 05:14
Videos added to page 1. (one might still be processing in youtube at time of this post).

TheSuperButt
March 10th, 2022, 16:04
I get the following console warning and error when opening the CW with AdvantagesCW. I figured it was because of conflict but I don't have any other extension that messes with the CW.

[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_stats) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_races) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_class) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_back) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_feats) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_import) does not exist
[3/10/2022 9:55:25 AM] [WARNING] bitmapwidget: Logical icon (tab_warnings) does not exist
[3/10/2022 9:55:25 AM] [ERROR] Script execution error: [string "charwizard/scripts/charwizard.lua"]:186: attempt to index local 'sModule' (a nil value)

SilentRuin
March 10th, 2022, 16:27
AdvantagesCW.ext - V1.3 - Bug - specialized module guard for my personal "AE5E" modules that have feats that are not really feats had a mistake causing error for "non me" people.

Updated in Forge also.

SilentRuin
March 10th, 2022, 16:28
Fixed - I think.

I commend your boldness and bravery on using such a RISKY extension. FGU CW changes frequently enough that it can get easily out of date - plus of course - this was designed for my personal preferences and shared to those who are willing to incur that RISK :)

TheSuperButt
March 10th, 2022, 20:21
Hey man, I like the extension. What can I say.

SilentRuin
March 16th, 2022, 21:31
V1.4 - FGU changes - updated to match changes in FGU CW. Appeared as content error on commit.

SilentRuin
March 26th, 2022, 07:02
AdvantagesPA.ext - V1.2 - Bug - made sure targeting only targets map tokens that are in combat tracker list.

SilentRuin
June 17th, 2022, 21:29
AdvantagesCW - V1.5 - Bug - module priority should only be visible to host.

SilentRuin
July 12th, 2022, 22:36
Updated delivery just in case for new FGU updates.

SilentRuin
July 13th, 2022, 20:44
AdvantagesCW - V1.6 - FUG changes - updated to match changes in FGU CW.

similarly
July 31st, 2022, 00:57
When I have "5e - Advantages CharacterWizard" loaded, when leveling up a character using the "level up" button, it creates a new, blank character sheet with the same character name, but no other information. Not sure long how this might have been an issue since I haven't needed to level up a character in a really long time.

53807

SilentRuin
July 31st, 2022, 01:12
When I have "5e - Advantages CharacterWizard" loaded, when leveling up a character using the "level up" button, it creates a new, blank character sheet with the same character name, but no other information. Not sure long how this might have been an issue since I haven't needed to level up a character in a really long time.

53807

Likely something changed that I have to compensate for again. I'll check into it tomorrow.

SilentRuin
July 31st, 2022, 19:11
V1.7 - Bug - LVL UP will not function properly unless I completely override every function in charwizard.lua - which I don't understand. I'm going to do that for now but I don't like it.

As usual this is the most RISKY of my extensions to use as CW changes so much. It just got more RISKY due to this. Personally I'll still use it for me but I put you on notice - you take your own chances if you use it for you!

similarly
August 1st, 2022, 02:16
I'll play with it and see if my FGU campaign explodes. I'll let you know how it works. Thanks, as always, for your amazing efforts.

knorbet77
October 29th, 2022, 06:20
Hi Silent Ruin, I just noticed that the Advantages extension doesn't play nice with the dice tower. Not a huge deal but with only this extension loaded, dropping a d20 on the dice tower with either Control or Alt depressed results in the following error.

54910

SilentRuin
October 29th, 2022, 16:20
Hi Silent Ruin, I just noticed that the Advantages extension doesn't play nice with the dice tower. Not a huge deal but with only this extension loaded, dropping a d20 on the dice tower with either Control or Alt depressed results in the following error.

54910

I can't do anything about that. If you note - hitting the pure FGU with no extensions and clicking the adv button and dropping 20 sided into dice tower will do the exact same thing. All advantages does is trigger that FGU functionality. It's bugged so you'll have to report that to FGU.

knorbet77
October 29th, 2022, 23:21
I can't do anything about that. If you note - hitting the pure FGU with no extensions and clicking the adv button and dropping 20 sided into dice tower will do the exact same thing. All advantages does is trigger that FGU functionality. It's bugged so you'll have to report that to FGU.

Good point. I just checked and it seems to be a known issue: https://www.fantasygrounds.com/forums/showthread.php?75605-(5e)-New-Dice-ADV-DIS-Dice-Tower-throws-console-errors

SilentRuin
November 16th, 2022, 16:38
AdvantagesCW extension - V1.8 - FGU changes - does not "appear" I need to copy whole charwizard.lua per V1.7 anymore.

SilentRuin
February 5th, 2023, 04:45
[Post not relevant any longer]

SilentRuin
February 10th, 2023, 05:50
Looks like AdvantagesCW will ride again - still need some work to streamline my duplicate checks for the uber large spell/equipment list (think PHB,DMG,MM,MtoM, and their supplemental data from 5EAE (PHB, DMG,MM, MtoM).

But it is going to happen. AdvantagesCW will live on.

SilentRuin
February 10th, 2023, 21:33
AdvantagesCW V2.0 is now out on TEST for anyone who wants to try it.

Basically the same things it did before...

If any duplicate named entry is found in any list (class/race/spells/equipment/etc.) then the module priority rules will determine which one is used as there can only be one in Equipped Effects when it name matches - this forces that same selection here.

For all identical names:

If local DB - it is the one kept.
If module priority is used and defined for the modules involved - then the lowest number (if defined) is kept - ties go to whomever processes first.
If module priority is not used or defined in any of the names - then the lowest alphabetical module is used (same as global search returns by default unless some module has been loaded during runtime - hence why module priorities were created so that this could not be left to chance - but if it is - this is the rule)

SilentRuin
March 11th, 2023, 16:53
V1.16 - Update - support of new chat command "/chatLogWhisperer [search string]" where [search string] is a string used to do a find on the current chatlog.html in the campaign directory and then output any session blocks that contained that string while bold/italic/underline each matching string in the Chat Log Whisperer Output window. Which is fully editable so you can mangle the text and its format (like story format) to then copy/paste to notes and share with players or put someplace else. Just something I wanted for me to freely display and edit history of chatlogs with. Delete the campaign's chatlog.html if you want it to start over (save it someplace first if you want to hold onto it). You can lock up your machine if you have a huge chatlog or some search that hits a lot of it or is formatted poorly (have to kill FGU app or sign out or reboot). The search string "raw" will get the whole chatlog.html output. Use at your own risk.

/chat raw

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=56665&d=1678554008

/chat [Ff]umble

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=56666&d=1678554038

SilentRuin
July 11th, 2023, 17:45
AdvantagesPA - V1.6 - Update - added an image function to get the last stored pointer data (used in Generic Actions to place an asset scaled and centered to that last stored ptr). Added a new map toolbar button to clear last stored data pointer that we store when cone, circle, or rectangle pointer object is stored (no way to track in FGU so we have to permanently store it and this new button will be only way to remove it).

SilentRuin
July 31st, 2023, 05:08
AdvantagesPA.ext - V1.7 - Update - set loadorder to 151 as I'm told other extensions are whacking my code. I do call partial original code when the pointers are not actually in play and or my option is off. If it conflicts disable this one or turn off the option to do pointers. As it appears usually other things work if I'm a higher load order and only my stuff does not when I'm a lower one I'll try it this way.

SilentRuin
October 4th, 2023, 16:39
AdvantagesCW - V2.1 - FGU changes - the function I used to hook in and override the record lists was removed completely from CW - so I had to choose another function to override the records with. While this fixes the record lists for race/class/etc. the spell list they use has been rewritten to only display one spell now which they randomly choose (previously it had all spells listed with duplicate names from different modules) - I can't fix this as my code here goes through records and chooses the one based on the priority module. But if they have removed all duplicates with no rhyme or reason then CW will only provide that randomly chosen list. You can see this with or without this extension as some will be spells from PHB others from other modules. Can't fix that. I'll provide a generic fix which fixes the problem where my code was no longer executing but the way they implemented the spell list it can no longer properly respect any module priority. Nothing I can do about that for now. Other record lists in CW will contain all data so can have module priority respected - just not spell lists.

SilentRuin
November 29th, 2023, 00:55
2.2 TEST only - Advantages CW - Character Wizard changed format of all the tables I use. If the next update after this causes so much grief and effort on my part, I will probably delete this .ext out of Advantages and leave people to press FGU for the behavior I provide here. Notably the ability to limit your players to a single set of choices based on module priority and local DB overrides of data.

SilentRuin
December 10th, 2023, 18:04
Advantages - V1.17 - FGU Update - update broke templates used by chatLogWhisperer - stopped using their templates as they shift around to much.

Note this option can lock up the app with "raw" search as if you have a chatlog that is big (most are) it can take a long while to stick out on FGU text fields. Always stick to search if you use this - for example:

/chatLog 2023%-12%-10

would get logs for today (as of this post). As per all my extensions - use at your own risk. Note I used "chatLog" instead of "chatLogWhisperer" as FGU will find the first unique matching chat text command it can find.

SilentRuin
December 29th, 2023, 19:35
Advantages - V1.18 - FGU Update - removed ability to store group selections from record list between sessions as FGU has finally implemented it - so I no longer have to support it myself.

Mazzar
April 1st, 2024, 05:33
Hi @SilentRuin. I just installed the Advantages Pointer Area Extension.. I believe it might not be working in the latest version of FGU. They made updates to the map and the buttons so maybe that has something to do with it. I create the pointer and press the Target Mode button, but nothing happens. I wanted to bring this to your attention. I was looking for an extension like this (surprised SW did not have this functionality within FGU)

SilentRuin
April 1st, 2024, 07:22
Hi @SilentRuin. I just installed the Advantages Pointer Area Extension.. I believe it might not be working in the latest version of FGU. They made updates to the map and the buttons so maybe that has something to do with it. I create the pointer and press the Target Mode button, but nothing happens. I wanted to bring this to your attention. I was looking for an extension like this (surprised SW did not have this functionality within FGU)

Works fine. Either you have a conflict (turn off all your extensions but this one) - or your not following the directions where the right/left mouse button held down to draw FGU pointer with CTRL, SHIFT, or ALT did not have a selected token for it to apply to when you hit the target button (with left mouse optionally with CTRL or ALT). If its not a conflict I'd recommend reading/watching the videos carefully on how it works - how it lingers around in memory unless cleared with map tool even if no longer visible etc.

If its a conflict likely you'll have to choose between the the conflicting extensions on which one you want to use or not. I use these and it works fine... but I'm sure someone could stomp some of the code AdvantagesPA uses in which case that would be that.

If you want to know what extensions I use myself in my extension.xml file for most of my campaigns they are:



<?xml version="1.0" encoding="utf-8"?>
<extensionstate version="4.5" dataversion="20230911">
<extension name="NaturalSelection" />
<extension name="Turbo" />
<extension name="Advantages" />
<extension name="AdvantagesCW" />
<extension name="DeathIndicatorEx" />
<extension name="MapParcel" />
<extension name="Polymorphism" />
<extension name="Sounds - VLC" />
<extension name="CombatGroups" />
<extension name="AssistantGM" />
<extension name="Carrier" />
<extension name="EquippedEffects" />
<extension name="EffectiveInitiative" />
<extension name="BetterCombatEffectsGold" />
<extension name="GenericActions" />
<extension name="GenericActionsLayer" />
<extension name="AdvantagesPA" />
<extension name="FG-Aura-Effect" />
<extension name="Theme_SirMotte_Hearth" />
</extensionstate>


This was tested on the host and the player(local client) before I wrote this.

SilentRuin
April 1st, 2024, 17:49
Well turns out as GP and I had all these in TEST and I was not around when it went to LIVE I completely forgot about the two I actually manage (this and Death Indicators) on forge.

It was still in TEST. Now set to LIVE so good find by a USER no less!

What the other 100's of users were doing for the last month -- well my opinion of users (in general - good find Mazzar) has not changed!

Hit the CHECK FOR UPDATES button in FGU because as you know extensions never turn it red or show it needs updating.