DerBoki

TTS Diceroller addon

Aug 29th, 2021 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- Add global variable for users color
  2.  
  3. pColor = "Orange"
  4.  
  5. -- Add a setColorTint to the onload function to automatically color the diceroller for the player
  6.  
  7. function onload(saved_data)
  8.     self.setColorTint(pColor)
  9. end
  10.  
  11. -- Add the function for the scripting buttons
  12.  
  13. function onScriptingButtonDown(index, playerColor)
  14.     -- Roll dice
  15.     if playerColor == pColor and index == 1 then
  16.         buttonClick_roll(self, playerColor)
  17.     end
  18.     -- Clear dice
  19.     if playerColor == pColor and index == 2 then
  20.       buttonClick_clear(self, playerColor)
  21.     end
  22.     -- Set number of dice to 1 and roll
  23.     if playerColor == pColor and index == 3 then
  24.       howManyDice = 1
  25.       self.editButton({index=0, label=howManyDice})
  26.       buttonClick_roll(self, playerColor)
  27.     end
  28.     -- Set number of dice to 2 and roll
  29.     if playerColor == pColor and index == 4 then
  30.       howManyDice = 2
  31.       self.editButton({index=0, label=howManyDice})
  32.       buttonClick_roll(self, playerColor)
  33.     end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment