-
February 7th, 2014, 11:27 #21
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!
-
February 7th, 2014, 12:23 #22
Saint
- Join Date
- Apr 2007
- Location
- Mississippi, USA
- Posts
- 1,089
Support:
https://support.fantasygrounds.com/
-
February 7th, 2014, 12:35 #23
Saint
- 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?
Support:
https://support.fantasygrounds.com/
-
February 7th, 2014, 13:34 #24
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>
CheersDulux-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
-
February 7th, 2014, 22:48 #25
Saint
- Join Date
- Apr 2007
- Location
- Mississippi, USA
- Posts
- 1,089
Support:
https://support.fantasygrounds.com/
-
February 8th, 2014, 04:47 #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).
CheersDulux-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
-
February 8th, 2014, 04:52 #27
Saint
- Join Date
- Apr 2007
- Location
- Mississippi, USA
- Posts
- 1,089
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.
Support:
https://support.fantasygrounds.com/
-
February 8th, 2014, 05:05 #28
Saint
- 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.Support:
https://support.fantasygrounds.com/
-
February 8th, 2014, 05:26 #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.
OK, hope that helps
CheersDulux-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
-
February 8th, 2014, 07:07 #30
Saint
- 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>
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.
Code:... zones = {}; zoneCount = 0; function onBuildCustomPointer(nStartXCoord,nStartYCoord,nEndXCoord,nEndYCoord,sPointerType) ...
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
Code:PointerToolkit.zones
Code:Script Error: [string "scripts/zone_manager.lua"]:28: attempt to index global 'PointerToolkit' (a nil value)
Support:
https://support.fantasygrounds.com/
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks