Thread: Creating a new window on desktop
-
July 9th, 2019, 00:54 #11
- Join Date
- Jun 2019
- Posts
- 71
Thanks damned. I did look at the DicePool lua and tried to model it after that but failed.
Also wondering if you can call, or reference an unbound windowclass (windowinstance?) I apologize for the terminology, I realize that it's probably all wrong and I am doing more harm then good.
I think it might be more helpful to try and explain what I want to do.
So here is the code for the "doomtracker" window
desktop_classes.xml
Code:<windowclass name="doomtracker"> <frame>grouptracker</frame> <noclose /> <sizelimits> <dynamic /> <minimum width="200" height="400" /> </sizelimits> <script> function onInit() Debug.console("self", self); Debug.console("getClass", self.getClass()) Debug.console("getDatabaseNode", self.getDatabaseNode()); Debug.console("getFrame", self.getFrame()); end </script> <sheetdata> <genericcontrol name="dtbase"> <bounds>1,1,99,199</bounds> <icon>doomtracker</icon> </genericcontrol> <button_dtmom name="dtmomentum"> <bounds>19,20,62,62</bounds> </button_dtmom> <basicnumber name="gmompool"> <bounds>25,70,20,20</bounds> </basicnumber> <button_dtdoom name="dtdoom"> <bounds>19,120,62,62</bounds> </button_dtdoom> <basicnumber name="gdoompool"> <bounds>55,110,20,20</bounds> </basicnumber> </sheetdata> </windowclass>
Code:<panel name="doomtracker" modes="host,client"> <class>doomtracker</class> <bounds>400,-350,100,200</bounds> <dynamic /> <locked /> </panel>
So that's where I am at. EDIT: Forgot to mention, the doomtracker window would be persistent. No need to close it.
-
July 9th, 2019, 01:33 #12
I had thought about creating a type of shared/group "hero points " which could be used for something like this but has never climbed high enough up my wish list
So we have two issues right?
1. You are wanting to adjust the values of the Shared Pool by PCs clicking on their Char Sheet?
2. You want the window that tracks the Shared Pool to open automatically and be persistent?
I would worry less about the second issue for now.
As a guess - the player doesnt own the gdoompool so they cant make changes to it
They can only make changes to records they own - their char sheet and any notes they created.
You will need to do some OOB messaging.
There is an example of building some OOB in this video - https://www.youtube.com/watch?v=zTNLJDMLpGk its CT but i reckon it might be the missing key...
-
July 9th, 2019, 01:44 #13
- Join Date
- Jun 2019
- Posts
- 71
Thanks!
Yes, you are correct, that is what the issues are. I actually have the shared pool window up at the opening of the campaign, I can add numbers to the two basicnumber fields and I have both of the buttons but no real functionality.
This:As a guess - the player doesnt own the gdoompool so they cant make changes to it
They can only make changes to records they own - their char sheet and any notes they created.
I will take a look at the video. I appreciate the help.
-
July 12th, 2019, 07:20 #14
- Join Date
- Jun 2019
- Posts
- 71
I'm still working on the Doom tracker window with the help of damned's video, not getting it done yet, so I decided to finish up some more of the little things. With the exception of having the ability to create a new item and designate it as a "weapon" with its own set of properties, and then be able to drag and drop it on the character sheet and the npc sheet, those two are nearly complete. They have abilities and skills listed with proper button rollers to factor in all of their modifiers. Talents, Spells, and Creatures on its own sub window (tab), background, languages, appearance, warstory on another.
Just the doom tracker and the weapon list issues to go and I should be ready to test it with live folks.
Thanks for all of the help so far. "Knowing is half the battle."
-
July 12th, 2019, 10:17 #15
Its looking good!
-
July 26th, 2019, 22:54 #16
- Join Date
- Jun 2019
- Posts
- 71
Decided to make my doomtracker tied to the campaign DB (Was going to try the OBB msg that damned pointed me too, but I found out I need to store the pool values in the campaign DB). The window is created using panel on initialization. It has a windowclass = doomtracker and has two number controls and two button controls.
I've looked for something similar to emulate but the modifier stack and the dicepool are not tied to a database ( that info is stored in memory?).
Should I be using a function in DesktopManager to register the window?
-
July 27th, 2019, 01:10 #17
Decidedly following this. Would love nothing more but to create a clockface using the same method, a Doomsday clock. Very useful for a lot of indie-games.
-
July 27th, 2019, 01:29 #18
You need BOTH the OOB and the DB.
The data is stored in the DB and when players make changes they are using OOB.
Have a look at dbdamage roll (in scripts).
Something like these?
https://www.fantasygrounds.com/forum...l=1#post363593
-
July 27th, 2019, 01:37 #19
-
August 1st, 2019, 00:06 #20
- Join Date
- Jun 2019
- Posts
- 71
I've abandoned the Doom Tracker as a desktop panel and rewritten it as a sidebar item. I was able to bind the window and manipulate the data (Doom Pool and Group Momentum) on the Host side (DM) and now I am trying to work through the OOB messaging that damned pointed me to. Still haven't cracked that nut yet even by using his video and the dbdamage roll lua as an example.
What I am trying to do sounds simple but I know it's not (at least for me)
With this, I can click on the button to "spend" either Momentum or Doom, and by double clicking on the number box, I can add to either.
Is there a way to make this window visible to clients as well (players and not only GM)? I am sure it has to be set in the onInit function but not sure of the syntax. Or at the very least, allow GM to share it with connected players once he opens it.
Adding new window via sidebar (Host side only I think)
Code:function onInit() if(User.isHost()) then DesktopManager.registerDockShortcut("button_track", "button_track_down", "Doom and Momentum Tracker", "trackerwindow", "TrackBox"); end end
Code:<template name="button_tmom" merge="join"> <buttoncontrol> <icon normal="button_dtmomentum" pressed="button_dtmomentum_down" /> <script> function onButtonPress() local rActor = ActorManager.getActor("pc", window.getDatabaseNode()); Debug.console("rActor: "); Debug.console(rActor); local nodeWin = window.getDatabaseNode(); Debug.console("nodeWin: ", nodeWin); local totalmom = nodeWin.getChild("grpmompool").getValue(); Debug.console("totalmom: ", totalmom); if totalmom == 0 then Debug.console(totalmom); local msg = {font = "msgfont", icon = "maxmomicon"}; msg.text = " The group Momentum Pool is empty."; Comm.deliverChatMessage(msg); return totalmom; end nodeWin.getChild("grpmompool").setValue(totalmom-1); Debug.console(totalmom); local msg = {font = "msgfont", icon = "smomentumicon"}; msg.text = " One (1) group Momentum spent. "; Comm.deliverChatMessage(msg); end </script> </buttoncontrol> </template>
Code:<basicnumber name="grpmompool"> <bounds>25,70,20,20</bounds> <script> function onDoubleClick(x,y) local rActor = ActorManager.getActor("pc", window.getDatabaseNode()); Debug.console("rActor: "); Debug.console(rActor); local nodeWin = window.getDatabaseNode(); Debug.console("nodeWin: "); Debug.console(nodeWin); local mompool = nodeWin.getChild("grpmompool").getValue(); Debug.console(mompool); if mompool == 6 then Debug.console(mompool); local msg = {font = "msgfont", icon = "maxmomicon"}; msg.text = "Group Momentum at maximum."; Comm.deliverChatMessage(msg); return mompool; end nodeWin.getChild("grpmompool").setValue(mompool+1); Debug.console(mompool); local msg = {font = "msgfont", icon = "addmomicon"}; msg.text = rActor.sName .. " added 1 to the Group Momentum. "; Comm.deliverChatMessage(msg); end </script> </basicnumber> <basicnumber name="grpdoompool"> <bounds>55,110,20,20</bounds> <script> function onDoubleClick(x,y) local rActor = ActorManager.getActor("pc", window.getDatabaseNode()); Debug.console("rActor: "); Debug.console(rActor); local nodeWin = window.getDatabaseNode(); Debug.console("nodeWin: "); Debug.console(nodeWin); local doompool = nodeWin.getChild("grpdoompool").getValue(); Debug.console(doompool); nodeWin.getChild("grpdoompool").setValue(doompool+1); Debug.console(doompool); local msg = {font = "msgfont", icon = "adddoomicon"}; msg.text = rActor.sName .. " added 1 to the DM Doom Pool. "; Comm.deliverChatMessage(msg); end </script> </basicnumber>
Thanks again for your help damned.
If anyone is interested, here is a screenshot of the work to-date on my Conan 2d20 extension. I also have a Hyborian calendar as a module (with the help of mattekure's samples and tutorial).
c2d20screen.jpg
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks