PDA

View Full Version : sOs SIDEBAR category how to add a ext to a custum sidebar category?! ext issue



twoditdmonk
June 8th, 2023, 02:35
I noticed that I can load only three ext under the campaign category! Is that normal? Is there a limit on the number of ext that can be loaded under the campaign if so how do I add my ext to a new custom category? what is the script code, and xml string code that goes with it? Did anyone else have this problem with loading more than three ext under the campaign category?!

thanks a bunch

twoditdmonk
June 8th, 2023, 02:56
I figured out how to add a new category but I can only load two sidebar ext at a time. is there a limit on ext use on the sidebar?

Trenloe
June 8th, 2023, 09:28
There's no limit on the number of extensions you can load. Provide examples of the code you're using to add sidebar buttons and maybe we can help identify the issue.

twoditdmonk
June 8th, 2023, 11:29
There's no limit on the number of extensions you can load. Provide examples of the code you're using to add sidebar buttons and maybe we can help identify the issue.


I use this script code with PSIONICS IS THE EXT EXAMPLE NAME


function onInit()

LibraryData.aRecords
["PSIONICS"] = {
bExport = true,
aDataMap = { "PSIONICS", "reference.PSIONICS" },
sRecordDisplayClass = "PSIONICS",
sSidebarCategory = "mycategory" ,


}


end

STRING CODE EXAMPLE


<?xml version="1.0" encoding="iso-8859-1"?>
<root>
<string name="library_category_label_mycategory">mycategory</string>
<string name="library_recordtype_label_PSIONICS">PSIONICS</string>
</root>

thanks for your help! I found if I disable an ext the other appears, and visa versa. Is there a better way code-wise to add them?

Trenloe
June 8th, 2023, 11:32
I use this script code with PSIONICS IS THE EXT EXAMPLE NAME

[CODE]function onInit()

LibraryData.aRecords
["PSIONICS"] = {
bExport = true,
aDataMap = { "PSIONICS", "reference.PSIONICS" },
sRecordDisplayClass = "PSIONICS",
sSidebarCategory = "my category goes here" ,


}
This code overrides the base LibraryData.aRecords. You need to write code that adds to LibraryData.aRecords.

For an example of how to do this, refer to the onInit function in the 2E ruleset scripts\data_library_5E.lua file.

twoditdmonk
June 8th, 2023, 12:20
This code overrides the base LibraryData.aRecords. You need to write code that adds to LibraryData.aRecords.

For an example of how to do this, refer to the onInit function in the 2E ruleset scripts\data_library_5E.lua file.

