Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes. edit

Thank you for your patience while we continue to upgrade DDOwiki to the latest MediaWiki LTS version. If you find any errors on the site, please visit the Discord chat server and let us know.

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to remove ads, build a reputation, and unlock more editing privileges and then visit DDO wiki's IRC Chat/Discord if you need any help!

User:Technical 13/SandBox/mIRC scripts/DDO style dice

From DDO wiki
Jump to navigation Jump to search

<css> div#contentSub2 span {

   display: inline;
   float: right;

</css>

⇑   ⇑   Back to top   ⇑   ⇑
General   Journal   Sand Box   To Do List   Characters   Quest List   Crafting   Talk  



 


;--- DDO style dice ---
on *:TEXT:!Roll*:# {
  if (%quote.flood == $null) {
    if ($$2- == help) {
      /notice $nick * The syntax almost mirrors the in-game syntax with the only difference being that
      /notice $nick * you use "!roll" instead or "/roll" like:  !Roll {Number}d{Sides}[+|-][Modifier]
      /notice $nick * {Number} is the number of dice to roll.
      /notice $nick ** Defaults to 1 if omitted.
      /notice $nick * {Sides} is the number of sides per dice.
      /notice $nick ** Current acceptable range is 2 - 10000000000
      /notice $nick ** If {Number} * {Sides} > 9999999999 !roll will overflow (you will roll a 0).
      /notice $nick * [+|-][Modifier] is the number to be added or subtracted to the outcome of the roll total.
      /notice $nick ** Ommitted if not a number.
    }
    else {
      /set %DT_DiceRolled 0
      /set %DT_length $len($$2-)
      /set %DT_oneD $count($$2-,d)
      if (%DT_oneD != 1) {
        /notice $nick $$2- is an invalid roll attempt. Please try again. If you need directions, type: !Roll help
        goto CleanUp
      }
      /set %DT_dPos $pos($$2-,d,1)
      /set %DT_oneP $count($$2-,+)
      if (%DT_oneP == 1) { /set %DT_pPos $pos($$2-,+,1) }
      else { /unset %DT_oneP }
      /set %DT_oneM $count($$2-,-)
      if (%DT_oneM == 1) { /set %DT_mPos $pos($$2-,-,1)  }
      else { /unset %DT_oneM }
      /set %DT_dice $left($$2-,$calc(%DT_dPos - 1))
      if (%DT_dice == $null) { /set %DT_dice 1 }
      if (%DT_dice !isnum 1-10000000000) {
        /notice $nick " $+ %DT_dice $+ " is NOT a valid number of dice.  Please try again.
        goto CleanUp
      }
      /set %DT_sides $right($$2,$calc(%DT_length - %DT_dPos))
      if (%DT_sides !isnum 2-10000000000) {
        if (%DT_oneP == 1) {
          /set %DT_mod $right($$2-,$calc(%DT_length - %DT_pPos))
          /set %DT_sides $mid($$2-,$calc(%DT_dPos + 1),$calc(%DT_pPos - (%DT_dPos + 1)))
          /set %DT_modSign +
          if  (%DT_sides !isnum 2-10000000000) {
            /notice $nick " $+ %DT_sides $+ " is NOT a valid number of sides.  Please try again.
            goto CleanUp
          }
          if (%DT_mod !isnum) {
            /notice $nick " $+ %DT_modSign $+ %DT_mod $+ " is not a valid modifier -- it will be ignored from the result.
            /unset %DT_mod %DT_modSign
          }
        }
        elseif (%DT_oneM == 1) {
          /set %DT_mod $right($$2-,$calc(%DT_length - %DT_mPos)) 
          /set %DT_sides $mid($$2-,$calc(%DT_dPos + 1),$calc(%DT_mPos - (%DT_dPos + 1)))
          /set %DT_modSign -
          if  (%DT_sides !isnum 2-10000000000) {
            /notice $nick " $+ %DT_sides $+ " is NOT a valid number of sides.  Please try again.
            goto CleanUp
          }
          if (%DT_mod !isnum) {
            /notice $nick " $+ %DT_modSign $+ %DT_mod $+ " is not a valid modifier -- it will be ignored from the result.
            /unset %DT_mod %DT_modSign
          }
        }
        else {
          /notice $nick " $+ %DT_sides $+ " is NOT a valid number of sides.  Please try again.
          goto CleanUp
        }
      }
      if ($calc(%DT_dice * %DT_sides) >= 10000000000) {
        /set %DT_RollSum 0
      }
      else {
        while (%DT_DiceRolled < %DT_dice) {
          set %DT_roll $rand(1,%DT_sides)
          set %DT_RollSum $calc(%DT_RollSum + %DT_roll)
          inc %DT_DiceRolled
        }
      }
      /set %DT_TotalRollPreComma $calc(%DT_RollSum %DT_modSign %DT_mod)
      $regsub($ticks,%DT_TotalRollPreComma,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%DT_TotalRoll)
      if ((%DT_TotalRoll == 8) || (%DT_TotalRoll == 11) || (%DT_TotalRoll == 18) || ((%DT_TotalRoll >= 80) && (%DT_TotalRoll <= 89))) {
        /set %DT_anA an
      }
      else {
        /set %DT_anA a
      }
      msg $chan $nick rolled %DT_anA %DT_TotalRoll ( $+ %DT_dice $+ d $+ %DT_sides $+ %DT_modSign $+ %DT_mod $+ ).
      /notice $nick You rolled %DT_anA %DT_TotalRoll ( $+ %DT_dice $+ d $+ %DT_sides $+ %DT_modSign $+ %DT_mod $+ ).
      /set %DT_Users $nick($chan,0)
      /set %DT_UserCounter 1
      while (%DT_UserCounter < %DT_Users) {
        if ($nick != $nick($chan,%DT_UserCounter)) {
          /notice $nick($chan,%DT_UserCounter) $nick rolled %DT_anA %DT_TotalRoll ( $+ %DT_dice $+ d $+ %DT_sides $+ %DT_modSign $+ %DT_mod $+ ).
        }
        inc %DT_UserCounter
      }
      :CleanUp
      /unset %DT_*
    }
  }
  set -u2 %quote.flood on
}