360 Secure SkillHub
360 安全技能中心

dice-roller

该 Skill 通过 Python 脚本解析 2d6+3、1d20、4d6kh3 等标准骰子记法,输出各骰结果、保留骰、修正值与总数;支持可选种子实现可复现掷骰,--quiet 仅输出总数,无效记法会报错退出。

分类:生活
terrycarter1985
terrycarter1985
热度 13.98
最近更新 2026-07-31 23:33:51

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add terrycarter1985/dice-roller
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
dice-roller
description
Roll dice using standard tabletop notation (e.g. 2d6+3, 1d20, 4d6kh3). Use when the user asks to roll dice, generate random numbers within a dice-shaped distribution, resolve RPG-style checks, or needs reproducible random rolls via a seed. Supports modifiers and "keep highest" (kh) notation.

Dice Roller

Roll dice in standard notation via scripts/roll.py.

Usage

python3 scripts/roll.py <spec> [--seed N] [--quiet]
  • spec: dice notation — <count>d<sides>[+/-<mod>][kh<keep>]
    • Examples: 2d6, 1d20+5, 3d8-1, 4d6kh3 (roll 4d6, keep highest 3)
  • --seed N: optional integer seed for reproducible rolls
  • --quiet: print only the total

Output

Default prints rolls, kept dice (if applicable), modifier, and total:

Rolls: [6, 2] | Modifier: +3 | Total: 11

--quiet prints only the integer total.

Notes

  • At least 1 die and 2 sides required.
  • kh keep count cannot exceed dice rolled.
  • Invalid notation exits with code 2 and an error message.