mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 04:03:49 +01:00
Add splitStrByLine function
This commit is contained in:
parent
c6c34f775c
commit
ed1622a46b
@ -2053,6 +2053,9 @@ pages:
|
|||||||
numberToString: "数値をテキストに"
|
numberToString: "数値をテキストに"
|
||||||
_numberToString:
|
_numberToString:
|
||||||
arg1: "数値"
|
arg1: "数値"
|
||||||
|
splitStrByLine: "テキストを行で分割"
|
||||||
|
_splitStrByLine:
|
||||||
|
arg1: "テキスト"
|
||||||
ref: "変数"
|
ref: "変数"
|
||||||
fn: "関数"
|
fn: "関数"
|
||||||
_fn:
|
_fn:
|
||||||
|
@ -61,37 +61,38 @@ type TypeError = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const funcDefs = {
|
const funcDefs = {
|
||||||
if: { in: ['boolean', 0, 0], out: 0, category: 'flow', icon: faShareAlt, },
|
if: { in: ['boolean', 0, 0], out: 0, category: 'flow', icon: faShareAlt, },
|
||||||
for: { in: ['number', 'function'], out: null, category: 'flow', icon: faRecycle, },
|
for: { in: ['number', 'function'], out: null, category: 'flow', icon: faRecycle, },
|
||||||
not: { in: ['boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
not: { in: ['boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
||||||
or: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
or: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
||||||
and: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
and: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
|
||||||
add: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faPlus, },
|
add: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faPlus, },
|
||||||
subtract: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faMinus, },
|
subtract: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faMinus, },
|
||||||
multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, },
|
multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, },
|
||||||
divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
|
divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
|
||||||
eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, },
|
eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, },
|
||||||
notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, },
|
notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, },
|
||||||
gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },
|
gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },
|
||||||
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, },
|
strLen: { in: ['string'], out: 'number', category: 'text', icon: faQuoteRight, },
|
||||||
strPick: { in: ['string', 'number'], out: 'string', 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, },
|
strReplace: { in: ['string', 'string', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
join: { in: ['stringArray', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
join: { in: ['stringArray', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
|
||||||
stringToNumber: { in: ['string'], out: 'number', category: 'convert', icon: faExchangeAlt, },
|
stringToNumber: { in: ['string'], out: 'number', category: 'convert', icon: faExchangeAlt, },
|
||||||
numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, },
|
numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, },
|
||||||
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
splitStrByLine: { in: ['string'], out: 'stringArray', category: 'convert', icon: faExchangeAlt, },
|
||||||
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
seedRannum: { in: [null, 'number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
seedRannum: { in: [null, 'number', 'number'], out: 'number', category: 'random', icon: faDice, },
|
||||||
dailyRandom: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
||||||
seedRandom: { in: [null, 'number'], out: 'boolean', category: 'random', icon: faDice, },
|
dailyRandom: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
|
||||||
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
seedRandom: { in: [null, 'number'], out: 'boolean', category: 'random', icon: faDice, },
|
||||||
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
||||||
seedRandomPick: { in: [null, 0], out: 0, category: 'random', icon: faDice, },
|
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
||||||
|
seedRandomPick: { in: [null, 0], out: 0, category: 'random', icon: faDice, },
|
||||||
};
|
};
|
||||||
|
|
||||||
const literalDefs = {
|
const literalDefs = {
|
||||||
@ -502,6 +503,7 @@ export class AiScript {
|
|||||||
join: (texts, separator) => texts.join(separator || ''),
|
join: (texts, separator) => texts.join(separator || ''),
|
||||||
stringToNumber: (a) => parseInt(a),
|
stringToNumber: (a) => parseInt(a),
|
||||||
numberToString: (a) => a.toString(),
|
numberToString: (a) => a.toString(),
|
||||||
|
splitStrByLine: (a) => a.split('\n'),
|
||||||
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