FG Spreadshirt Swag
Page 1 of 6 123 ... Last
  1. #1
    ShotGun Jolly's Avatar
    Join Date
    Aug 2009
    Location
    St. Johns, NL, Canada
    Posts
    717

    Draw a 30* Cone Pointer - Looking for some help.

    Guys.. I can really use the help with some XML coding for my Back Crusade ruleset.. I really need to get that 30* cone (pointer) to show up. But I can not get it to appear like it should...

    I have followed the excellent instructions from Dulux-Oz in his tutorial; on how to do it. But I can not figure out why I can not get it to appear when I draw it on the map. I can get everything else to work, it shows range, the two points when you draw it and rotate it, but not the actual cone!

    Anyone willing to try and help me figure it out???? Please?

    Trust me, its not for lack of trying.. but there is something I am missing and I can not get it to work.

    Jolly
    Last edited by ShotGun Jolly; December 13th, 2014 at 00:38.

  2. #2
    ShotGun Jolly's Avatar
    Join Date
    Aug 2009
    Location
    St. Johns, NL, Canada
    Posts
    717

    The problem..

    Ok..

    Here is the problem that I can not solve..

    I have added my custom cone to the radial menu, I can select it and I can draw it. In the below picture, you can see all of the other pointers which I can draw, (Circle, 45* Cone, and Line) Now, look at my mouse, where my mouse is currently resting, you can see one of two small squares.. this is my 30* which I drew. As you can see, there is no outline, just the start and finish points. And that only appears when I mouse over it.

    Attachment 8266

    Here is the campaign_Images.XML which I needed to edit to allow the pointers to show up.

    Code:
    <imagecontrol name="image">
    			<script file="My_Cone.lua" />
            <pointertypes>
    				<arrow>
    			<icon>pointer</icon>
    			<label>Draw Arrow</label>
    		</arrow>
    				<circle>
    			<icon>pointer_circle</icon>
    			<label>Draw Circle</label>
    		</circle>
    		<cone>
    			<icon>pointer_cone</icon>
    			<label>Draw Cone</label>
    		</cone>
    		<custom name="30ConePointer">
    			<icon>pointer_cone</icon>
    			<label>Draw a 30-Degree Cone</label>
    		</custom>
    	</pointertypes>
    And here is the My_Cone.lua which I had to make so the above code could link to it.

    Code:
    function onBuildCustomPointer(nStartXCoord,nStartYCoord,nEndXCoord,nEndYCoord,sPointerType)
    	local nLength = math.sqrt((nEndXCoord-nStartXCoord)^2+(nEndYCoord-nStartYCoord)^2);
    	if nLength == 0 then
    		return
    	end
    	local aShapeCurves = {};
    	local aDistLabelPosition = {25,25};
    	local bDrawArrow = false;
    	local nAngleRadians = math.atan2(nEndXCoord-nStartXCoord,nStartYCoord-nEndYCoord);
    -- Call the relevant Pointer Definition Function
    	if sPointerType == "30ConePointer" then
    		fpConePointer(aShapeCurves,nLength,30);
    	end
    -- Rotate and Position the Pointer
    	for nIndex,aCurve in ipairs(aShapeCurves) do
    		for nPointIndex,aPoint in ipairs(aCurve) do
    			local nXCoord = aPoint[1]*math.cos(nAngleRadians)-aPoint[2]*math.sin(nAngleRadians)+nStartXCoord;
    			local nYCoord = aPoint[1]*math.sin(nAngleRadians)+aPoint[2]*math.cos(nAngleRadians)+nStartYCoord;
    			aCurve[nPointIndex] = {nXCoord,nYCoord};
    		end
    	end
    	return aShapeCurves,aDistLabelPosition,bDrawArrow;
    end
    What am I doing wrong which causes my custom cone not to appear?

  3. #3
    I know absolutely nothing about the custom drawing stuff, so this may be a total stab in the dark, but could it be the line "local bDrawArrow=false" ? Should that be set to true somewhere?

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    EDIT: Ignore previous info in this post...

    I take it you're trying to do something along the lines of this post: https://www.fantasygrounds.com/forum...ustom-Pointers

    If so, this is suggesting that you need to subtract a centerx value from aPoint[1] and subtract a centery value from aPoint[2] in the calculations.
    Last edited by Trenloe; December 13th, 2014 at 01:14.
    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!

  5. #5
    ShotGun Jolly's Avatar
    Join Date
    Aug 2009
    Location
    St. Johns, NL, Canada
    Posts
    717
    Tried both suggestions, even before Trenloe changed his first suggestion.. ;-)

    Neither made any change at all, no matter what

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    when you get this working - could I make a suggestion/request? great! thanks could you package the pointer up as a standalone extension too (if possible) so that people can learn from your learns or at least just reuse your damn pointer.

  7. #7
    ShotGun Jolly's Avatar
    Join Date
    Aug 2009
    Location
    St. Johns, NL, Canada
    Posts
    717
    Quote Originally Posted by damned View Post
    when you get this working - could I make a suggestion/request? great! thanks could you package the pointer up as a standalone extension too (if possible) so that people can learn from your learns or at least just reuse your damn pointer.
    When I get this working, would you show me how to make said extension? As I have no idea how to do that.

    Besides, with the collective power of the internet on our sides.. I am hoping to solve this, and world hunger in the next few days..

  8. #8
    OK, first off you're missing a function - where in your code is the fpConePointer() function?

    And, obviously, the functions called by fpConePointer()?


    Secondly, I don't think its going to be possible to put this into an Extension, mainly because you have to override other Pointer drawing code and therefore "stuff up" those other Pointers - mind you, if you prove me wrong then I'll take my hat off to you.

    Cheers
    Last edited by dulux-oz; December 13th, 2014 at 02:24.
    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

  9. #9
    Quote Originally Posted by damned View Post
    when you get this working - could I make a suggestion/request? great! thanks could you package the pointer up as a standalone extension too (if possible) so that people can learn from your learns or at least just reuse your damn pointer.
    damned => its all in my Pointer Toolkit (on the Wiki and in the Thread on the Forums). Yes, its not the easiest thing in the world to do, but if you read through the doco (RTFM) you shouldn't have that much trouble - and you can always ask me (or others) questions.

    I mean, that's why I made the damn thing

    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. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by dulux-oz View Post
    damned => its all in my Pointer Toolkit (on the Wiki and in the Thread on the Forums).
    Just need to go through your final code and change the multiplication symbols x to * so that it works in FG!

    Extension attached to do add a 30 degree cone to the CoreRPG ruleset. Thanks to dulux_oz for the code (even without the *s).
    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!

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
  •  
DICE PACKS BUNDLE

Log in

Log in