[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  EnableTrigger problem

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: EnableTrigger problem
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Orogan   (23 posts)  [Biography] bio
Date Tue 04 Nov 2008 10:02 PM (UTC)  quote  ]
Message
Thanks, makes it all clear now :)
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Fri 31 Oct 2008 08:33 PM (UTC)  quote  ]

Amended on Fri 31 Oct 2008 08:34 PM (UTC) by Nick Gammon

Message
The problem line is here:


if line == "^[" then


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
[Go to top] top

Posted by Orogan   (23 posts)  [Biography] bio
Date Fri 31 Oct 2008 07:23 PM (UTC)  quote  ]
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.
[Go to top] 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.


1,087 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]