360 Secure SkillHub
360 安全技能中心

dice-roller

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

terrycarter1985
terrycarter1985
热度 16.69
最近更新 2026-07-31 23:33:51
分类:生活依赖:代码执行

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add 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.