PDA

View Full Version : The weight of the coins



Zuger
November 16th, 2017, 09:43
Hello everybody,

This is an extension that compute the weight of the coins for DD5E.

This is my first extension, so advices and comments are welcome. So are bug reports (if any) :)

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=21536&d=1511184054

Updated version

Zacchaeus
November 16th, 2017, 10:41
Hi Zuger, well done.

Unfortunately you've zipped up the extension wrongly. When zipping up your extension only zip the contents of your folder not the top level folder itself. The way you have it now the extension doesn't show up in the extension list. So go back to your folder and only zip up the file called extension.xml and the scripts folder, not the folder called coins-weight.

(You may also way to say a word or two about how the extension can be used :))

Zuger
November 16th, 2017, 10:57
My bad, sorry, this is a new version of the extension that is working :)

The extension is very simple to use. Once activated, you will see a Coins field in the Encumbrance area. Each time you change the coins values this field will reflect the weight according to the DD5E rules. That's it :)

JohnD
November 16th, 2017, 15:15
Nice. Please maintain this going forward through new versions.

MarianDz
November 16th, 2017, 19:19
nice thanks :)

kylania
November 17th, 2017, 06:42
Very cool extension, just what I've been looking for! Thanks. :)

I've managed to split it out so you can see weight, coin weight and total weight, and per coin weight but was wondering if you had some idea for making it update the values when inventory is changed? Couldn't find quite the right syntax to make that happen - only when you changed a coin value.

https://i.imgur.com/p16Qunn.jpg

Zuger
November 17th, 2017, 08:21
You have a function called updateEncumbrance in manager_char.lua. Maybe you where there already ?

I guess you have to override this method, but how you call the overridden function is still a mystery for me.

damned
November 17th, 2017, 09:31
You will need to look at the code that updates the Current value and tell it to update the Coins+Gear value at the same time.

skj310
November 17th, 2017, 11:49
Well done Zuger! Well done.
Question though: the ext above, it doesn't have the Coins+Gear textbox as in the pictures of this thread. Is that cause you are working on it still?

kylania
November 17th, 2017, 16:19
Well done Zuger! Well done.
Question though: the ext above, it doesn't have the Coins+Gear textbox as in the pictures of this thread. Is that cause you are working on it still?

The default version adds one field with coin weight in it. The Coin+Gear is a feature I added to my copy.

I'd been trying to figure out how to do this sort of thing and used Zuger's great extension to learn from.

Zuger
November 17th, 2017, 18:36
Yes skj310 this part still has to be done.

kylania i suggest we talk about how to make this work on this thread : https://www.fantasygrounds.com/forums/showthread.php?41054-Best-way-to-create-an-item-in-a-character-s-inventory
which seems to be a better place if a understood the structure of the forum right ^^

ddavison
November 17th, 2017, 18:40
Another option would be to add an inventory item called Coins and programmatically adjust the weight of that single inventory item. The encumbrance functions would not need to be overridden at all and you would further have the option to identify whether or not you were carrying it, it was in your backpack, on your horse, wagon or whatever. I could see a scenario where adventurers are leaving a cave loaded down with bags of coins and then set upon by bandits or the cave's occupants. Most warriors would drop the bags to the ground, battle it out and then go back for their loot once the threat has passed.

Zuger
November 17th, 2017, 19:24
Another option would be to add an inventory item called Coins and programmatically adjust the weight of that single inventory item.
That was how I wanted to do it first, but I wasn't able to create an item in the DB. I will check this way once I'll be better skilled.

I like the idea of being able to drop your load.

Zuger
November 18th, 2017, 05:08
By the way ddavision as adeveloper could you help us to create an item in the DB ?

I'm wasn't far from it, but wasn't able to determine how to get the internal id of the item in the DB.
That was my initial thread about it : https://www.fantasygrounds.com/forum...er-s-inventory

kylania
November 18th, 2017, 07:15
That was my initial thread about it : https://www.fantasygrounds.com/forum...er-s-inventory

Fixed link: https://www.fantasygrounds.com/forums/showthread.php?41054-Best-way-to-create-an-item-in-a-character-s-inventory

Personally I'd settle for just finding an item called Coin Weight or Coins that was manually created.

