Starfinder Playlist
Page 3 of 9 First 12345 ... Last
  1. #21
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by lokiare1 View Post
    Ok, so where would I put the <imagecontrol> xml stuff if I were going to create an extension with this?
    If you're using a ruleset that is layered on top of CoreRPG (which 4E is) then you can add the code in an extension to the \campaign\campaign_images.xml file - the "imagewindow" windowclass contains the <imagecontrol> for maps and images.

    As the ruleset modification guide mentions about extensions (https://www.fantasygrounds.com/modguide/extensions.xcp) "An extension consists of files identical to those found in a ruleset" so your quickest route would be to copy the \campaign\campaign_images.xml file from CoreRPG into your extension, add whatever is required to the <imagecontrol> entry in this XML and add this as an <includefile> entry in <base> in your extensions extension.xml file.

    Or, you could work out just what you need to add specific to the XML and use the "merge" tag in a custom XML file in your extension - more info on "merge" here: https://www.fantasygrounds.com/forum...yering-summary

    It will probably be quicker for your development to work off a complete copy of campaign_images.xml first and get your extension working - then look to implement just the stuff you changed with the "merge" functionality - this will make it more future proof.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  2. #22

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    Quote Originally Posted by Trenloe View Post
    If you're using a ruleset that is layered on top of CoreRPG (which 4E is) then you can add the code in an extension to the \campaign\campaign_images.xml file - the "imagewindow" windowclass contains the <imagecontrol> for maps and images.

    As the ruleset modification guide mentions about extensions (https://www.fantasygrounds.com/modguide/extensions.xcp) "An extension consists of files identical to those found in a ruleset" so your quickest route would be to copy the \campaign\campaign_images.xml file from CoreRPG into your extension, add whatever is required to the <imagecontrol> entry in this XML and add this as an <includefile> entry in <base> in your extensions extension.xml file.

    Or, you could work out just what you need to add specific to the XML and use the "merge" tag in a custom XML file in your extension - more info on "merge" here: https://www.fantasygrounds.com/forum...yering-summary

    It will probably be quicker for your development to work off a complete copy of campaign_images.xml first and get your extension working - then look to implement just the stuff you changed with the "merge" functionality - this will make it more future proof.
    Thanks it worked, now I just need to finish implementing the code in this tutorial to make it an actual square.

  3. #23

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    So uh. Don't shoot the noob, but how and where do I tie the onBuildCustomPointer function to the context menu selection I just made?

  4. #24
    Quote Originally Posted by lokiare1 View Post
    So uh. Don't shoot the noob, but how and where do I tie the onBuildCustomPointer function to the context menu selection I just made?
    As a Script entry in your Imagecontrol code (which you've already done) ie

    Code:
    <imagecontrol name="image">
    	<script file="pointer_toolkit.lua" />
    	<pointertypes>
    		<arrow>
    			<icon>pointer</icon>
    			<label>Draw Arrow</label>
    		</arrow>
    		<square>
    			<icon>pointer_square</icon>
    			<label>Draw Square</label>
    		</square>
    		<circle>
    			<icon>pointer_circle</icon>
    			<label>Draw Circle</label>
    		</circle>
    		<cone>
    			<icon>pointer_cone</icon>
    			<label>Draw Cone</label>
    		</cone>
    		<custom name="Zone">
    			<icon>pointer_square</icon>
    			<label>Draw a Zone that can have effects applied to it.</label>
    		</custom>				
    	</pointertypes>
    </imagecontrol>
    onBuildCustomPointer is one of those functions that, if it exists in your code, will be found by FG automatically and used ("tied in" to use your term). Of course, if you've re-written the onBuildCustomPointer from the toolkit then you'll have to reference the new version in a <script> tag.

    Cheers
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  5. #25

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    Quote Originally Posted by dulux-oz View Post
    As a Script entry in your Imagecontrol code (which you've already done) ie

    Code:
    <imagecontrol name="image">
    	<script file="pointer_toolkit.lua" />
    	<pointertypes>
    		<arrow>
    			<icon>pointer</icon>
    			<label>Draw Arrow</label>
    		</arrow>
    		<square>
    			<icon>pointer_square</icon>
    			<label>Draw Square</label>
    		</square>
    		<circle>
    			<icon>pointer_circle</icon>
    			<label>Draw Circle</label>
    		</circle>
    		<cone>
    			<icon>pointer_cone</icon>
    			<label>Draw Cone</label>
    		</cone>
    		<custom name="Zone">
    			<icon>pointer_square</icon>
    			<label>Draw a Zone that can have effects applied to it.</label>
    		</custom>				
    	</pointertypes>
    </imagecontrol>
    onBuildCustomPointer is one of those functions that, if it exists in your code, will be found by FG automatically and used ("tied in" to use your term). Of course, if you've re-written the onBuildCustomPointer from the toolkit then you'll have to reference the new version in a <script> tag.

    Cheers
    I've done that, but how do I select which shape it will make? How do I pass the 'box' type to the function?

  6. #26
    OK, so now I've got to ask: Have you actually READ the documentation and the samples code that I included with the Toolkit Posts, or did you just scan-read it and try to use the Toolkit "as is"?

    The Toolkit is NOT meant to be used "as is" (unless you happen to need a Pointer that the Toolkit already defines AS AN EXAMPLE) - its meant to be used as the basis or template FOR YOUR OWN VERSION OF THE CODE. This is quite clearly explained in the original posts and is also obvious from a reading of the CODE.

    I suggest you go back and have a (re-)read of the code and the documentation (in particular Part 3 and the onBuildCustomPointer function Code).

    Cheers
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  7. #27

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    Quote Originally Posted by dulux-oz View Post
    OK, so now I've got to ask: Have you actually READ the documentation and the samples code that I included with the Toolkit Posts, or did you just scan-read it and try to use the Toolkit "as is"?

    The Toolkit is NOT meant to be used "as is" (unless you happen to need a Pointer that the Toolkit already defines AS AN EXAMPLE) - its meant to be used as the basis or template FOR YOUR OWN VERSION OF THE CODE. This is quite clearly explained in the original posts and is also obvious from a reading of the CODE.

    I suggest you go back and have a (re-)read of the code and the documentation (in particular Part 3 and the onBuildCustomPointer function Code).

    Cheers
    Part of the problem is I'm new to coding in Lua. Some more of the problem is that I'm new to programming in Fantasy Grounds. For the most part though there isn't an easy to follow tutorial for this kind of stuff, just a lot of high level information that assumes you know Lua and the structure of how Fantasy Grounds works internally. Sorry if I'm bugging you.

  8. #28

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    I reread it and somehow my sleepless addled brain missed this line: "Each can be used as is by setting the "name" attribute of the Custom tag in the ImageControl to the given name shown. The onBuildCustomPointer() function also does the final rotation and transposition of the given Pointer." Thanks for being patient.

    It works great now. Ok, so now I need to read through and find out which one is the center point and which is the outside point so I can calculate what is inside it.

  9. #29
    You're not bugging me - its simply a fact that, as you state it one of your posts, you're a programmer, and as I am a programmer and as I Project Manager other programmers I've gotten used to people (ie programmers) acting in a certain way - one of those ways is that programmers TEND to not RTFM but instead scan-read the documentation and then try to implement things - partly this is laziness (and aren't we all a little bit lazy) and partly it is the natural desire to get "stuck in". Its not that you're bugging me, its that I have a personal bugbear about people not RTFMing.

    I understand and appreciate that Lua and the XML "stuff" of how FG is put together is complex and difficult, especially for someone new to the game, but as a programmer one of the skills you should have been taught is how to read someone's code and, in effect, "reverse engineer" how the login, etc, (the underlying algorithm) fits together. As for being new to Lua, when I wrote the Toolkit so was I - I tell my students (I'm also a Tutor at the Queensland University of Technology) that writing in any given language is the easy part of coding, its writing the algorithm that's hard. If you can write the algorithm correctly than translating it into ANY coding language (from 1st generation assembly to 4th generation C-variants) is child's play.

    OK, I'll climb down off my soapbox now

    From Part 3 (emphasis added by me):

    Finally, I've included a sample onBuildCustomPointer() function with eleven sample Custom Pointers to demonstrate some ways to use each of the Curve Definition Functions. Each can be used as is by setting the "name" attribute of the Custom tag in the ImageControl to the given name shown.
    So, you have to take the SAMPLE onBuildCustomPointer() function and add it a bit to recognise your new custom-Pointer type and then call one or more of the four shape functions from the top of Part 3 (or write a new shape function) to draw your new custom-Pointer. The fact that onBuildCustomPointer() is called automatically if it exists is part of the built-in functionality of FG, as described in the Ruleset Development Documentation in the Library on the FG Website.

    OK, hope that helps

    Cheers
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  10. #30

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,089
    I reread it and somehow my sleepless addled brain missed this line: "Each can be used as is by setting the "name" attribute of the Custom tag in the ImageControl to the given name shown. The onBuildCustomPointer() function also does the final rotation and transposition of the given Pointer." Thanks for being patient.

    It works great now. Ok, so now I need to read through and find out which one is the center point and which is the outside point so I can calculate what is inside it.

    I am running into a weird problem. I've got:

    Code:
    <imagecontrol name="image">
         <script name="PointerToolkit" file="scripts/pointer_toolkit.lua" />
              <pointertypes>
         ...
              </pointertypes>
         </script>
    </imagecontrol>
    The guide says:

    Script packages are globally accessible generic script constructs similar to Lua standard library packages. Their operation is detailed on the reference page script.

    They can be accessed from other script blocks by name, which must be defined as the "name" attribute to the <script> tag. Specifying the name is not mandatory - if it is omitted, the contents of the script can still be executed using the onInit function.
    I'm trying to access global variables I added to your script file in another script file. Here is how I declared them (and this might be a failing of my understanding of Lua):

    Code:
    ...
    zones = {};
    zoneCount = 0;
    
    function onBuildCustomPointer(nStartXCoord,nStartYCoord,nEndXCoord,nEndYCoord,sPointerType)
    ...
    Here is how I'm trying to access them in my own Lua script file in the same extension:

    Code:
    if PointerToolkit[zones] then
    	msg.text = msg.text .. ". Found zones.";
    	for key, value in ipairs(PointerToolkit[zones]) do
    		if value then
    			msg.text = msg.text .. ". Found a value of zones.";
    			if value[curves] then
    				msg.text = msg.text .. value[curves];
    			end
    		end
    	end		
    end
    I've also tried to access them with:

    Code:
    PointerToolkit.zones
    I get the error:

    Code:
    Script Error: [string "scripts/zone_manager.lua"]:28: attempt to index global 'PointerToolkit' (a nil value)
    So what am I doing wrong?

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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 Product Walkthrough Playlist

Log in

Log in