mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-25 13:39:06 +01:00
いくつかの文字列関数を追加
This commit is contained in:
parent
4e961b9a13
commit
a76760f0bf
@ -1902,12 +1902,28 @@ pages:
|
|||||||
random: "ランダム"
|
random: "ランダム"
|
||||||
value: "値"
|
value: "値"
|
||||||
fn: "関数"
|
fn: "関数"
|
||||||
|
text: "テキスト操作"
|
||||||
blocks:
|
blocks:
|
||||||
text: "テキスト"
|
text: "テキスト"
|
||||||
multiLineText: "テキスト(複数行)"
|
multiLineText: "テキスト(複数行)"
|
||||||
textList: "テキストのリスト"
|
textList: "テキストのリスト"
|
||||||
_textList:
|
_textList:
|
||||||
info: "ひとつひとつを改行で区切ってください"
|
info: "ひとつひとつを改行で区切ってください"
|
||||||
|
strLen: "テキストの長さ"
|
||||||
|
_strLen:
|
||||||
|
arg1: "テキスト"
|
||||||
|
strPick: "文字取り出し"
|
||||||
|
_strPick:
|
||||||
|
arg1: "テキスト"
|
||||||
|
arg2: "文字の位置"
|
||||||
|
strReplace: "テキスト置き換え"
|
||||||
|
_strReplace:
|
||||||
|
arg1: "テキスト"
|
||||||
|
arg2: "置き換え前"
|
||||||
|
arg3: "置き換え後"
|
||||||
|
strReverse: "テキストを反転"
|
||||||
|
_strReverse:
|
||||||
|
arg1: "テキスト"
|
||||||
add: "+ 足す"
|
add: "+ 足す"
|
||||||
_add:
|
_add:
|
||||||
arg1: "A"
|
arg1: "A"
|
||||||
|
@ -65,6 +65,10 @@ const funcDefs = {
|
|||||||
lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, },
|
lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, },
|
||||||
gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, },
|
gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, },
|
||||||
ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, },
|
ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, },
|
||||||
|
strLen: { in: ['string'], out: 'number', category: 'text', icon: faQuoteRight, },
|
||||||
|
strPick: { in: ['string', 'number'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
|
strReplace: { in: ['string', 'string', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
|
strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
||||||
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
||||||
@ -413,6 +417,10 @@ export class AiScript {
|
|||||||
subtract: (a, b) => a - b,
|
subtract: (a, b) => a - b,
|
||||||
multiply: (a, b) => a * b,
|
multiply: (a, b) => a * b,
|
||||||
divide: (a, b) => a / b,
|
divide: (a, b) => a / b,
|
||||||
|
strLen: (a) => a.length,
|
||||||
|
strPick: (a, b) => a[b - 1],
|
||||||
|
strReplace: (a, b, c) => a.split(b).join(c),
|
||||||
|
strReverse: (a) => a.split('').reverse().join(''),
|
||||||
random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability,
|
random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability,
|
||||||
rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)),
|
rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)),
|
||||||
randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)],
|
randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)],
|
||||||
|
Loading…
Reference in New Issue
Block a user