From 457d7439a12f768bd43285892a2076e16f7b6aeb Mon Sep 17 00:00:00 2001 From: raeleus Date: Sat, 26 Oct 2024 17:38:07 -0700 Subject: [PATCH] Allow commands like "#take the 2 daggers" --- Input.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Input.js b/Input.js index 86098a6..b1c8494 100644 --- a/Input.js +++ b/Input.js @@ -2605,15 +2605,26 @@ function doTurn(command) { } function doTake(command) { + var itemIndex = 0 var arg0 = getArgument(command, 0) if (arg0 == null) { state.show = "none" return "\n[Error: Not enough parameters. See #help]\n" } + if (arg0 == "the") { + var tempArg = getArgument(command, 1) + if (tempArg != null && !isNaN(tempArg)) { + arg0 = tempArg + itemIndex++ + } + } + + if (!isNaN(arg0)) itemIndex++ + const item = { quantity: isNaN(arg0) ? 1 : arg0, - name: getArgumentRemainder(command, isNaN(arg0) ? 0 : 1).replace(/^((the)|(a)|(an))\s/, "").plural(true) + name: getArgumentRemainder(command, itemIndex).replace(/^((the)|(a)|(an))\s/, "").plural(true) } var character = getCharacter()