FG Spreadshirt Swag
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    [MoreCore] Setting up icon to display when dragging results of a roll [SOLVED: #6]

    I had guessed this had to do with the:
    -- manager_custom_dice.lua file and the add_roll_type() method (arg named "action_icon")

    So I found an example, The Dark Eye extension by Trenloe. I loaded it and it did just that with /dsadamage 1d6 result being draggable and the text is replaced with a little drop of blood icon.

    I thought, simple and did same for my manager_custom_thac0.lua - based roller. I copied the "attack" icon from MoreCore and set this up in my own graphics_icons.xml and passed it in the "action_icon" argument.

    Nothing. Still drags the roll definition text when I try to drag the results. I tried several variations (including using the exact icon TDE used in case it was size/type related.) More things tried and still nothing.

    So. I added some debug code to MoreCore in a likely place and it seems it IS related but I can't figure what is missing:

    in MoreCore, manager_actions.lua I added the Debugs and the "else" clause:
    Code:
    function onChatDragStart(draginfo)
    	local sDragType = draginfo.getType();
    Debug.console("MC) -- sDragType", sDragType)	
    	if GameSystem.actions[sDragType] and GameSystem.actions[sDragType].sIcon then
    Debug.console("MC) -- sDragType icon found", GameSystem.actions[sDragType].sIcon)	
    		draginfo.setIcon(GameSystem.actions[sDragType].sIcon);
    else
    Debug.console("MC) -- sDragType icon NOT found")	
    	end
    end
    The result was, from the console log:
    Code:
    ...
    Runtime Notice: s'performAction: ' | nil | { s'sType' = s'pc', s'sCreatureNode' = s'charsheet.id-00003', s'sCTNode' = s'combattracker.list.id-00001', s'sName' = s'Varsuuk' } | s'1d6 Melee Attack'
    ...
    Runtime Notice: s'MC) -- sDragType' | s'dsadamage'
    Runtime Notice: s'MC) -- sDragType icon found' | s'attack'
    
    ...
    Runtime Notice: s'performAction: ' | nil | { s'sType' = s'pc', s'sCreatureNode' = s'charsheet.id-00003', s'sCTNode' = s'combattracker.list.id-00001', s'sName' = s'Varsuuk' } | s'1d20x0 Melee Attack'
    
    Runtime Notice: s'MC) -- sDragType' | s'number'
    Runtime Notice: s'MC) -- sDragType icon NOT found'
    The actual roller is not finished - I was just trying to get the icon up so I removed all of that from the log.
    Interestingly, the dragType when it works is the name of the roll (dsadamage). On my roller, it is "number" instead. The original dsadamage used a different icon name - I changed it while trying to figure out what was wrong and left it that way. The icon it uses is the one >I< was trying to get working on my roller.


    Any good advice or how-to on this dragging-icon behavior?
    Last edited by Varsuuk; January 4th, 2021 at 02:44.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,410
    You’ll need to include examples of all of the code you’re using, otherwise it will just be guesswork as to where this has gone wrong.
    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!

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    The good news is in trying to pick what out of all the changes I did (some totally unrelated but COULD be part of the problem I feared code) it hit me... ummm... forget my extension, do it in MoreCore alone (which has a copy of my swthac0 starting point also)

    I modified dsadamage to use a token known to MoreCore and it worked - shows the "attack" icon when dragging.
    A) BASELINE!

    Now, I took my swthac0 and changed the to use the same name and tried that... NOPE
    B) EXAMPLE OF PROBLEM

    I am going to include the dsadamage with the argument change and the swthac0.lua in question. If you want to add the debugging to the "manager_actions.lua" in MoreCore the function is in my first post. I'll also include the other roller related files to change in more core. And after seeing how many files - made it a zip file emulating the morecore dir structure (with only the modified files - note no graphics_icons.xml since I reused "attack")
    Attached Files Attached Files

  4. #4
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Cool - I took a new MoreCore unzip and put my files into it and it behaved same as in my test prior to starting anew.

    The strings I used (dsa format you know ) were: /dsadamage 1d6 and /swthac0 1d20x19

    Tried dragging both results, only the dsa shows the icon. I assume something in the rest of the dsa code is needed but don't see what. I made swthac0 from thac0.lua in MoreCore as the start point and added logging to get to know how things went and hadn't gotten far before saw this issue.

    Thanks!

    EDIT: YEEEP, it is 4:30, hitting sack Trenloe - thanks so much again for looking at this. Hopefully the zip makes it take way less time for you to review the issue. Many thanks.

  5. #5
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    I just started looking again.

    On the vanilla MoreCore with the zip additions, I inserted the "logging" code into MoreCore's onChatDragStart() with same results.

    Then, when the swthac0 roll's drag results in passing in sDragType=s'number' (for as yet not understood reason) - I replace it with "swthac0" and then - it works just like dsadamage. So the issue as I first noticed, appears to be WTH is the contents of drag info.getType() = "number" instead off the roll's name?

    (Wish breakpoints were a "thing" )

  6. #6
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    FOUND it!

    So, I knew the right "type" for dsadamage was "dsadamage" and it WAS set right - so I looked all places in the lua file where it did something with "dsadamage" and saw:
    Code:
    	rMessage = createChatMessage(rSource, rTarget, rRoll);
    	rMessage.type = "dsadamage";
    	Comm.deliverChatMessage(rMessage);
    *remember, I started my roll from thac0, not dsadamage... which had instead:*
    Code:
      rMessage = createChatMessage(rSource, rRoll);
      rMessage.type = "dice";
      Comm.deliverChatMessage(rMessage);
    So, I changed the rMessage.type = "dice" to:
    = sCmd


    And all works... now I know what is needed, it really wasn't;t the roll creation with the sCmd/"dsadamage" setting, it was later (makes sense) in the chat message creation which is what, really, is being dragged... duh, once I saw it.

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