damned
November 18th, 2017, 07:45
If you want to be able to simulate dropping the coins/encumbrance you could also do that with a check box beside the new weight.

Zuger
November 20th, 2017, 13:19
Hello a new version including total :)

Note : for existing players, you have to change coins or inventory to have the right total. I'll try to fix that soon.

damned
November 20th, 2017, 14:05
Without digging too deep I think you should look at:

\campaign\scripts\char_invlist.lua
and the function: onEncumbranceChanged

or
\campaign\scripts\manager_char.lua
and the function: updateEncumbrance

Im thinking probably the second one.. edit that function...

Three of Swords
February 7th, 2018, 23:45
Any plans to update this extension now that the base character sheet has changed?

kylania
February 8th, 2018, 02:41
Any plans to update this extension now that the base character sheet has changed?

The version I have seems to work just fine in the new version of FG. Are you getting errors or bugs?

Three of Swords
February 9th, 2018, 00:18
On my character sheet, the Total value overwrites the Lift/Push/Drag value since it is shifted due to the inclusion of additional fields.

I was able to make it work by editing the XML in Zuger's extension, but others might not be able to do so.

Here is a screen cap of how my character sheet displays:

22153

Without modifications, the Coins field is left of Current, and Total is left of Coins, overlapping Lift, Push, Drag. I'm using the default 5e character sheet. Maybe there's a setting I have enabled that is causing the issue.

Zuger
February 11th, 2018, 18:54
Hello,

On my version they are overlapping. What happens when you increase the size of your character sheet ?

Three of Swords
February 11th, 2018, 19:04
That would probably fix it. I'll revert my change, test it, and report back this evening.

YAKO SOMEDAKY
April 15th, 2018, 00:18
What does the / ccweight command do?

Zuger
April 15th, 2018, 11:36
It is a function that recompute the weight. Not really useful today, but I left it in case of.

Mentalic
April 24th, 2018, 17:13
This is cool. Is there a way to add a toggle to each of the coin boxes? Like, if they drop it before battle, put some of it on a mount, use a floating disc, etc?

Zuger
April 25th, 2018, 07:09
Would a on/off button do the job ?

Mentalic
April 25th, 2018, 09:01
Not sure a single toggle would do it. I am just thinking of a situation where the player wants to track certain coins they have but aren't carrying. Like in the inventory, they can designate that for every item and that determines if it counts or not for encumbrance.

I can see a player loading his copper onto his mule or tenser's floating disc or what have you but maybe holding onto his gold or platinum. Similarly, maybe they have some gold in a stronghold or npc bank but not with them. If there were a tiny toggle for each coin box, that could do it.

Not sure if that could be addressed with this implementation. If it could, great. If not, this is still a useful extension and I thank you for it.

LordEntrails
April 25th, 2018, 16:39
A vehicle or second PC named "mule" or "wagon" is more versatile than just something in this extension that allows for calculating uncarried weight. But, if this extension were to allow coins to be marked as carried/uncarried/equipped like inventory items did, it might help your use case.

Trenloe
April 25th, 2018, 18:01
Without changing the extension you could create an item in your inventory - call it 10,236 cp (or whatever), give it a location and weight (if needed), equip/unequip as required and then remove the 10,236 CP from the money entry. Sure, it won't give you your total money all in one place, but I think it gives more options that just an equip/un-equip button next to each coin type - you'll be able to track where the coins are as well.

Aedus Amaterasu
April 27th, 2018, 23:34
Awesome thanks for sharing this, very useful.

damned
April 28th, 2018, 08:33
Hey Zuger i have made a small coding tutorial video and I have extended this extension as the content of the video. It addresses in a very basic way one method of being able to track carried and non carried treasure.
https://youtu.be/x4leZBomtOc
And the extension is here - feel free to use or not.
23256
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=23256

Also any comments about splitting the code into different files are personal preference and not a criticism.

Zuger
May 2nd, 2018, 20:27
Awesome job :)


Also any comments about splitting the code into different files are personal preference and not a criticism.

No worry that was my first extension, I know it was duct taped ;)

frostbyte000jm
November 21st, 2018, 01:31
I am getting the following error when using the original extension.

