I always though the '>' operator indicated sequence, basically sticking together two separate Said strings, so that you could do
(if (Said 'look>')
(if (Said '/tree')
(Print "The tree is great.")
)
; ... more things to look at, and I don't need to repeat 'look' everywhere
)
But the second Said above is actually run in parallel with the first. So you can actually do the opposite too:
(if (Said '/tree>')
(if (Said 'look')
(Print "tree is great")
)
; .... more actions on the tree
)
Basically, each / splits a part of the phrase. So the code above says if "tree" is the second part and "look" is the first part. The order of the Said statements doesn't matter.
You can have up to 3 parts to a phrase of course, so you could do the following:
(if (Said '//tree>')
(if (Said 'look>')
(if (Said '/bird')
(Print "It's giving you the bird.")
)
)
)
That will respond to things like "look at the bird in tree", since we have:
- 3rd part is tree
- 1st part is look
- 2nd part is bird
Likewise, you can leave these blank if you want anything to match. This example was from poking around in the LSL3 decompile (which is how I discovered this). They have something like this:
(if (or (Said '/tv') (Said '//tv'))
(if (Said ('watch'))
; this matches "watch tv", but also "watch something on tv"
)
)
I had some things in my game that I wanted you to be able to burn, and I want the user to be able to type "burn blah", or "put blah in fire". So now I can do:
(if (or (Said 'burn>') (Said 'put//fire>'))
(if (Said '/blah')
; put the blah in the fire
)
(if (Said '/child')
; put the child in the fire, etc...
)
)