From 4f31e1f63695143066ee037c81372136c495a94b Mon Sep 17 00:00:00 2001 From: Nartoleane <157272932+Nartoleane@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:54:36 +1000 Subject: [PATCH] Update variable.ts fixed issue with updating variable, when updating an int variable it would set it to a string and from then on when the game naturally updates variable it would add to string. for example variable is 1 (integer) use changes variable to 30 (integer) with command but actually changes it to 30 (string) the game updates the variable by +1 later the variable is updated to 301 (string) instead of 31 integer --- src/commands/variable.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/variable.ts b/src/commands/variable.ts index 25ee779..597e858 100644 --- a/src/commands/variable.ts +++ b/src/commands/variable.ts @@ -33,7 +33,13 @@ const onCommand = (handler: CommandHandler, args: string[]) => { return; } - $gameVariables.setValue(variable, args[2]); + try { + let val = Number(args[2]); + if (isNaN(val)) throw new Error("Not a number"); + $gameVariables.setValue(variable, val); + } catch (e) { + $gameVariables.setValue(variable, args[2]); + } handler.log( `"${args[1]}" is set to ${$gameVariables.value(variable)}`, );