When i try and change the amount in the coins section I get the following:

Script Error: [string "scripts/coins_weight.lua"]:52: attempt to perform arithmetic on a string value

Any idea why?

frostbyte000jm
November 21st, 2018, 02:23
Weird. ok I had to do a check on the coin to see if it is returning a number, if so then do the weight. I think something got stuck on this character sheet and I couldn't see it. It is working now, but I needed to revise the code. What I did was garbage trying to figure it out. I will try again in the morning with not 2 - 13 hour days of work brain. :)

Zuger
November 22nd, 2018, 12:14
Hello,

Did you find the solution of your problem ?

frostbyte000jm
November 22nd, 2018, 13:02
Yes, my problem was an old character sheet. I have been training myself on development in FG by rebuilding extenstion and I forgot to delete and build a new character when I started looking into yours.

There was a coin box with a nil value in it and your ext didn’t like that. Rookie mistake on my part. The moment I deleted the character sheet and started a new one, everything worked as expected.

Thanks for reaching out.

Zuger
November 26th, 2018, 20:55
Thank you for your reply. This could help somebody having the same issue.

Ken L
November 26th, 2018, 21:26
IIRC, 3.3.7 has some kind of currency manager being introduced which may/may-not deal with weight. I glossed over it as I was just merging 3.3.7 with some of my personal extensions.

Moon Wizard
November 26th, 2018, 22:06
It does not deal with weight, just adds the idea of campaign-specific currency settings. This may eventually lead to more advanced features, such as weight and/or conversion calculations; but there are no plans at this point.

Regards,
JPG

esmdev
November 27th, 2018, 15:56
I like the idea of campaign specific currency. It seems like the weight part might be difficult given that the actual weight of a coin can also very from campaign to campaign.

Steffen_de_Wolff
April 27th, 2019, 21:17
I love this extension the only thing I am finding is that when characters are adding packs (and I don't know if it has to do with the ext or not) is the characters are showing a different number of items than they are supposed to have so the total weight and the current weight don't match up. I have found this during Character creation classes the (ex: character is supposed to have 10 rations I as the host looking at his sheet see 10 rations the player is only showing 1 on his sheet)I have been having them change the number to the correct amount and the weights equal out only seems to affect the amounts from the packs. and it doesn't do it when the ext isn't loaded I don't think

Norgewalk
August 7th, 2019, 21:26
Hey Zuger i have made a small coding tutorial video and I have extended this extension as the content of the video. It addresses in a very basic way one method of being able to track carried and non carried treasure.
https://youtu.be/x4leZBomtOc
And the extension is here - feel free to use or not.
23256
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=23256

Also any comments about splitting the code into different files are personal preference and not a criticism.

damned,
First I want to say that I think your changes are wonderful and would like to thank you for making the video as well.

I have one concern/issue to bring up:
If the extension is enabled and coins are added if the extension is disabled the coin data is 'lost' (or at least not visible).
It does return when the extension is enabled again.
My concern is losing that information if you need to disable the extension for some reason or if it stops working due to a FG update.

Is it possible to do something like...
Use two new data field/variables to hold the values for carried/not carried that are used in this extension (B&C)
and use the original value data field/variable (A) to hold the total of the two unique ones for this extension (B&C)
With the original not displayed when the extension is enabled but when it is not maybe the original construct will pick up the original value and then display the total?
At startup it would have to check to see if the A value is greater or less than B+C and add or reduce from them to compensate.

I am inexperience in extension coding and your video is literally my first introduction into it; so I'm just thinking outside the box for a solution to offer.

Here are screen captures of the issue:
28334

Norgewalk
Hold My Ale! Guild Master

damned
August 8th, 2019, 06:17
Welcome Norgewalk

Ill have a look at that over the next couple of weeks as other priorities are resolved. Thanks for pointing that out.

osarusan
December 30th, 2019, 06:44
Sorry to resurrect this thread, but I just found the extension and I'm super happy this exists! I wanted to ask if there is a way to adjust the weight of the coins. For example, I'd like to use various currencies like trade bars in my campaign, but since they weigh more than simple coins, they wouldn't work well with this mod. If there is a way to customize the weight of each currency that would be spectacular.

damned
December 30th, 2019, 08:17
Sorry to resurrect this thread, but I just found the extension and I'm super happy this exists! I wanted to ask if there is a way to adjust the weight of the coins. For example, I'd like to use various currencies like trade bars in my campaign, but since they weigh more than simple coins, they wouldn't work well with this mod. If there is a way to customize the weight of each currency that would be spectacular.

Crack open the extension and add some math to edit the weight that each item adds.
Im not sure if I ever looked at Norgewalks sugestion above...

kylania
December 30th, 2019, 21:39
Sorry to resurrect this thread, but I just found the extension and I'm super happy this exists! I wanted to ask if there is a way to adjust the weight of the coins. For example, I'd like to use various currencies like trade bars in my campaign, but since they weigh more than simple coins, they wouldn't work well with this mod. If there is a way to customize the weight of each currency that would be spectacular.

You'd adjust this part of the coins_weight.lua:



-- We have now computed the coins weight for this PC
-- weight = math.floor( weight / 50 );
weight = weight * 0.02;


Change that 0.02 to whatever weight per coin you wanted to use.

Morik
January 10th, 2020, 01:05
This is great! Thank you, very much!

vaughnlannister
May 16th, 2020, 19:11
Super cool extension mate! Still works in FGU too :)!

