-
January 3rd, 2021, 08:36 #1
[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
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'
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.
-
January 3rd, 2021, 09:00 #2
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!
-
January 3rd, 2021, 09:21 #3
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")
-
January 3rd, 2021, 09:31 #4
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.
-
January 3rd, 2021, 21:11 #5
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" )
-
January 3rd, 2021, 21:35 #6
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);
Code:rMessage = createChatMessage(rSource, rRoll); rMessage.type = "dice"; Comm.deliverChatMessage(rMessage);
= 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