Thread: Rolling Dice without Graphics
-
October 29th, 2020, 10:40 #1
- Join Date
- Sep 2018
- Posts
- 75
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'})
-
October 29th, 2020, 11:33 #2
either use the dice tower or maybe use
local result = math.random(6);
-
October 29th, 2020, 11:36 #3
- Join Date
- Sep 2018
- Posts
- 75
The d6 was an example it should be more general. And I want it in a script not by dragging something into the tower.
-
October 29th, 2020, 12:07 #4
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);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!
-
October 29th, 2020, 12:22 #5
- Join Date
- Sep 2018
- Posts
- 75
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks