|
Iandus Newbie
Joined: 27 Jul 2007 Posts: 1
|
Posted: Fri Jul 27, 2007 5:38 pm
Trigger states |
want to make a trigger lets call it...
{Bob tells you, "Jump on!"} {say F*** you!}
now inside this trigger I want to add states... like
{Bob tells you, "Quit it!"} {quit dancing}
{You quit dancing on the floor} {say I am sorry for dancing on the floor}
{You are not dancing on the floor} {say HA! I wasn't even dancing}
Now, is this possible? Can I put triggers hidden into another trigger, by using states? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Fri Jul 27, 2007 5:46 pm |
It might be better if the first trigger does #T+ classname to a class that has all those other triggers inside it.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Jul 27, 2007 6:22 pm |
Really, unless you know for sure that Bob is going to say those things within a certain amount of time or lines, then you'll want to do a separate trigger for each. But to answer your question, you -can- put triggers inside other triggers using the #COND command. Most of the time, however, multistate triggers are used to trigger off an action within that specified amount of time. *shrug* Look up #COND by typing "#help cond" in the command line. If you give us a better example of what you're trying to do, we may be able to help you even more.
Charneus |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jul 27, 2007 6:39 pm |
To give a more detailed explanation, what you're trying to do here is branching. You have a number of options that might happen, but they don't necessarily all happen, and they don't have to happen in a fixed order.
Multistate triggers are designed to act in a fixed order. You could have a multistate trigger with three states:
You finish making the first part of the item -> make the second part
You finish making the second part -> make the third part
You finish making the third part -> make the last part
This is the kind of thing that multistate triggers are meant for. Only one state of a multistate trigger is active at a time, and they always execute in the same order. This trigger will go 1-2-3-1-2-3 and never break that order.
You'll notice that the first two triggers that you want to do will work as a multistate trigger because there's no branching involved - only one state has to be active at a time. The problem comes when you want the trigger to wait for more than one pattern.
Since multistate triggers aren't really suited for branching, you have a number of options. Shalimar suggests creating a class (that will presumably be disabled) and then enabling it once the multistate trigger reaches its last state. The triggers inside the class will be enabled, and then they'll respond and disable themselves afterwards. While this was happening, the multistate trigger looped back around to wait for another input.
One other thing you could do (though it gets inconvenient if you want to change it later) is use a multistate trigger with more than one pattern, and then use an #if to check which pattern came up. Something like this:
#trig {Bob tells you, "Jump on!"} {say F*** you!}
#cond {Bob tells you, "Quit it!"} {quit dancing}
#cond {{You quit dancing on the floor|You are not dancing on the floor}} {#if %begins(%line,"You quit") {#say I am sorry} {#say I wasn't dancing!}} |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jul 27, 2007 10:44 pm |
Actually, branching is possible with multi-state triggers. I think this was primarily why Zugg created #SET or #STATE, and combined with stringlist patterns you can basically encapsulate all aspects of a given procedure into one multi-state trigger.
Code: |
State 0: Do First Step<--
| |
| |
----State 1: Success or Fail?----
|
|
----State 2: Do Second Step<-----
| |
| |
State 3: Success or Fail?----------------
|
|
State 4: End Result
|
Alternatively, if regardless of whether you succeed or fail you know there's always X number of lines you can just cascade the patterns down through all trigger states. This effectively accounts for all possible outcomes without messing around with the position of the active state. Usually game systems aren't built with this fixed-action approach, however, so it's rarely useful except in low-failure situations. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|