PDA

View Full Version : Sending the result into chat



Kelrugem
April 20th, 2019, 06:42
Hi :)

I wrote an extension for fortification (some effect in 3.5e, not important now); there is a d100 involved, but for the first version I do not want to try a graphical display of this d100 and, thus, I just use math.number(100). But I would like to send the result of this random number into the Chat (best: to GM only if possible). How can I do this in lua? :) I always get error messages of different type when I try to use the deliverChatMessage(...) etc. :)

(If it is important: That is happening while the damage roll is executed)

Thank you in advance :)

Best,

Kelrugem

damned
April 20th, 2019, 06:44
You are using Comm.deliverChatMessage(msg); right?

Kelrugem
April 20th, 2019, 06:52
You are using Comm.deliverChatMessage(msg); right?

Yes, that is what I tried :) Sorry, forgot the Comm. in my initial post but it was in my code :)

This is basically what I try:

local rRollFortif = math.random(100);
local msg = {sender = "", font = "emotefont"};
msg = "Fortification roll result" .. rRollFortif;
Comm.deliverChatMessage(msg);

But I get then the error message "deliverChatMessage: Invalid parameter" :) I guess I define msg somehow wrong

damned
April 20th, 2019, 07:01
You need something more like this:

local rRollFortif = math.random(100);
local msg = {sender = "", font = "emotefont"};
msg.text = "Fortification roll result " .. rRollFortif;
Comm.deliverChatMessage(msg);

Kelrugem
April 20th, 2019, 07:15
You need something more like this:

local rRollFortif = math.random(100);
local msg = {sender = "", font = "emotefont"};
msg.text = "Fortification roll result " .. rRollFortif;
Comm.deliverChatMessage(msg);

Aaaah, thank you very much, this worked :)