Closed JKRhb closed 1 year ago
Good point! With 24af3128e38835bf3b00301b38daa394ac643f78, this should become possible for instances where one or two words are between verb and noun, as in go to the door
.
Awesome, thank you for implementing this :)
With https://github.com/alephmembeth/textadventure-from-scratch/commit/24af3128e38835bf3b00301b38daa394ac643f78, this should become possible for instances where one or two words are between verb and noun, as in go to the door.
One thing I noticed in the commit: Could it be that it should rather be
elif words.size() > 3:
second_word = words[-1].to_lower()
instead of
to actually get the last word?
Just tested it to be sure; [3]
gets the fourth word from the PackedStringArray words
as intended. Thanks for the close look! :)
Actually, this produces an error for one-word commands, so I'll reopen the issue. :'D
Of course, you were right about calling -1
! Now, c74f390a6e6a8372dfa65d43286b76d48f96142f should fix this.
Of course, you were right about calling
-1
! Now, c74f390 should fix this.
Awesome! :) Maybe, though, you could also use -1
for a catch-all condition after 0 and 1? That is, something like the following:
if words.size() == 0:
return "No words were parsed."
elif words.size() == 1:
second_word == ""
else:
second_word = words[-1].to_lower()
(Since this would also cover the condition words.size() == 2
, if I am not mistaken.)
Oh, my tired eyes didn't catch that yesterday. Changed it accordingly in 97f3991cc632f7f304f213bdbe9f4325ebd934e7. :)
Currently, you can only use the
go
andtalk
commands without a particle (e.g., "to"), which leads to prompts such asgo alley
ortalk guard
. I think in the midterm, it could be nice to also allow for more "complete" sentences, such asgo to alley
ortalk to guard
.