PDA

View Full Version : Help Adding Button to Sidebar



sujifae
June 11th, 2019, 20:17
All I want to do is add one extra button to the sidebar. I want to keep the overall appearance displayed in the image I'm attaching (apart from adjusting alignment to fit in the extra button).
I've followed every tutorial, video, and forum post I can find on the matter and I'm still not getting anything to show in the library or the sidebar.
I'm guessing there's something I need to define somewhere for the library and sidebar to recognise the new button... but what and where is beyond me at this point.
Please help...
27559

LordEntrails
June 11th, 2019, 20:36
Welcome to the forums.

What ruleset and what button are you trying to add?

sujifae
June 11th, 2019, 20:43
Thanks.
CoreRPG/Cypher System Ruleset
Trying to add a button to the sidebar (the bar with Quests, Story, NPCs, etc) called "Recursions".

Moon Wizard
June 11th, 2019, 21:46
Try looking in the "scripts/data_library_35E.lua" file in the 3.5E ruleset for an example.

You can copy to data_library_strange.lua in your own ruleset, and then you can strip out everything but the code that calls aRecordOverrides variable. You'll need to customize the onInit function to register your overrides, update the aRecordOverrides variable which your specific record type information, and make sure that the new "data_library_strange.lua" file is referenced in the base.xml as a global script called "LibraryDataStrange".

Regards,
JPG

Talyn
June 11th, 2019, 22:01
Here, this will add a Recursions button to the Library Data set.

You can thank Trenloe. I literally took his Abilities extension and just re-jiggered it for this.

sujifae
June 11th, 2019, 22:14
You'll need to customize the onInit function to register your overrides

Pardon my ignorance, but how do I do that?
I think that's all I need to do to have it fully functional.
The good news is I'm seeing changes, and for that, I thank you.

sujifae
June 11th, 2019, 22:29
Here, this will add a Recursions button to the Library Data set. That's all it does, and will generate an error because it's calling for a window class that doesn't exist (I think you were working on it from your end though?) so you'll need to play with it and insert your data types, etc.

You can thank Trenloe. I literally took his Abilities extension and just re-jiggered it for this.

I'm trying this extensions as well, and I'm seeing a file referenced in extension.xml called add_recursions_list.lua
I don't have that file... which one would you recommend I copy to add it and where should I put it (i'm guessing in "scripts" or "campaign/scripts")?
Or maybe it's a file I already have and the name is just throwing me off...

Talyn
June 11th, 2019, 22:35
The Lua script is in the extension as well.

sujifae
June 11th, 2019, 23:34
The Lua script is in the extension as well.

Ah, not sure how I missed that. Thanks.

So, while I really appreciate the extension, Moon Wizard's instructions seemed to yield better results. Probably because I broke the set you made the extension for beyond repair and had to rollback to a version that didn't have all the recursion files in it.

One thing I noticed though is that the extension you shared got the name of the button in the Library (but not the pic), whilst the instructions I followed from Mood Wizard did the opposite (probably because I still have more to do in regards to those instructions). Which makes me curious... Which part of the code in your extension controls the name in the Library?

KyoshiUriza
June 11th, 2019, 23:38
searching for a delete button

sujifae
June 11th, 2019, 23:42
Try looking in the "scripts/data_library_35E.lua" file in the 3.5E ruleset for an example.

You can copy to data_library_strange.lua in your own ruleset, and then you can strip out everything but the code that calls aRecordOverrides variable. You'll need to customize the onInit function to register your overrides, update the aRecordOverrides variable which your specific record type information, and make sure that the new "data_library_strange.lua" file is referenced in the base.xml as a global script called "LibraryDataStrange".

Regards,
JPG

Success! 27562
Thank you so much!
Now all I need to know is what you mean by/how to "customize the onInit function to register your overrides"

Talyn
June 12th, 2019, 00:25
I just uploaded a fixed extension. The reason it was generating the windowclass error before is because I wasn't paying attention. :) Now it works as far as creating the Library button and bringing up a masterindex window.



Which part of the code in your extension controls the name in the Library?


This part:



<string name="library_recordtype_label_recursion">Recursions</string>


Then take a look at scripts/data_library.lua in CoreRPG. You'll see reference to sDisplayText which is discussed in the commentary at the top of the file. The initialize() function defines it then later on the getDisplayText function pulls the string value from the record being called.

Moon Wizard
June 12th, 2019, 00:48
I was talking about slimming down the onInit function to only perform the loop to add the aRecordOverrides; since the rest of the stuff in that file is not needed for your case.

Regards,
JPG

Dailyn
February 6th, 2022, 23:06
Hi! I recently found this thread because I too would like to create a new tab in the sidebar. When I downloaded the extension provided I got an error (Posted below this). I'm curious if you happen to know whats going on and how I could fix it.



[Error] Script execution error: [string "campaign/scripts/campaign_button_new.lua"]:28: attempt to index 'w' (a nil value)

Moon Wizard
February 6th, 2022, 23:16
This thread is two years old; so is not going to be the correct method to add a button to the sidebar any longer. In general, it is best to start a new thread with your questions, if the thread is older than about 6 months.

Perhaps you can provide information on what you are trying to do in a new thread in the Workshop forum, and we can point you in the right direction.
https://www.fantasygrounds.com/forums/forumdisplay.php?42-The-Workshop

Going to lock this thread; to avoid further necro.

Regards,
JPG