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
➜ EnableTrigger problem
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Orogan
(23 posts) Bio
|
Date
| Fri 31 Oct 2008 07:23 PM (UTC) |
Message
| Hi,
What I'm trying to do is this:
type 'lore <item>'
send this command to the mud
Then grab all the info the mud sends me unitl my prompt shows up.
Only problem I got is it keeps grabbing line even when the prompt has past.
I tested the reg exp for the prompt it works.
prob. have some thing dumb going oon, but can't figure it out.
So here's what I got:
<!-- Triggers -->
<triggers>
<trigger
group="lore"
enabled="n"
match="*"
name="GetLine"
script="lore_to_world"
send_to="12"
sequence="10"
>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<alias
name="StartLore"
enabled="y"
script="lore_to_world"
match="Lore (?P<lore_item>.*)$"
group="lore"
regexp="y"
send_to="12"
ignore_case="y"
omit_from_output="y"
sequence="100"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
function lore_to_world (name,line,wildcards,style)
if name == "StartLore" then
LoreItem = (GetAliasWildcard ("StartLore", "lore_item"))
Note "1"
Send ("lore " .. LoreItem)
EnableTrigger ("GetLine", true)
return
end -- if
if line == "^[" then
EnableTrigger ("GetLine", false)
ColourNote ("green", "", "Done")
SaveState ()
return
end -- if
if name == "GetLine" then
Note ("line grab")
return
end --if
end -- lore_to_world
]]>
</script>
I replaced the actual action's by Notes just for testing. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 31 Oct 2008 08:33 PM (UTC) Amended on Fri 31 Oct 2008 08:34 PM (UTC) by Nick Gammon
|
Message
| The problem line is here:
You are doing a test for string equality on the line, but the prompt won't look that will it?
You mean to do either:
if string.sub (line, 1, 1) == "[" then -- test first character
or
if string.match (line, "^%[") then -- regular expression
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Orogan
(23 posts) Bio
|
Date
| Reply #2 on Tue 04 Nov 2008 10:02 PM (UTC) |
Message
| Thanks, makes it all clear now :) | 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.
11,134 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top