TMayes
May 28th, 2020, 20:24
I'm sorry. I just found this thread and I can't find the actual corrected ext. Can someone point me in the right direct?

damned
May 29th, 2020, 02:23
Welcome TMayes

Scroll to bottom left of page and change the theme to FGResponsive and ou should be able to see attachments then.

WinterSoldier7
June 23rd, 2020, 13:09
Hello,

I would like the coins in my campaign to carry weight and so this extension seems to be perfect for me, however I have two questions;

- Will this work with FGU?
- How are they weighed? How many coins equal 1lbs?

pwalltx
July 12th, 2020, 18:08
I have tried to do this in fantasy grounds unity and while it showed me the new coin field, it wasn't updating with the number of coins

Zacchaeus
July 12th, 2020, 18:39
The author of this extension hasn't been active on the forums for a couple of years so I don't expect this extension to get updated for Unity.

RedhandJedi
July 29th, 2020, 13:55
This was exactly the extension I was looking for and I am glad I found it. I am sad it is no longer being updated. So far I appears to still be working though for me. I have not yet grabbed Unity though.

V/R,
RHJ

Marquis_de_Taigeis
July 29th, 2020, 15:18
Hello,

I would like the coins in my campaign to carry weight and so this extension seems to be perfect for me, however I have two questions;

- Will this work with FGU?
- How are they weighed? How many coins equal 1lbs?

the coin weight is calculated as 50 per 1lbs, but it is very easy to change in the xml file if in your campaign wish coins to weigh more/less


and so far this mod still seems to be working in unity

Eroc999
November 17th, 2020, 06:52
I just wanted to say I really enjoyed this extension, but since I got Mad Nomads Coin Manager, the formatting is completely broken. I really wish I could have the best of both worlds, but Coin Manager solves even bigger daily playing problems, so I had to choose. I don't suppose this extension still has a chance of further development????

LordEntrails
November 17th, 2020, 18:42
I just wanted to say I really enjoyed this extension, but since I got Mad Nomads Coin Manager, the formatting is completely broken. I really wish I could have the best of both worlds, but Coin Manager solves even bigger daily playing problems, so I had to choose. I don't suppose this extension still has a chance of further development????
You should see if Mad Nomad would be interested in adding weight functionality to his extension. Seems easiest... :) Though as I use his Coin Manager, I would hope it would be an option, as I don't track weight since for us it's more to track wealth and not what they are actually carrying.

Mats-Fu
November 26th, 2020, 07:59
This extension looks great! Can someone advise me on how to make it work? I dropped it in the extensions folder, but nothings seems to have happened. suggestions?

damned
November 26th, 2020, 11:32
You need to activate the extension on the Load Campaign screen.

Jiminimonka
November 26th, 2020, 12:59
Hey Zuger i have made a small coding tutorial video and I have extended this extension as the content of the video. It addresses in a very basic way one method of being able to track carried and non carried treasure.
https://youtu.be/x4leZBomtOc
And the extension is here - feel free to use or not.
23256
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=23256

