diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 322d6010..925226b8 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -1055,9 +1055,9 @@ const matcher = (p1:string,matcherArg:matcherArg) => { if(p1.startsWith('pick')){ const selchar = db.characters[get(selectedCharID)] const selChat = selchar.chats[selchar.chatPage] - const cid = (chatID < 0) ? selChat.message.length : chatID + const cid = selChat.message.length if(p1.startsWith('pick::')){ - const randomIndex = Math.floor(pickHashRand(cid, selchar.chaId) * (arra.length - 1)) + 1 + const randomIndex = Math.floor(pickHashRand(cid, selchar.chaId + (selChat.id ?? '')) * (arra.length - 1)) + 1 if(matcherArg.tokenizeAccurate){ return arra[0] } @@ -1065,7 +1065,7 @@ const matcher = (p1:string,matcherArg:matcherArg) => { } else{ const arr = p1.replace(/\\,/g, '§X').split(/\:|\,/g) - const randomIndex = Math.floor(pickHashRand(cid, selchar.chaId) * (arr.length - 1)) + 1 + const randomIndex = Math.floor(pickHashRand(cid, selchar.chaId + (selChat.id ?? '')) * (arr.length - 1)) + 1 if(matcherArg.tokenizeAccurate){ return arra[0] } @@ -1088,8 +1088,8 @@ const matcher = (p1:string,matcherArg:matcherArg) => { if(p){ const selchar = db.characters[get(selectedCharID)] const selChat = selchar.chats[selchar.chatPage] - const cid = (chatID < 0) ? selChat.message.length : chatID - return (Math.floor(pickHashRand(cid, selchar.chaId) * maxRoll) + 1).toString() + const cid = selChat.message.length + return (Math.floor(pickHashRand(cid, selchar.chaId + (selChat.id ?? '')) * maxRoll) + 1).toString() } return (Math.floor(Math.random() * maxRoll) + 1).toString() }