Back our Kickstarter Campaign going on Now
  1. #1
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland
    Posts
    259

    Sending the result into chat

    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

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    18,366
    Blog Entries
    1
    You are using Comm.deliverChatMessage(msg); right?

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland
    Posts
    259
    Quote Originally Posted by damned View Post
    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

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    18,366
    Blog Entries
    1
    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);
    Last edited by damned; April 20th, 2019 at 07:04.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  5. #5
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland
    Posts
    259
    Quote Originally Posted by damned View Post
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in