diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e337f9383..c9f7436a9 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1941,6 +1941,7 @@ pages: fn: "関数" text: "テキスト操作" convert: "変換" + list: "リスト" blocks: text: "テキスト" multiLineText: "テキスト(複数行)" @@ -2062,6 +2063,10 @@ pages: DRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" _DRPWPM: arg1: "テキストのリスト" + pick: "リストから選択" + _pick: + arg1: "リスト" + arg2: "位置" number: "数値" stringToNumber: "テキストを数値に" _stringToNumber: diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index e28bf6414..2100b565d 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -169,6 +169,7 @@ export class ASEvaluator { stringToNumber: (a: string) => parseInt(a), numberToString: (a: number) => a.toString(), splitStrByLine: (a: string) => a.split('\n'), + pick: (list: any[], i: number) => list[i - 1], random: (probability: number) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability, rannum: (min: number, max: number) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)), randomPick: (list: any[]) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)], diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 46d075168..4f66d688e 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -23,6 +23,7 @@ import { faSortNumericUp, faExchangeAlt, faRecycle, + faIndent, } from '@fortawesome/free-solid-svg-icons'; import { faFlag } from '@fortawesome/free-regular-svg-icons'; @@ -72,6 +73,7 @@ export const funcDefs: Record