Edrig / OBS-Websocket-Chataigne-Module

11 stars 8 forks source link

Sending a command interrupts connexion to WS server and throws a JS error #25

Open sebescudie opened 11 months ago

sebescudie commented 11 months ago

Hey there,

Here's my setup :

I just added the module to my project and was trying a bunch of commands in the Command Tester, but everytime I send a command, I'm getting those errors in the Log :

16:17:38.446    OBS Websocket   Connection closed
16:17:39.451    OBS Websocket   Connection opened
16:17:39.452    OBS Script Error :
        Line 94, column 22 : Unknown function 'split'

See the following repro video

https://github.com/Edrig/OBS-Websocket-Chataigne-Module/assets/8690430/ec901d43-b957-42f1-85f1-fffb72de9bd6

Am I missing something?

Thanks!

ChloeoeoeZ commented 8 months ago

I'm getting the same error message. Châtaigne 1.9.17 OBS Websocket Châtaigne module 2.0.8 OBS 30.0.2

Script Error : Line 94, column 22 : Unknown function 'split'

seanmcnally98 commented 6 months ago

Same issue here, Line 94, column 22 : Unknown function 'split'

seanmcnally98 commented 6 months ago

So here's the thing, I know next to nothing about Javascript, but I was able to fix it by going into Chataigne\modules\OBS-Websocket-Chataigne-Module-main\OBS.js, and editing the function at line 94 to this:

function toDecimal(v) { var decimal = 0; for (var i = 0; i < v.length; i++) { // Convert character to integer equivalent var digit = parseInt(v.charAt(i)); // Check if the character is a valid binary digit if (isNaN(digit) || digit < 0 || digit > 1) { // If not a valid binary digit, return NaN (Not a Number) return NaN; } // Update the decimal value by multiplying by 2 and adding the binary digit decimal = (decimal * 2) + digit; } return decimal; }

Your mileage may vary, this worked for me but is definitely a temporary solution.