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
➜ Activating triggers when there is no newline?
Activating triggers when there is no newline?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Accolades
(6 posts) 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 - | Top |
|
Posted by
| Accolades
(6 posts) 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 - | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 24 Oct 2002 03:14 AM (UTC) |
Message
| |
Posted by
| Flannel
USA (1,230 posts) 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. | 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.
23,408 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top