PF2E Playlist
  1. #1

    Rolling Dice without Graphics

    Is there a way to roll a dice in a script without the graphics in the chat window and get the result?
    Basically a function like this:
    Code:
    local result = rolldice({'d6'})
    Thank you

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    22,383
    Blog Entries
    1
    either use the dice tower or maybe use

    local result = math.random(6);

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

  3. #3
    The d6 was an example it should be more general. And I want it in a script not by dragging something into the tower.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    27,776
    Quote Originally Posted by Weltenbrand View Post
    And I want it in a script not by dragging something into the tower.
    So use math.random as mentioned by @damned.

    Or, for slightly more complex RPG type dice strings, use StringManager.evalDiceString(sDice, bAllowDice, bMaxDice) - this uses math.random to return the total of the dice string passed in the sDice variable. This function is in the CoreRPG ruleset (scripts\manager_string.lua file). And is used in some of the layered rulesets - search for StringManager.evalDiceString in rulesets for an example. To roll1d6 you'd use local nResult = StringManager.evalDiceString("1d6", true);
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Quote Originally Posted by Trenloe View Post
    StringManager.evalDiceString(sDice, bAllowDice, bMaxDice)
    That is what I was looking for, thank you.

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
  •  
5E Character Create Playlist

Log in

Log in