Also any comments about splitting the code into different files are personal preference and not a criticism.

This is working fine in FGU btw. Never even thought to update it.

Mats-Fu
November 26th, 2020, 14:40
Perfect, thank you!

eldrin81
December 6th, 2020, 14:27
I would like to use the updated extension if possible, is there a link somewhere?

Dax Doomslayer
December 6th, 2020, 17:56
I would like to use the updated extension if possible, is there a link somewhere?

Hi Eldrin,
If you mean Damned's update to this, it's found in post #32. I hope this helps!

DM_BK
December 6th, 2020, 20:49
Here's a wish list item for this extension: I wish it would tell the people when they become encumbered.

The DM almost always has to police that because a lot of people aren't paying much attention to encumbrance.

Jiminimonka
December 7th, 2020, 14:05
Here's a wish list item for this extension: I wish it would tell the people when they become encumbered.

The DM almost always has to police that because a lot of people aren't paying much attention to encumbrance.

Check when they get back to civilisation and get the PCs to bank or sell stuff.

This is part of D&D - trusting players and keeping an eye on encumbrance. Too much automation and no one has to use the thing between their ears.

Kiraslite
December 9th, 2020, 05:47
I just loaded this into my game on FGU v4.0.4 and it seems to be broken, the total and coin values are both 0 for a player carrying 4000+ coins. Can anyone else confirm if its broken or am I doing something wrong here.

Jiminimonka
December 9th, 2020, 07:30
Its not broken for me. Any other extension installed?

Kiraslite
December 10th, 2020, 02:34
Its not broken for me. Any other extension installed?

A few, but nothing to do with encumbrance or weight. Very strange.

Bonkon
December 10th, 2020, 08:00
A few, but nothing to do with encumbrance or weight. Very strange.

Good Day Kiraslite :)
Sometimes extensions that do not, outwardly, seem to have anything in common can have some "behind the scenes" things going on that can conflict.
I find the easiest way to narrow down issues is to remove 3 consecutive extensions then load the game, if the problem continues, exit the game and turn the first three back on and try the next three. :)

Kiraslite
December 11th, 2020, 00:42
Good Day Kiraslite :)
Sometimes extensions that do not, outwardly, seem to have anything in common can have some "behind the scenes" things going on that can conflict.
I find the easiest way to narrow down issues is to remove 3 consecutive extensions then load the game, if the problem continues, exit the game and turn the first three back on and try the next three. :)

