Houndy
April 30th, 2020, 15:56
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:
Return values
(boolean)
If true, the message is not processed any further, omitting it from the chat history.
So it sounds to me that if you edit the "messagedata" it should output the new text right?
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.
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
In the above code the console output does as expected and the msg has been parsed. However, the msg displays as normal in the chat for all users.
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
In the above code the console output does as expected and the msg has been parsed. However, in this case wouldnt you expect that no message at all is displayed in the chat?
Thank you for your help!
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:
Return values
(boolean)
If true, the message is not processed any further, omitting it from the chat history.
So it sounds to me that if you edit the "messagedata" it should output the new text right?
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.
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
In the above code the console output does as expected and the msg has been parsed. However, the msg displays as normal in the chat for all users.
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
In the above code the console output does as expected and the msg has been parsed. However, in this case wouldnt you expect that no message at all is displayed in the chat?
Thank you for your help!