DICE PACKS BUNDLE
Page 1 of 2 12 Last
  1. #1

    Creating a new window on desktop

    I am attempting to create a new window for the desktop when you load a campaign. So I defined a new windowclass in the desktop_classes.xml and set a new framedef in the graphics_frames.xml. From the FG docs, I couldn't find if there was something else I needed to do in order for it to show up. Right now, it just has some dummy string_label in the sheetdata tag. Just trying to get it to draw first.

    EDIT: Seems I am missing quite a few things. Premature posting. My apologies.

    Thanks
    Last edited by Ranzarok; July 5th, 2019 at 22:36.

  2. #2
    I think maybe I have it figured out. Will delete post if I do.

  3. #3

  4. #4
    Sure. I am sure this is FG 101 for most of you but if you want to see it here ya go.

    I created a new panel on the desktop (that's the part I was missing), created some new art for the panel, added the Doom and Momentum buttons. Right now, it is using basicnumber tags for the pool numbers. Next thing I have to do is create the functionality for both the Doom Pool and the Group Momentum Pool and a way for the player generated Momentum total to be added to the group Momentum if the player chooses to bank it. Long way to go, but learning along the way.

    windowclass in my desktop_classes.xml
    Code:
    <windowclass name="doom_tracker">
    		<noclose />
    		<sizelimits>
    			<dynamic />
    			<minimum width="200" height="400" />
    		</sizelimits>
    		<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>
    template for the buttons in the Doom Tracker in my template_desktop.xml

    Code:
    <!-- Buttons for Doom Tracker -->
    
    	<template name="button_dtmom" merge="join">
    		<buttoncontrol>
    			<icon normal="button_dtmomentum" pressed="button_dtmomentum_down" />
    				
    				<script>
    					function onButtonPress()
    						local msg = {font = "msgfont", icon = "momentumicon"};
    						msg.text = " You need to make this spend a Momentum from the Group Pool and subtract it from the total. ";
    						Comm.deliverChatMessage(msg);
    					end
    				</script>
    				
    		</buttoncontrol>
    	</template>
    
    	<template name="button_dtdoom" merge="join">
    		<buttoncontrol>
    			<icon normal="button_dtdoom" pressed="button_dtdoom_down" />
    				
    				<script>
    					function onButtonPress()
    						local msg = {font = "msgfont", icon = "doomicon"};
    						msg.text = " You need to make this spend a Doom from the Doom Pool and subtract it from the total. ";
    						Comm.deliverChatMessage(msg);
    					end
    				</script>
    				
    		</buttoncontrol>
    	</template>
    panel created in desktop_panels.xml
    Code:
    <panel name="doom_tracker" modes="host,client">
    		<class>doom_tracker</class>
    		<bounds>400,-350,100,200</bounds>
    		<dynamic />
    		<locked />
    	</panel>
    773c2c61c5a99710c1f443b64ccc0702.png
    Last edited by Ranzarok; July 6th, 2019 at 08:12. Reason: added image

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    Quote Originally Posted by Ranzarok View Post
    Sure. I am sure this is FG 101 for most of you but if you want to see it here ya go.
    You might be surprised.
    Posts like this are very valuable!

  6. #6
    Very much so! Love seeing new things that could be huge improvements to other systems.

  7. #7
    I've found out that creating the window the way I have described still doesn't get me what I need. Only having done the above, the window shows up when I launch FG campaign but it is unbound, so I can't get data from or send data to it. On start up the console reports the node as nil.

    I've went through Jeffery Redding's extension tutorial, the FG documentation and tried things but to no avail. I have even looked at MoreCore's dicepool windowclass and the onInit call but still get the error. Any help would be appreciated.

    I put this in to get the nil notification
    Code:
    <windowclass name="doomtracker">
    		<noclose />
    		<sizelimits>
    			<dynamic />
    			<minimum width="200" height="400" />
    		</sizelimits>
    
    		<script>
    			function onInit()
    				Debug.console("self",  self);
    				Debug.console("getDatabaseNode",  self.getDatabaseNode());
    			end
    		</script>
    I've also tried this bit of onInit but I think there is more to it then just declaring the class name? (my terminology is probably all wrong)
    Code:
    <windowclass name="doomtracker">
    		<noclose />
    		<sizelimits>
    			<dynamic />
    			<minimum width="200" height="400" />
    		</sizelimits>
    		
    		<script>
    			function onInit()
    				DoomTracker.registerControl(self);
    			end
    			
    			function onClose()
    				DoomTracker.registerControl(nil);
    			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>
    I have both the desktop_panels.xml and the desktop_classes.xml included in my extension.xml file

  8. #8
    How are you opening the window?
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  9. #9
    Quote Originally Posted by celestian View Post
    How are you opening the window?
    Thanks for the reply

    Through the desktop_panels.xml (I was opening with a "/" in the chat window but wanted to open when FG loaded the campaign, so I did this
    Code:
    <panel name="doomtracker" modes="host,client">
    		<class>doomtracker</class>
    		<bounds>400,-350,100,200</bounds>
    		<dynamic />
    		<locked />
    	</panel>

  10. #10
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    Hi Ranzarok

    In terms of creating a new window etc - if you are looking at MoreCore objects - then the locations is an example of a new window and data type.
    But you are also looking at making it a new desktop object that is always there like the Chat Window?

    I didnt write any of the DicePool stuff - that was ianmward but he also released it as a CoreRPG extension so you can see the code without having to search your way through everything.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in