View Full Version : Is there a trick to overriding CharacterListManager.onShortcutDrop?
SilentRuin
August 4th, 2020, 19:50
In current and past extensions I've had no problem overriding core things I need to add onto (but not actually mess with insides of).
For example:
local saveonShortcutDrop = nil;
function onInit()
Debug.console(tostring(CharacterListManager.onShor tcutDrop)); -- I see a hex value
saveonShortcutDrop = CharacterListManager.onShortcutDrop;
CharacterListManager.onShortcutDrop = onShortcutDrop;
Debug.console(tostring(CharacterListManager.onShor tcutDrop)); -- I see a different hex value
end
function onShortcutDrop(sIdentity, draginfo)
Debug.console("**** THIS IS MY STUFF *****");
-- call the original stuff first then call new stuff
local bReturn = saveonShortcutDrop(sIdentity, draginfo);
end
But for whatever reason doing this with CharacterListManager.onShortcutDrop in a test run where all I do is put out Debug.console print, it is not giving me any sign it is being called.
I can see a stack dump of the original call being called
[C]: in function 'openWindow'
[string "desktop/scripts/manager_characterlist.lua"]:147: in function <[string "desktop/scripts/manager_characterlist.lua"]:137>
(tail call): ?
(tail call): ?
But I see no sign that I am replacing it. I'm not in the stack - nor are my print statements showing. I can see the onInit() with hex values printed out so something is going on.
Is there something different between this CoreRPG\desktop\scripts\manager_characterlist.lua function and other script functions I have no problems with?
Note: I never include any of these in my extension file that I override as they are usually defined someplace else I end up getting access to.
SilentRuin
August 4th, 2020, 22:23
It's time to stop asking questions when you have to answer all your own. I've evidently hit a ceiling of knowledge here - or a lack of time for the right experts to instantly respond to my wants and needs :)
Anyway, desktop is evidently weirder than the other managers. I did a look at all the functions it had (0 comments of course) and tried replacing the setting of CharacterListManager.onShortcutDrop - to registering it - which worked..
saveonShortcutDrop = CharacterListManager.onShortcutDrop;
CharacterListManager.registerDropHandler("shortcut", onShortcutDrop);
LordEntrails
August 4th, 2020, 22:32
You can always see who's available on Discord if you are looking for more timely help :)
SilentRuin
August 4th, 2020, 23:48
You can always see who's available on Discord if you are looking for more timely help :)
Are there extension testers in there? If so - maybe so one day :)
damned
August 5th, 2020, 00:05
It's time to stop asking questions when you have to answer all your own. I've evidently hit a ceiling of knowledge here - or a lack of time for the right experts to instantly respond to my wants and needs :)
Anyway, desktop is evidently weirder than the other managers. I did a look at all the functions it had (0 comments of course) and tried replacing the setting of CharacterListManager.onShortcutDrop - to registering it - which worked..
saveonShortcutDrop = CharacterListManager.onShortcutDrop;
CharacterListManager.registerDropHandler("shortcut", onShortcutDrop);
For someone to reply with a suitable answer they would have to have some combination of the below:
FG coding knowledge
Time to try and understand what it is you are doing
Some familiarity with the exact functions you are referring to
Having read your thread in the first place
There is only a handful of people messing around with the code at anyone time. They are generally busy working on their own projects. The questions are quite specific and may require someone to actually go and try and replicate what you are doing before they can see/think/work some solutions. They need time at that time, not later on after you have solved. They need to be willing to pull their head out of whatever problem they are working on to put their head in your rabbit hole. etc
At a guess I would suggest that the above paragraph probably fits you also. I dont know, but its quite likely that you havent dont the above for other programming help posts either, or the volume of helps vs requests is skewed. Its just the nature of the beast.
Sometimes just posting is enough of a rubber ducky to point you in the right direction.
What would also be good is if you posted your actual solution too - in case others come across your same issue.
I feel bad when I see programming help requests go unanswered but I also have no capacity to take on anything extra most of the time. I help if I might have some knowledge of the specifics that they are working on but I rarely have time to climb deep into someone elses rabbit hole.
superteddy57
August 5th, 2020, 04:13
How are you trying to replace it and what are you trying to accomplish? As this is a global script it would need to be cloned and redefined in your extension.xml or base.xml file as CharacterListManager to run your changes in your new file.
SilentRuin
August 5th, 2020, 17:07
For someone to reply with a suitable answer they would have to have some combination of the below:
FG coding knowledge
Time to try and understand what it is you are doing
Some familiarity with the exact functions you are referring to
Having read your thread in the first place
There is only a handful of people messing around with the code at anyone time. They are generally busy working on their own projects. The questions are quite specific and may require someone to actually go and try and replicate what you are doing before they can see/think/work some solutions. They need time at that time, not later on after you have solved. They need to be willing to pull their head out of whatever problem they are working on to put their head in your rabbit hole. etc
At a guess I would suggest that the above paragraph probably fits you also. I dont know, but its quite likely that you havent dont the above for other programming help posts either, or the volume of helps vs requests is skewed. Its just the nature of the beast.
Sometimes just posting is enough of a rubber ducky to point you in the right direction.
What would also be good is if you posted your actual solution too - in case others come across your same issue.
I feel bad when I see programming help requests go unanswered but I also have no capacity to take on anything extra most of the time. I help if I might have some knowledge of the specifics that they are working on but I rarely have time to climb deep into someone elses rabbit hole.
Understood completely. I credit anyone with finding bugs in an extension I have here by listing them with the bug fix - and I also have never NOT posted a solution to my many posts - which either someone has given me - I have more often found myself - etc. Not one. The only one's without answers to my questions via solutions are ones I have not found yet (one to my knowledge).
So no worries - I understand the nature of this beast. My part in "support" is I do ask questions - and then I do post the answers - so some poor slob likely myself does not quest through keyword searches and come up empty - like me.
In fact - the solution here is before your post (quoted by you in fact) - posted by me - and I suppose falls under the category "post first, read later" that you pointed out :)
SilentRuin
August 5th, 2020, 17:08
How are you trying to replace it and what are you trying to accomplish? As this is a global script it would need to be cloned and redefined in your extension.xml or base.xml file as CharacterListManager to run your changes in your new file.
As per the earlier posts - solution was found by me - was posted - and is working.
The gist is that while I can overwrite a function - if that function has been scooped up by another thread (and was registered) - it will never be found. Or so it seems. Anyway, look above for the solution.
superteddy57
August 5th, 2020, 17:36
Great to hear, just wanted to try to help as it sounded like there was some more investigating to perform. Please don't get discouraged as this is all a learning process and may take many cracks at unlocking the functionality you are looking to have performed. We are working hard to make development work easier and more streamlined every day. So please keep picking at the code and asking questions. You are helping everyone reading your posts.
SilentRuin
August 5th, 2020, 17:59
Great to hear, just wanted to try to help as it sounded like there was some more investigating to perform. Please don't get discouraged as this is all a learning process and may take many cracks at unlocking the functionality you are looking to have performed. We are working hard to make development work easier and more streamlined every day. So please keep picking at the code and asking questions. You are helping everyone reading your posts.
Will do.
Sorry if I've projected my frustrations, but this stupid extension has been going on 4 weeks already and I just "off the cuff" decided to add in full support for NPC's used by players (end turn, targeting, etc. which is not as easy as it sounds) causing yet another DB CT tag creation. Which then made me think do I need to be able to clear this? And other things which have 0 to do with the extension I'm working on.
Which is my problem, if I let myself I will never finish seeking perfection in this thing.
I'm going to have to just stop adding things I think are a "good idea". The problem is - running from host testing - or running as "your same username" testing - does not show all the issues until I get one of my players to test it. Then rewrite complete sections to overcome something ---- UGH.
You get the picture of where frustration is coming in.
Sorry if I projected it :)
superteddy57
August 5th, 2020, 20:19
No worries! Frustrations can happen and are quite common with some projects. My first extension was a specialization of MoreCore to use Shadow of the Demon Lord. Was constantly asking questions and bugging Damned for insights into the code. I hit a ton of walls and decided to drop it for a bit and move onto another project, which I noticed was much easier with my gained knowledge. I then tried things and tinkered and went back to fill in the gaps of what I was missing. I did that with each project. I'm not saying this is for everyone, but my point is that you might be working through a project and hitting that wall, then suddenly one day, boom, light bulb and it works. Just keep at it and we'll continue to assist the best we can.
SilentRuin
August 5th, 2020, 20:39
No worries! Frustrations can happen and are quite common with some projects. My first extension was a specialization of MoreCore to use Shadow of the Demon Lord. Was constantly asking questions and bugging Damned for insights into the code. I hit a ton of walls and decided to drop it for a bit and move onto another project, which I noticed was much easier with my gained knowledge. I then tried things and tinkered and went back to fill in the gaps of what I was missing. I did that with each project. I'm not saying this is for everyone, but my point is that you might be working through a project and hitting that wall, then suddenly one day, boom, light bulb and it works. Just keep at it and we'll continue to assist the best we can.
Well, I'm going to finish this if it kills me :)
Speaking of frustration - just had to override the dreaded applyDamage() routine in 5e for one line. ONE LINE!!!! It was buried in the middle of it too so I could not simply call the original and do my stuff to reduce risk of cross incompatibility with other extensions. I've come to the mind - sometimes your just going to not be compatible.
-- Deal with remainder damage
if nRemainder >= nTotalHP then
table.insert(aNotifications, "[INSTANT DEATH]");
nDeathSaveFail = 3;
table.insert(aNotifications, "[DAMAGE EXCEEDS HIT POINTS BY " .. nRemainder.. "]"); -- THE ONE THING I NEEDED TO ADD IN
elseif nRemainder > 0 then
table.insert(aNotifications, "[DAMAGE EXCEEDS HIT POINTS BY " .. nRemainder.. "]");
if nPrevWounds >= nTotalHP then
if rDamageOutput.bCritical then
nDeathSaveFail = nDeathSaveFail + 2;
else
nDeathSaveFail = nDeathSaveFail + 1;
end
end
else
LordEntrails
August 7th, 2020, 20:36
Are there extension testers in there? If so - maybe so one day :)
There are FG users there. If by extension testers you mean people who can connect to your game and act like a player, sure. If you mean other devs like you, well, sometimes.
Of course, it all depends upon who is there, what their time and interest is, etc.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.