-
August 27th, 2023, 16:49 #1
Merge classes - campaign_chars and list_iadd
I'd like to modify charselect_host and charselect_client (campaign_chars.xml)
to force list_iadd to do something I want. So I've prepared a campaign_chars.xml version and used merge="join".Code:<windowclass name="charselect_host" merge="join"> <sheetdata> <button_iadd name="list_iadd"> <anchored to="rightanchor"> <top /> <right anchor="left" relation="relative" offset="-5" /> </anchored> <class>charsheet</class> <script> function onInit() Debug.console("onInit") end function onButtonPress() Debug.console("onButtonPress", window.getDatabaseNode()); end </script> </button_iadd> </sheetdata> </windowclass> <windowclass name="charselect_client" merge="join"> <sheetdata> <button_iadd name="list_iadd"> <anchored to="rightanchor"> <top /> <right anchor="left" relation="relative" offset="-5" /> </anchored> <class>charsheet</class> <script> function onInit() Debug.console("onInit") end function onButtonPress() Debug.console("onButtonPress", window.getDatabaseNode()); end </script> </button_iadd> </sheetdata> </windowclass>
entry inside the charsheet tag. I guess is done by the old codeCode:... local node = DB.createChild(window.getDatabaseNode()); ...
even onCode:<button_iadd name="list_iadd">
How can I do it?
-
August 27th, 2023, 21:13 #2
I think I found why it creates a new charsheet.
In the function onButtonPress I was operning my charwizard with this code.Code:Interface.openWindow("charwizard", window.getDatabaseNode());
Creates a top level window by a windowclass and a datasource. If a matching window already exists, it is returned. Otherwise, a new window is created.
-
August 27th, 2023, 21:26 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
Character wizards should be sourceless (i.e. "" for data path in Interface.openWindow), in order to avoid creating data until the character has been committed. That's how all of our character wizards work.
On a related note, the template used for "list_iadd" is changing in the upcoming release this week. You'll need to update your scripts.
Another option for character wizard is to add a top-level button (like 5E) or to add a new button (next to iadd) that opens wizard instead of blank character.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks