Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ CMUD -> MUSHclient: Multistate Triggers
|
CMUD -> MUSHclient: Multistate Triggers
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Anna Henderson
(2 posts) Bio
|
| Date
| Wed 02 Jun 2010 12:16 AM (UTC) |
| Message
| I've been playing Lusternia for the past three months, and have been using CMUD. I'm switching to MUSHclient because 1.) Lusternia's best curing system uses MUSHclient, and 2.) MUSHclient seems to be the better client overall, if less user-friendly at first.
I've begun to learn Lua and am making good progress, though I've never programmed before. I've also been reading up on MUSHclient itself, and have learned most of the basics and even some advanced concepts. Even so, this is all completely new to me.
However, I wish to make the transition from CMUD to MUSH as soon as possible, and only one major obstacle stands in my way: CMUD's multistate triggers. I depend heavily on them, and I don't know how to do the same thing in MUSHclient.
For example, in Lusterna, there's a type of attack that requires me to alternate between three different abilities for maximum effectiveness, like so:
You have recovered equilibrium.
>SEND INFLUENCE @TARGET WITH COMPLIMENTS
You have recovered equilibrium.
>SEND INFLUENCE @TARGET WITH PRAISE
You have recovered equilibrium.
>SEND INFLUENCE @TARGET WITH ADMIRATION
(start back at the beginning)
I use CMUD's class function to toggle the multistate trigger that does this on and off as I need it. Here is the actual XML from CMUD:
trigger priority="1450" id="145">
<pattern>recovered equilibrium</pattern>
<value>influence @inf with compliments</value>
<trigger>
<pattern>recovered equilibrium</pattern>
<value>influence @inf with admiration</value>
</trigger>
<trigger>
<pattern>recovered equilibrium</pattern>
<value>influence @inf with praise</value>
</trigger>
</trigger>
I plan to work hard learning Lua and mastering MUSHclient, and if I can get this one detail whipped into shape, I'll have a clean slate to start off on.
Thanks, and hope this post wasn't too long/I missed an obvious and easy solution/etc. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 02 Jun 2010 01:59 AM (UTC) |
| Message
| There are a few ways you could do that. One is to have a trigger that switches what to send, like this:
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="You have recovered equilibrium."
send_to="12"
sequence="100"
>
<send>
equilibrium_state = equilibrium_state or 1 -- start at 1 initially
what_to_send = {
"influence @inf with compliments",
"influence @inf with admiration",
"influence @inf with praise",
} -- end table
-- pull out current message
Send (what_to_send [equilibrium_state])
-- move onto next one
equilibrium_state = equilibrium_state + 1
-- wrap if necessary
if equilibrium_state > #what_to_send then
equilibrium_state = 1
end -- if past end
</send>
</trigger>
</triggers>
Another approach, which is less complex, but uses more triggers, is to have each one disable itself, and enable the next one in sequence.
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="You have recovered equilibrium."
name="eq_trigger_1"
send_to="12"
sequence="100"
>
<send>
Send "influence @inf with compliments"
EnableTrigger ("eq_trigger_1", false) -- disable ourself
EnableTrigger ("eq_trigger_2", true) -- enable next one
</send>
</trigger>
<trigger
expand_variables="y"
match="You have recovered equilibrium."
name="eq_trigger_2"
send_to="12"
sequence="100"
>
<send>
Send "influence @inf with admiration"
EnableTrigger ("eq_trigger_2", false) -- disable ourself
EnableTrigger ("eq_trigger_3", true) -- enable next one
</send>
</trigger>
<trigger
expand_variables="y"
match="You have recovered equilibrium."
name="eq_trigger_3"
send_to="12"
sequence="100"
>
<send>
Send "influence @inf with praise"
EnableTrigger ("eq_trigger_3", false) -- disable ourself
EnableTrigger ("eq_trigger_1", true) -- enable next one
</send>
</trigger>
</triggers>
This method would get messy with lots of messages, but is a bit simpler to understand. (Notice only one of the three triggers is initially enabled). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Anna Henderson
(2 posts) Bio
|
| Date
| Reply #2 on Wed 02 Jun 2010 02:56 AM (UTC) Amended on Wed 02 Jun 2010 02:49 PM (UTC) by Anna Henderson
|
| Message
| Wonderful! Those two techniques fit the bill nicely, and the second in particular is one any beginner should be able to understand. I have several other uses for "sequential loop triggers" (which seems like a good generic term for these), so I'll definitely learn to script them from scratch, rather than simply copy-pasting your work.
Thanks muchly, from the x="n";y="th";print(x..y) person to say: "Wow, Nick, you responded promptly and your solution worked perfectly!" | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
13,288 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top