forked from mirror/misskey
Resolve #5010
This commit is contained in:
parent
89f16668e6
commit
bb4ca7b31a
@ -2151,6 +2151,9 @@ pages:
|
|||||||
_pick:
|
_pick:
|
||||||
arg1: "リスト"
|
arg1: "リスト"
|
||||||
arg2: "位置"
|
arg2: "位置"
|
||||||
|
listLen: "リストの長さを取得"
|
||||||
|
_listLen:
|
||||||
|
arg1: "リスト"
|
||||||
number: "数値"
|
number: "数値"
|
||||||
stringToNumber: "テキストを数値に"
|
stringToNumber: "テキストを数値に"
|
||||||
_stringToNumber:
|
_stringToNumber:
|
||||||
|
@ -171,6 +171,7 @@ export class ASEvaluator {
|
|||||||
numberToString: (a: number) => a.toString(),
|
numberToString: (a: number) => a.toString(),
|
||||||
splitStrByLine: (a: string) => a.split('\n'),
|
splitStrByLine: (a: string) => a.split('\n'),
|
||||||
pick: (list: any[], i: number) => list[i - 1],
|
pick: (list: any[], i: number) => list[i - 1],
|
||||||
|
listLen: (list: any[]) => list.length,
|
||||||
random: (probability: number) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability,
|
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)),
|
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)],
|
randomPick: (list: any[]) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)],
|
||||||
|
@ -74,6 +74,7 @@ export const funcDefs: Record<string, { in: any[]; out: any; category: string; i
|
|||||||
numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, },
|
numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, },
|
||||||
splitStrByLine: { in: ['string'], out: 'stringArray', category: 'convert', icon: faExchangeAlt, },
|
splitStrByLine: { in: ['string'], out: 'stringArray', category: 'convert', icon: faExchangeAlt, },
|
||||||
pick: { in: [null, 'number'], out: null, category: 'list', icon: faIndent, },
|
pick: { in: [null, 'number'], out: null, category: 'list', icon: faIndent, },
|
||||||
|
listLen: { in: [null], out: 'number', category: 'list', icon: faIndent, },
|
||||||
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
seedRannum: { in: [null, 'number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
seedRannum: { in: [null, 'number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
|
Loading…
Reference in New Issue
Block a user