Thread: onReceiveMessage FGU question
-
April 30th, 2020, 15:56 #1
- Join Date
- Mar 2020
- Posts
- 132
onReceiveMessage FGU question
Hello all,
I am using the onReceiveMessage because I want to have the option to remove some of the message (I want the DC not to display if the DM has that option turned on).
In the API it says:
Code:Return values (boolean) If true, the message is not processed any further, omitting it from the chat history.
Even if not, then returning true should stop it appearing in the chat window?
For me neither seem to work, the message is still displayed as if nothing was changed/edited in the chat box.
Rulseset = 5e.
Code:function onReceiveMessage(msg) Debug.console("rfia_options_manager.lua msg", msg); msg.text = string.gsub(msg.text, "%[vs. DC %d+%]", "%[vs. DC ?]"); Debug.console("rfia_options_manager.lua msg after parse", msg); return false; end
Code:function onReceiveMessage(msg) Debug.console("rfia_options_manager.lua msg", msg); msg.text = string.gsub(msg.text, "%[vs. DC %d+%]", "%[vs. DC ?]"); Debug.console("rfia_options_manager.lua msg after parse", msg); return true; end
Thank you for your help!
-
May 1st, 2020, 01:07 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,564
There is no return data in the function to modify the message. You are only receiving notification of the message.
If you return "false"/"nil", then you are telling the FG client to continue standard processing.
If you return "true" then you are telling the FG client to NOT perform standard processing.
Since you are trying to intercept specific roll types, you're better off overriding the specific roll scripts to do what you want.
Regards,
JPG
-
May 1st, 2020, 11:05 #3
- Join Date
- Mar 2020
- Posts
- 132
Thank you Moon Wizard,
I must admit I do not know what "standard processing" means?
I really want to avoid overriding, so far I've only had to steal a handler, but then I always call the original handler's method; this has helped keep my mod compatible with others and also means that if 5E changes code I wont have to change anything (hopefully).
I will take another look, but I think I will just not implement it, its more of a nice to have feature .
-
May 1st, 2020, 22:19 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,564
Standard processing means the default actions/behaviors that FG performs when that event occurs. You either return true to let it do what it normally does; or return false to tell it to stop.
I get what you're saying about minimizing impacts; but it sounds like the specific handler overrides are the way to go in your situation.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks