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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Activating triggers when there is no newline?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Activating triggers when there is no newline?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Accolades   (6 posts)  [Biography] bio
Date Sun 21 Jul 2002 09:33 PM (UTC)
Message
I'm sure this has been addressed, but I am at wit's end, and I refuse to believe a program with as many features as MUSHclient can't support such a thing.

I'm trying to setup a trigger to GAG the prompt in a DikuMUD and setup some variables based off it.

This doesn't work however since the prompt doesn't end in a newline character, the trigger will not activate until the next line of data has been added.

I really hope there is a way around this.

Thanks for the help
- Tim -
[Go to top] top

Posted by Accolades   (6 posts)  [Biography] bio
Date Reply #1 on Sun 21 Jul 2002 09:50 PM (UTC)
Message
I've found a workaround in the MUD itself, I didn't see it before because I never noticed the [Press Enter to Continue] under 'help prompt' but in SOME Muds, you can insert a carriage return yourself. This fixed the problem in this particular instance. I would still prefer it if MUSHclient could do it, and I would still appreciate feedback on my previous question.

Thanks
- Tim -
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #2 on Mon 22 Jul 2002 03:43 AM (UTC)
Message
We have been discussing some of this in another thread:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1529&page=999999

though, not the specifics of your case.

Basically the problem here is that only a few kinds of lines can match on such a thing. A standard trigger using '* somthing *' would, but still needs to know that the text in question is finished arriving and the client only knows that no newline has been recieved. It can just as easilly be the result of a really long delay on the network preventing the rest of the line from arriving. The same is true of a regular expression like '^something$', since it assumes that it will only match if the line ends immediately after the text you are matching, something the client can't determine till a newline is recieved. The only ones that would work are regular expressions that, match on any instance of a pattern, or specify the start of a line, but does not include any suggestion of what comes after. So:

^match-text
match-text
[abcd]
Hi, (.*) speaking!

or other similar types could be used as you intend, but only if the trigger code was completely rewritten to make it aware of if and when these sort of exceptions are being used. Non-regular expression would not be able to match such a situation at all. Put simply, it is a lot easier to get the mud to add a newline, than to try to get the client to correctly handle the lack of one. Telnet simply doesn't provide the kind of information that the client needs to tell if the entire line has been recieved or only part of a longer one.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 01 Aug 2002 12:46 AM (UTC)
Message
Quote:

I'm trying to setup a trigger to GAG the prompt in a DikuMUD and setup some variables based off it.


The problem here is that a prompt is usually not followed by a newline (\r\n characters) and thus is really a partial line.

MUSHclient gags whole lines, not part of them. You can work around it to a certain extent by passing the prompt line to a trigger routine, which strips off the prompt and echoes the rest, but then you lose the colour (if any) on the rest of the line.

Actually I had some MUDs where I successfully gagged the prompts, but you had to wait for the next line (ie. the one after the prompt) before the prompt would disappear, so you would always see the last prompt.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 24 Oct 2002 03:14 AM (UTC)
Message
See this post Match on prompt lines with no newline which describes a way of pulling data out of the prompt line before a newline is received.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Fri 08 Nov 2002 01:03 AM (UTC)
Message
In DikuMud, which, Im not horribly familiar with, I assume you can set your prompt. Some muds, allow you to insert a carriage return into your prompt.

You can just insert your own return after the prompt (via prompt setting), and then gag the new line.

You always have one line at the bottom (the new line, with no carriage return), but once the mud sends something else, the new line has a return at the end, and can be gagged (either ^$ or ^ $, depending on the mud), so, the extra lines are not reflected anywhere except the very bottom.

This is, I think, the easiest way, if possible on your mud, requires two triggers, and then a few lines of code (if you want) to disable the 'empty line gag' when its not followed by a prompt line. (The prompt trigger, enables the empty line trigger, then the empty line trigger, disables itself).

Hope that helps,

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


5,576 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]