THE FILE 5E.LUA is confusing way too much info!
Am I to use aRecords = {


["skill"] = {
bExport = true,
aDataMap = { "skill", "reference.skilldata" },
aDisplayIcon = { "button_skills", "button_skills_down" },
sRecordDisplayClass = "reference_skill",
aGMListButtons = { "button_skill_bystat" };
aPlayerListButtons = { "button_skill_bystat" };
aCustomFilters = {
["Type"] = { sField = "stat", fGetValue = getSkillTypeValue},
},
aPlayerListButtons = { "button_skills_type_player" };
},


aRecords = {
-- ["image"] = {
-- bExport = true,
-- bID = true,
-- sIDOption = "IMID",
-- aDataMap = { "image", "reference.images" },
-- aDisplayIcon = { "button_maps", "button_maps_down" },
-- sListDisplayClass = "masterindexitem_id",
-- sRecordDisplayClass = "imagewindow",
-- aGMListButtons = { "button_folder_image", "button_store_image" },
-- },

Trenloe
June 8th, 2023, 12:25
As I mentioned - look at the onInit function at the end of that file, it only does two things - set a custom handler (ignore that) and adds the custom records to the library.

Specifically, this is the code:


for kRecordType,vRecordType in pairs(aRecords) do
LibraryData.setRecordTypeInfo(kRecordType, vRecordType);
end

This iterates through a LUA table (aRecords) and adds them to the base library records using LibraryData.setRecordTypeInfo.

Set the aRecords LUA table in that a similar file with the data you need to setup your sidebar buttons - there's plenty of examples in that file, and the CoreRPG library_data.lua file has a bunch of comments (and more examples). Then have an onInit function that does the above code.

twoditdmonk
June 8th, 2023, 15:03
ok I looked through both files, and I admit I am lost (I am not new to code work every program uses its own values even though it's the same program language.) I need a clear example from start to Finish with psionics as an example in the code. sorry. I understand what you are saying I need to do it's just the exact code on how to achieve it escapes me.

I was up all night trying to come up with a working example code with no luck. I feel a little burned out. if someone can take the time I would appreciate it. the code I used is what was shown to me through a tutorial.
sorry again for asking for help.
thanks a bunch for your effort.

Moon Wizard
June 8th, 2023, 15:49
Look at the 4E ruleset in the file data_library_4E.lua. It's a simpler version of the other ones.

Try this simple example that I clipped from the 4E code:


aRecordOverrides = {
["feat"] = {
bExport = true,
aDataMap = { "feat", "reference.feats" },
sRecordDisplayClass = "powerdesc",
},
};

function onInit()
LibraryData.overrideRecordTypes(aRecordOverrides);
end

Trenloe
June 8th, 2023, 16:09
Or try this extension. It includes a basic "psionics" windowclass.

twoditdmonk
June 8th, 2023, 17:23
Or try this extension. It includes a basic "psionics" windowclass.

thanks a bunch
I tried all three codes the extensions load up with no errors but it will only show two window class sidebar ext at a time. I have to disable one that shows up to get the third ext to show in its place, super weird. all the ext work fine in any combo with only one other ext loaded with any of the example codes. just two at a time. weird all none sidebar window class ext doesn't have this issue. I also tested all three ext with all three codes on CoreRpg same issue. I can record, and post a video of it if you want. I'm taking a long smoke break before I post the video! oh, I also tried to load ext I didn't create like the sidebar demo, the file you gave me the same thing happened.

Moon Wizard
June 8th, 2023, 18:07
Make sure that your extensions all have unique names in the extension.xml file; and also make sure that every global script in every extension has a unique name.

It sounds like you are running multiple extensions that are defining global scripts with the same name, which means that only one will get run.

Regards,
JPG

twoditdmonk
June 8th, 2023, 18:18
Make sure that your extensions all have unique names in the extension.xml file; and also make sure that every global script in every extension has a unique name.

It sounds like you are running multiple extensions that are defining global scripts with the same name, which means that only one will get run.

Regards,
JPG

holy crap I never checked the ext.xml I check them all thanks

twoditdmonk
June 9th, 2023, 00:28
I rechecked everything including the ext xml files no issues were found. I think it's a bug or something.

Trenloe
June 9th, 2023, 06:29
I rechecked everything including the ext xml files no issues were found. I think it's a bug or something.
Please upload the three extensions you're using that have this issue.

twoditdmonk
June 9th, 2023, 07:14
Please upload the three extensions you're using that have this issue.

https://drive.google.com/file/d/1N5R65lYBpFivT6NgvKmyl4opqRG2okZ1/view?usp=sharing

twoditdmonk
June 9th, 2023, 07:58
sorry here's the fixed sidebar label category on all of them.

https://drive.google.com/file/d/1yvHmABgN6HYFlxVhIrjTrzljP5F2xiS7/view?usp=sharing

Trenloe
June 9th, 2023, 09:54
Make sure that your extensions all have unique names in the extension.xml file; and also make sure that every global script in every extension has a unique name.

It sounds like you are running multiple extensions that are defining global scripts with the same name, which means that only one will get run.

@twoditdmonk - this is exactly the issue that's occurring.

Mythology and Psionics both have the same global script name "DataLibrary": <script name="DataLibrary" ...

twoditdmonk
June 9th, 2023, 13:30
@twoditdmonk - this is exactly the issue that's occurring.

Mythology and Psionics both have the same global script name "DataLibrary": <script name="DataLibrary" ...

thanks so much, you're a lifesaver! I had no idea that each script had to have a different name. Plus I didn't
realize I did that! Normally I wouldn't do that when I code. Now I can increase my workflow on them thanks a bunch.

Felderburg
November 23rd, 2023, 06:56
Or try this extension. It includes a basic "psionics" windowclass.

I used this extension to create some sidebars for the Star Trek ruleset. Currently it's for personal use, but if I wanted to share it for free, would I be allowed to? It has a copyright notice in the xml file, but other files mention a license.html that does not exist.

Trenloe
November 23rd, 2023, 08:07
I used this extension to create some sidebars for the Star Trek ruleset. Currently it's for personal use, but if I wanted to share it for free, would I be allowed to? It has a copyright notice in the xml file, but other files mention a license.html that does not exist.
Yep, as long as you're adhering to the copyright/license for any material you're using.