|
surge321123 Beginner
Joined: 09 Jun 2011 Posts: 14
|
Posted: Thu Jun 09, 2011 7:33 pm
Multistate triggers with unknown number of lines |
I am trying to make a multistate trigger for a room description that captures all the items in the room. I can easily capture them all in a child window, but I have a list of items that are ok to be in the room, but if there is anything else in the room, I want to leave the room.
The issue I am having is that I don't know how many items will be in the room. There are bushes which always appear there, plus sometimes there is a monster in the room, which is ok. If I see a player there or an object in the room then I want to leave. If there are just bushes in the room, the trigger fires perfectly. However, if there is also a monster, it doesn't pick up on it. If there are multiple items, the trigger doesn't even fire.
Is there a method to catch multiple items in the room, and react if there is anything out of the ordinary?
here is an example of the room desc
room short
room description
room desc
room desc
room desc
Fluffy white clouds drift lazily overhead.
Obvious exits are south and north.
bushes
cricket
> (this is the command prompt) |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Thu Jun 09, 2011 8:21 pm |
sounds like you need to capture everything between the exit and the prompt.
I would suggest a named trigger ( #TR "catchAll" {(*)} {check on %1} ) that the exit line turns on (#T+ catchAll) and you prompt turns off (#T- catchAll)
It is up to your scripting to know what is okay to be there and what isn't. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
surge321123 Beginner
Joined: 09 Jun 2011 Posts: 14
|
Posted: Fri Jun 10, 2011 12:49 am |
I tried what you said, but I need to find a way to make the trigger wait a couple lines before turning on. At first, all it did was capture the exits line (the one that triggered turning on the catchall trigger) So then I decided to make it a multiline trigger so it would see the exits line, then when it saw the blank line after it, it would turn on the catchall trigger. Here is what I am getting. (I deleted about 100000 "not bushes" which is the echo I made for when they are not bushes but I didn't want to fill this screen with them all)
Obvious exits are south and north.
not bushes
not bushes
not bushes
not bushes
not bushes
not bushes
not bushes
bushes
these are bushes
cricket
these are bushes
>
I don't understand why it is firing so many times! It says "these are bushes" when it sees bushes or crickets... just to clarify that
any ideas? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Fri Jun 10, 2011 5:28 am |
the problem is that your echo message is causing the trigger to fire... try using #PRINT, i think that is the non triggering method
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
surge321123 Beginner
Joined: 09 Jun 2011 Posts: 14
|
Posted: Fri Jun 10, 2011 7:15 pm |
Excellent! That worked. Thank you.
|
|
|
|
|
|