> look
There is a bag here.
> inv
You have a bag.
> get sword from bag
Did you mean your bag or the bag on the ground?
public static final def OBJECT_NAME_EXP = /^([\w\W\s])+(?=\s[0-9]+)|^[\w\W\s]+$/
// matches the index
public static final def INDEX_EXP = /\s[0-9]+$/
…
def void parse(argstr, prepositionExp){
def prepositionExpSpaced = /$prepositionExp /
def postPrepositionExp = /$prepositionExp [\w\W\s]+(\s[0-9]*)?$/
def subjectExpression = /^[\w\W]+(?=\s$prepositionExp)|^[\w\W\s]+(\s[0-9]+)?$/
subjectObject = parseSubject(argstr, subjectExpression);
prepositionObject = parsePrepostionPart(argstr, prepositionExpSpaced, postPrepositionExp)
}
…
get red flag 2 from sack
…
parser = new GenericSyntaxParser()
parser.parse(argstr, "from|(out of)")
…
> look
There is a bag here.
> inv
You have a bag.
> get sword from bag
Did you mean your bag or the bag on the ground?
> put key in hat on treestump
There is no sign of either a hat on a treestump or a hat containing a key.
> look
There is a bag here.
> inv
You have a bag.
> get sword from bag
Did you mean your bag or the bag on the ground?
> put key in hat on treestump
There is no sign of either a hat on a treestump or a hat containing a key.
Isn't that pretty easily solvable with some type of macro system?
"macro take get"
Or something similar.