PDA

View Full Version : New currency and encumbrance system hookup for custom ruelset



Zarestia
March 4th, 2022, 15:43
I've looked around for why the new currency and encumbrance system doesn't play nice with my FFd20 ruleset which is mostly edited 3.5e code.

It looks like it won't work without a custom override if the system name is not in this table from manager_char_encumbrance.lua


local _tStandardSupportedRulesets =
{
"CoreRPG",
"3.5E",
"4E",
"5E",
"13th_Age",
"AFF2",
"Basic Roleplaying",
"BoL",
"CallOfCthulhu",
"CallOfCthulhu7E",
"d20 Modern",
"DCC RPG",
"Fate Core",
"ICONS",
"MCC RPG",
"PFRPG",
"Symbaroum",
"WOIN",
};

Of course I could overwrite this whole file to just add an entry to that table but that seems a bit unnecessary.

Could that table be changed to not be local so we can add to that table via code? If anyone has a smarter solution please let me know. :)

Trenloe
March 4th, 2022, 15:54
The following code will do the equivalent of what adding a ruleset to the list does:


CharEncumbranceManager.addStandardCalc();

bayne7400
March 4th, 2022, 15:56
That snippet of code Trenloe gave you can go in your onInit on your gamesystem script

Zarestia
March 4th, 2022, 16:05
Thank you both, I'll try that later!

Moon Wizard
March 4th, 2022, 16:10
At some point, I plan to have the new system be the default, unless a custom calculation is written by the ruleset; but I needed intermediate steps for backward compatibility.

Regards,
JPG

peterb
March 13th, 2022, 21:04
That snippet of code Trenloe gave you can go in your onInit on your gamesystem script

In what file would that OnInit be found? char_main.xml?

I've built a layer on top of the Basic Roleplaying ruleset, and the only relevant file I can find is char_main.xml.

Maybe I should read up on layering rulesets... ;)

/Peter

bayne7400
March 13th, 2022, 21:36
Gamesystem is an actual file. Unpack OSE2 and look how I did it.

Trenloe
March 13th, 2022, 21:40
In what file would that OnInit be found? char_main.xml?

I've built a layer on top of the Basic Roleplaying ruleset, and the only relevant file I can find is char_main.xml.

Maybe I should read up on layering rulesets... ;)

/Peter
If you're layered on top of Basic Roleplaying maybe put it in a new file called scripts/manager_gamesystem2.lua and call that script file from your layered ruleset base.xml


function onInit()
CharEncumbranceManager.addStandardCalc();
end

bloodylemming
September 13th, 2022, 03:28
The following code will do the equivalent of what adding a ruleset to the list does:


CharEncumbranceManager.addStandardCalc();

Where is this line of code entered?

damned
September 13th, 2022, 04:14
see the post immediately above yours

bloodylemming
September 13th, 2022, 04:20
see the post immediately above yours

Throws this errer


[ERROR] Script execution error: [string "scripts/manager_gamesystem2.lua"]:2: attempt to index global 'CharEncumbranceManager' (a nil value)

Moon Wizard
September 13th, 2022, 05:11
manager_gamesystem2.lua would be a script that you provided; since it's not part of any included ruleset. So, look in your own ruleset files for that file, and look at that line.

Regards,
JPG

bloodylemming
September 13th, 2022, 05:24
manager_gamesystem2.lua would be a script that you provided; since it's not part of any included ruleset. So, look in your own ruleset files for that file, and look at that line.

Regards,
JPG

No such file in my ruleset...

Trenloe
September 13th, 2022, 12:14
No such file in my ruleset...
I think you need to provide a bit more information of what it is you're you're trying to accomplish and how you're going about it.

bloodylemming
September 13th, 2022, 13:30
I think you need to provide a bit more information of what it is you're you're trying to accomplish and how you're going about it.

I'm following along, Damned's video (Part 018 - White Lies - Inventory Tab) and in the comments he points to this thread. I'm unsure what this handles, with respect to the update to FG in February. I had hoped this helps deal with the replacement/modifications of elements on the Inventory Tab, as mine looks like a mess, at the moment...

bayne7400
September 13th, 2022, 16:12
One of the best things you can do is use the find file function in the development program you prefer. For instance you can unpack any ruleset and look for " CharEncumbranceManager.addStandardCalc();".

You can see how other core rpg rulesets handled it.

Trenloe
September 13th, 2022, 16:18
I'm following along, Damned's video (Part 018 - White Lies - Inventory Tab) and in the comments he points to this thread. I'm unsure what this handles, with respect to the update to FG in February. I had hoped this helps deal with the replacement/modifications of elements on the Inventory Tab, as mine looks like a mess, at the moment...
All CharEncumbranceManager.addStandardCalc(); does is use the standard calculation for encumbrance - adding together the item weights (and coins if the option is set) and then setting it in the total weight field.

It doesn't sound like this is going to fix an inventory tab that looks like a mess.

bloodylemming
September 13th, 2022, 16:22
All CharEncumbranceManager.addStandardCalc(); does is use the standard calculation for encumbrance - adding together the item weights (and coins if the option is set) and then setting it in the total weight field.

It doesn't sound like this is going to fix an inventory tab that looks like a mess.

Ah, okay. Yea, haven't gotten far enough to determine if the calculation is going to be a problem.
Thankyou kindly.

swest
September 19th, 2022, 23:35
Sorry to be so dense, but I'm just not picking up what is being laid down...

First off, to preemptively answer a question that might come up - Q: "What are you trying to accomplish?"

A: I have reproduced CoreRPG's charsheet_inventory in my ruleset, and I can populate its inventorylist with 'Items', just fine. The 'weight' fields correctly reflect the weights of the various items just added. However, the 'encumbranceload' field (on charsheet_inventory) doesn't update with a total. I want that field updated appropriately.

So, if someone could clarify the instructions from above (what to create, and then how, and from where, to invoke it), I would appreciate it!

Thanks!

- s.west

damned
September 19th, 2022, 23:52
create a new file called scripts/manager_gamesystem2.lua
register it in base.xml like this:
<script name="GameSystem2" file="scripts/manager_gamesystem2.lua" />

and add this content


function onInit()
CharEncumbranceManager.addStandardCalc();
end

swest
September 20th, 2022, 00:24
Well flip me and dip me...

The Good News:


It turns out that I had already accomplished everything that you just told me to do... but I never tried it out, because I didn't realize that RSW had already taken care of the base.xml step you mentioned. I figured that there was still something I was missing, because I couldn't imagine how the onInit() was firing.

Bottom Line: The "Total weight carried" field now correctly reflects the values present in the inventorylist.

Thanks, guys!!!

The Bad News:


The CoreRPG code that handles this is completely incomprehensible to me... I tracked down the various keywords (encumbrance.load, setEncumbranceField(), addStandardCalc(), etc.) yet I have not the faintest idea how any of it does what it does.

Unfortunately, as you are probably already aware, this is not the first bit of CoreRPG/FG functionality that has eluded me (and is not likely to be the last).


Nevertheless, IT WORKS! So I shan't dwell on my inadequacies, but instead will move on to the Next Big Thing, whatever that turns out to be.

damned
September 20th, 2022, 00:28
Ive never even looked at the code that does the magic.
I put my trust in Moon Wizard and I do the bits I know how to do.

swest
September 20th, 2022, 00:29
Though damned, thou art wise.

Moon Wizard
September 20th, 2022, 03:22
Also, to use the standard load calculator, your encumbrance total field must point to the character node with the following source path ("encumbrance.load")

From 5E inventory page; <number_static name="encumbranceload" source="encumbrance.load">.

Regards,
JPG