Good Afternoon,
I stripped all of my extensions out and only loaded this extension and it still seems to be broken for me, loaded a new campaign and the same issue is occurring. Just seems to be broken for me unfortunately :(

Kiraslite
December 11th, 2020, 00:49
Good Afternoon,
I stripped all of my extensions out and only loaded this extension and it still seems to be broken for me, loaded a new campaign and the same issue is occurring. Just seems to be broken for me unfortunately :(

As I say this I figure it out. The extension doesn't update on load so the values for it read zero until you create a parcel with money and give it to the player. Leaving this up for anyone else that may run into this issue.

bmos
December 11th, 2020, 01:26
As I say this I figure it out. The extension doesn't update on load so the values for it read zero until you create a parcel with money and give it to the player. Leaving this up for anyone else that may run into this issue.You can also type /ccweight in chat

DM_BK
December 11th, 2020, 14:28
Check when they get back to civilisation and get the PCs to bank or sell stuff.

This is part of D&D - trusting players and keeping an eye on encumbrance. Too much automation and no one has to use the thing between their ears.

I feel like one less thing for people to have to monitor is a good thing but to each his own.... This appears to work but I haven't tried it in an actual session yet (I'll report back if it doesn't)...add the following code addition to the function recomputeTotalWeight:

local eqencumbered = DB.getValue( nodePC.getPath() .. '.encumbrance.encumbered' );

if treasure+eqload > eqencumbered then
local msg = { text = DB.getValue(nodePC, "name") .. " backpack is overloaded!", mode = "story", source = "" };
Comm.deliverChatMessage(msg);
end

And, if I didn't say it already, thank you for the extension!!!

Cruise105
March 6th, 2021, 02:50
Complete dumb question here ... How can I adjust the weight of coins. All I see when I open the file with Notepad is a bunch of jiberish.

LordEntrails
March 6th, 2021, 03:15
Complete dumb question here ... How can I adjust the weight of coins. All I see when I open the file with Notepad is a bunch of jiberish.
You need to unzip the extension first. Rename it from .ext to .zip, then unzip. then you will have multiple files you can edit in Notepad. When you re-zip it, only use zip compression and do not re-zip the folder, only the contents. Then rename.

damned
March 6th, 2021, 03:17
Firstly its a ZIP file. Unzip it and then you can access the internal files with Notepad.

Cruise105
March 6th, 2021, 03:37
You need to unzip the extension first. Rename it from .ext to .zip, then unzip. then you will have multiple files you can edit in Notepad. When you re-zip it, only use zip compression and do not re-zip the folder, only the contents. Then rename.

I have it uzipped, now I still don't know what I am looking for. I've never done anything like this before.

Evolivolution
March 6th, 2021, 10:48
When you unzipped the folder find scripts\coins_weight.lua. Open it with a Notepad (or Notepad alternative).
In line 56 you can find
weight = math.floor( weight / 50 ); that's the only calculation I found in there. It takes the amount of coins you have and divides it by 50 to calculate their weight. So if you had 500gp they would weigh 10. You can change the 50 in this line to whatever ratio you want.
After you edited the file, save it and re-zip everything you found when you unzipped it, like @LordEntrails said.

Xecthar1379
March 10th, 2021, 16:06
Hey Zuger i have made a small coding tutorial video and I have extended this extension as the content of the video. It addresses in a very basic way one method of being able to track carried and non carried treasure.
https://youtu.be/x4leZBomtOc
And the extension is here - feel free to use or not.
23256
https://www.fantasygrounds.com/forums/attachment.php?attachmentid=23256

Also any comments about splitting the code into different files are personal preference and not a criticism.

Hey Damian,

First of all, thanks a lot for the tutorial. I'm not good in coding and that was very helpful. However, thanks even more for the new version that's exactly what I was looking for!

Cheers!!

FeatherRin
March 12th, 2021, 11:29
If you use Variant Encoumbrance the textboxes are unreadable unless you widen the character sheet unreasonably wide.
Can you make a vertical version?
edit: Nevermind, I rubbed my 2 remaining braincells together and i figured it out myself.

fharlang
August 13th, 2021, 11:56
I recieved an error when I load this extension on a new character, just noticed it this evening.

48675

LordEntrails
August 13th, 2021, 20:38
I recieved an error when I load this extension on a new character, just noticed it this evening.

48675
Unfortunately I don't think Zuger is active on the forums anymore. You might try sending him a PM to see if he responds. Otherwise it might be up to you or volunteers on the forum to figure out and solve this issue.

Zhchng
October 22nd, 2021, 22:21
Maybe it's just because I'm new to the forums and extensions, but I can't find the (modified) extension. Help?

jharp
October 22nd, 2021, 22:44
I don't know specifically but likely forge.fantasygrounds.com is where you want to look.

Dax Doomslayer
October 22nd, 2021, 22:53
The extension is actually in the first post. Make sure you are viewing this in FGResponsive (lower left at the bottom). Hopefully that works/helps you.

Zhchng
October 22nd, 2021, 23:03
Thanks, but that does not include the extension I am looking for. I am looking for Zugar's extension as enhanced by Xecthar1379, which tracks the weight of the coins and allows you to track coins you are not on your person (on a pack animal, in a bank, ...).

Zhchng
October 22nd, 2021, 23:07
Thanks, Dax. I think I've got it now. Just have to unzip it.

Dax Doomslayer
October 22nd, 2021, 23:43
Good to hear Zhchng. Sorry I wasn't able to help.

oukag
March 14th, 2022, 19:56
As of this past week, this script is no longer working as intended for me. I get an error for the coinamount6 field no having a defined starting position and the UI for the coins overlaps the Encumbrance section.

Moon Wizard
March 14th, 2022, 21:53
You should disable any extension from this thread. Currency weight and encumbrance are built into the included rulesets by default now.

Regards,
JPG