Testing templates

Posted by Nick Gammon on Wed 19 Aug 2009 01:24 AM — 68 posts, 306,758 views.

Australia Forum Administrator #0
Cool new feature (see http://mushclient.com/templates)

Template:faq
Please read the MUSHclient FAQ.


Template:faq=16
Please read the MUSHclient FAQ - point 16.




Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Template:function=ColourNote
ColourNote

The documentation for the ColourNote script function is available online. It is also in the MUSHclient help file.



Template:bug
Please help us by advising:
  • The version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The output from the MUD that caused the problem
  • The error message, if any, that you got (or other relevant output)


Template:version
Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.


Template:codetag
To make your code more readable please use [code] tags as described here.


Template:scripting
Scripting tutorial

There is extensive information about scripting in MUSHclient at http://mushclient.com/scripting. This includes screen shots and examples.



Template:saveplugin=ConsiderMobs
To save and install the ConsiderMobs plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as ConsiderMobs.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file ConsiderMobs.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.

Amended on Wed 19 Aug 2009 04:02 AM by Nick Gammon
USA #1
Looks great!

Just a few thoughts on the [saveplugin] template though.

1. Plugins don't NEED to be in the plugin directory, they can be loaded from anywhere you select them from the plugins dialog.
2. The default plugin directory can change, which is what GetInfo(60) is for.
3. Writing userdata to the program files directory has been Bad Form for a very long time, and I'll continue to nag about it so that it changes and "the developer stops having bull#$%& problems with Vista" (and Windows 7). :D

I'd remove step 3, and insert a step between the present steps 5. and 6. to "Navigate to where you saved the [whatever].xml file."
Australia Forum Administrator #2
What do you suggest the suggested directory be, then?
Australia Forum Administrator #3
These templates are in the database, BTW, so it is easy to change them or add more.
Australia Forum Administrator #4
Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.
SmaugFUSS (Fixed Up Smaug Source)

The SmaugFUSS reference site is http://www.smaugmuds.org/.

Amended on Wed 19 Aug 2009 04:04 AM by Nick Gammon
USA #5
If you wanted to parallel how web browsers, and Office applications handle plugins, The Application Data directory is the place for plugins and the globalpreferences.sqlitedb. Although I rather like that MC looks for the db in the startup directory.

Worlds, Scripts, and Logs should be under My Documents.

I posted the CSIDLs in another thread the last time I nagged about this :)

I'd suggest having the installer create a MyDocuments\MushClient directory, with the worlds and logs directory made under that. The shortcut could point to that dir as the startup.


Another thought would be to add an "Install from Clipboard" button to the "Plugins..." dialog that is analogous to the Paste button in the alias, timers, and Triggers dialogs. You've already done the logic to check the clipboard contents for valid xml. Adding a check for <plugin> tags should be minimal.






Nit picky point... Lua's official terminology is that the string library has "Patterns", as it's not a full RegExp implementation (lacking "or" i.e. "|", look aheads/behinds and atoms)
Australia Forum Administrator #6
Amended both of them slightly.
#7
They look great!
Australia Forum Administrator #8
Thanks! I am pretty happy with them. And another one:

Template:search
Please try searching this forum.


Template:search=stat roller
Please try searching this forum for the phrase "stat roller".
Amended on Wed 19 Aug 2009 05:16 AM by Nick Gammon
USA #9
Can the [search=FOO] ones forward to http://www.lmgtfy.com/?q=site%3agammon.com.au+FOO ? ;)
Australia Forum Administrator #10
Well I would rather keep it onsite, but I have changed the search to do a forum search of the requested word(s).
USA #11
Let Me Google That For You is a rather snarky response anyway.

The [search] tags are going to cause problems eventually, since threads that are answered with the template start showing up in the search results, since all those keywords are in the template. The signal to noise ratio will drop heavily.

The other thing is a matter of perception and community... The problem with searches is that you have to know what you're searching for. A newer user may not have the terminology down to search effectively. There's also the human aspect too, someone asking for help on something and getting someone-else's answer, how ever pertinent, feels like a blow off. Won't replies with just [search] in them come across as "don't waste my time"?

Which, hey, Mushclient has been made freely available and open source, so any expectations about your time is rude; but appreciation doesn't work when it's demanded...

I dunno... perhaps I'm reading too much 'metadata' and subtext into things... Must be because of working with the help file's index for the past week... ;)
Australia Forum Administrator #12
You have a point about how posts which merely request information on (say) a stat roller will show up in a search for stat rollers. Not quite sure how you can distinguish, in a search, between wanting to know something, and providing the answer. Maybe, do what Google does, and rank the results based on the number of views (I know Google doesn't do that exactly). That might work.

I know what you mean about not "blowing people off" with a stock response, but sometimes it is hard to keep calm when someone posts a question in a section where they are clearly asked for the MUSHclient version number, a copy of what they did, and a copy of the error message, and they come up with this:

Quote:

I tried to get xxx to work today and got an error message. Why is that?


No version, no detailed description about what they did, no copy of the error message. I try to be civil, but I'm afraid that really terse postings like that are likely to get a [version] response from now on.
USA #13
Terse requests call for terse responses, eh?

On the topic of search and the [ search] template, I was thinking the search could ignore matched terms within double-brackets, but that would only be easy if the search system used regex...
Australia Forum Administrator #14
Yes that might work, but probably sorting into most-viewed order would tend to put the pages with the answer ahead of the pages with the question.
USA #15
side note: I really like the logo.png any thoughts about updating the exe's icon?

USA #16
I think this is a pretty nifty feature :-)


Now that the forum tags are detected for you (whether or not you check the button), maybe the button should indicate "do *not* use forum codes"? I guess that would be complicated for editing old posts vs. making new posts, where you said the detection logic is different.
Canada #17
First time I read this post they were just plain text. Now with the boxes/colours etc it looks much more professional (and pretty!).

Constructive criticism time :) I noticed in another post someone already used one of these templates. That's great, I think they're very useful, however, the larger ones with a lot of text tend to make the post a little clunky looking. If they were maybe wider instead of fixed width it might look better and not cause the entire reply to look so long? Just my thought on the matter.
Australia Forum Administrator #18
Quote:

First time I read this post they were just plain text.


The look improves when the stylesheet reloads. If anyone else is not getting nice boxes, refresh the page in your browser, which forces style.css file to be reloaded from the forum server.

Quote:

... the larger ones with a lot of text tend to make the post a little clunky looking.



I know the one you mean. I fixed up the [codetag] tag because I think that will be used a lot, and it is quite wordy. I made a forum page to explain in detail what it was getting at, and changed the tag to point to it.

Also I made the boxes slightly wider. Without any width at all they tend to look a bit big.
Canada #19
It looks great. You really do a wonderful job with this forum and the support to the community who use it. :)
USA #20
Would you consider changing the width: 450px; to margin-right: 4em; ?

When looking at the page in a maximized browser window, there's so much dead space to the right of the tag, making you scroll more to get to the actual content.

For example look at the [regexp] template. There's a lot of text that can wrap with the browser.

Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

Amended on Wed 19 Aug 2009 10:28 PM by WillFa
Australia Forum Administrator #21
Hmmm, OK, try that (refresh the page).
USA #22
Thank you! Much Better. :)

Australia Forum Administrator #23
Quote:

I really like the logo.png any thoughts about updating the exe's icon?


It's roughly the same icon. Do you mean the .exe icon is a bit rough? It's old, maybe it is feeling its age.
USA #24
http://cid-73890baf188d56e7.skydrive.live.com/self.aspx/MCForum/mcicon.png

Yea, the matting doesn't scale up well now.

Australia Forum Administrator #25
Ewwwww!
Australia Forum Administrator #26
Actually that doesn't look like the icon I have defined in the code for the 48x48 pixel icon. I think my development environment might be too old.

I know, we can say it is a "retro" look, because MUDs are so old. ;)
#27
Can I suggest a new tag for a direct link to a forum post.
This came up because my latest plugin uses another plugin that a user may not have and I wanted to put a link to that plugin's forum post.
Australia Forum Administrator #28
Template:post=9650
Please see the forum thread: http://gammon.com.au/forum/?id=9650.
USA #29
One thing I like in some forum software is that you can quote a message with attribution. The forum code looks like this:

[quote=David]Hello there[/quote]

The rendered text is something like:

Quote:
David said:
Hello there


I think it would be kind of nice to have something similar here, and the templates would make the quoted text stand out very nicely from the poster's text -- sometimes it gets hard to tell who wrote what (even with the indent). Also, having a name in there makes it easier to quote several people in the same post, as you can attribute each paragraph correctly.

If this isn't hard, I think it'd be nifty. :-)
Amended on Fri 21 Aug 2009 01:58 AM by David Haley
USA #30
Adding a 'Quote' button on each post would also be nice; I frequently find myself wanting to quote someone, but having to go back and copy it manually.
Australia Forum Administrator #31
David said:

One thing I like in some forum software is that you can quote a message with attribution.


Like this? ...

David Haley said:

If this isn't hard, I think it'd be nifty. :-)




[quote=David Haley]
If this isn't hard, I think it'd be nifty. :-)
[/quote]
Amended on Fri 21 Aug 2009 03:06 AM by Nick Gammon
Australia Forum Administrator #32
I've fiddled with the style.css file to get a better looking quote box.

You need to refresh the page to see a nice border now.
#33
Off topic but while we're asking for things a drop down box with all the forum links, would be good on http://www.gammon.com.au/forum/

Save clicking MUSH then Lua etc.
Australia Forum Administrator #34
See bottom of the page (Go to topic:).

That has a drop-down list of all available topics.

Twisol said:

Adding a 'Quote' button on each post would also be nice;


So far I have steered away from scripting on the web pages. I usually find I only want to quote part of a message anyway.
USA #35
Nick Gammon said:
Like this? ...

Yup! :-) Thanks much!
Amended on Fri 21 Aug 2009 03:15 AM by David Haley
#36
Man thats twice today. Sorry.
USA #37
Nick Gammon said:

Twisol said:
Adding a 'Quote' button on each post would also be nice


So far I have steered away from scripting on the web pages. I usually find I only want to quote part of a message anyway.


Scripting? I was thinking more like just a button that would open the same reply entry box, but with the selected post quoted already inside. Wouldn't that just involve sending a post ID to the server along with the button press, and having the server send back the same page, but with the text field having a default of the quoted post?


EDIT: Also, if you can't tell, nested quote tags break horribly. >_>
USA #38
Balanced tags are easy in LPEG! Quick, Nick, rewrite the forum software in Lua!


;)
Canada #39
Hanaisse said:
It looks great. You really do a wonderful job with this forum and the support to the community who use it. :)


It had to be said again. And yes, this is a cool new feature I just had to play with it.
Australia Forum Administrator #40
Quote:

... nested quote tags break horribly...


It isn't that easy to get them right. They never worked before, anyway. One problem I have is that people may open the quote and not close it. Now if you do nested quotes with something fancy like tables, then the whole rest of the page can be thrown out.

At present quoting looks like this:


<p class="quote">
<b>Quote:</b><br>

... your quote here ...

</p>


And the style for the quote is:


 p.quote {
    margin-left:5em;
    margin-right:5em;
    background-color:#FFEBCD;
    border-width:1px;
    border-style:solid;
    border-spacing:10px 10px;
    padding:1em;
    font-size:90%;
    }


That basically indents and colours the text, putting a box around it. The individual linebreaks are done with <br> (not </p>) so they don't close the "quote" paragraph.

If someone can show me some html/css that successfully indents quotes, and is also resistant to the missing [/quote] tag, I will be pleased to use it.
USA #41
Nick Gammon said:
If someone can show me some html/css that successfully indents quotes

Use <div> instead of <p>. I tested using only the `.quote` CSS class and a simple nested set of tags. The <p> tags failed to indent, but the <div> tags worked perfectly. (I changed the class from `p.quote` to `.quote`, obviously)

Nick Gammon said:
and is also resistant to the missing [/quote] tag

One of many solutions I can think of is counting the number of start tags versus end tags; if there's a mismatch, do something (strip the extra ends if there's too many, or add extra ends to the end of a post if there's too few). This would have to be implemented server-side, but I very much doubt that arbitrary HTML/CSS can fix itself if there's a lack of an end-tag. (Some exceptions apply in quirks mode - I know that <p> was often used without an end tag - but it's not arbitrary)


EDIT: Also, it just so happens that a Quote button would help us quoters, because otherwise we have to copy their post as we see it. And if it contains \[quote\] or some variation thereof, then even though their post is fine, we'd be copying the un-fixed version. I ran into that problem with the second quote in this post.

EDIT 2: Multiple indents at the 5em level is a lot of indenting. 2em looks pretty good to me. This is more of a taste suggestion than a feature suggestion, though.
Amended on Fri 21 Aug 2009 05:01 AM by Twisol
USA #42
I think the problem is the parser handling recursion of the [] tags... I might be wrong though.

As for the CSS stuff


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<Title>Test</Title>
<body>
<style>
	.quote > .quote { margin: 1em; border: 1px solid black;}
	.quote { margin: 3em; border: 1px solid black;}
</style>
<Div class="quote">Test.
	<div class="quote">Test2
		<div class="quote">Test3
		</div>
	</div>
</div>
</body>
</html>



Should give you an effect you want.

The > is the child selector. It reads "Any element with class quote that is a child of any element with class quote"

It is listed first so that the more general .quote rule doesn't have precedence over it.


And Twisol's right, The P tag doesn't handle nesting. The problem shouldn't be the user forgetting the [/quote] tag since the php page is handling the parsing of that, not the browser's html/css engine.
Amended on Fri 21 Aug 2009 05:02 AM by WillFa
USA #43
Will, all I had to do was change the tags to div's and remove the specific 'p' element selector from the class. I don't know what kind of CSS voodoo you have there, some kind of recursive beast? :D
USA #44
Yea, I have the .quote > .quote so I can change the margins on the inner nested elements... having 5em margins inside a frame with 5em margins leaves too much dead space. :)

RE: your Edit 2 above: That's the voodoo recursive beast. ;)
Amended on Fri 21 Aug 2009 05:09 AM by WillFa
USA #45
Ah yeah, good point. You're a better designer than I ;)
USA #46
I've just been working with stylesheets lately from trying to convert the help over to chm format... I'm not good, just newly experienced. ;)
Australia Forum Administrator #47
Twisol said:

Scripting? I was thinking more like just a button that would open the same reply entry box, but with the selected post quoted already inside.


Hmmm - yes you are right that is possible. Handling the forum codes is a bit fiddly. You have the problem of nested forum tags if you aren't careful.

Anyway, I am experimenting a bit to see if a workable version can be done.
Australia Forum Administrator #48
Twisol said:

Adding a 'Quote' button on each post would also be nice; I frequently find myself wanting to quote someone, but having to go back and copy it manually.


OK - I think I got the quote button working. It was quite fiddly, I didn't want to keep all the forum tags in the quoted message, for one thing that looked messy, and for another you had the problem with nested tags.

So, a quoted message basically has the forum tags stripped from it - it may not work perfectly, if you find something obviously wrong I'll try to correct it.
Australia Forum Administrator #49
Testing:

bold

italic

underline

  1. ordered list item 1
  2. ordered list item 2


  • unordered list item 1
  • unordered list item 2


Quote:

a quoted item



some code



monospaced stuff


horizontal rule:



escaped brackets: [ ] \

Template:bug
Please help us by advising:
  • The version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The output from the MUD that caused the problem
  • The error message, if any, that you got (or other relevant output)

Template:codetag
To make your code more readable please use [code] tags as described here.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

Template:faq
Please read the MUSHclient FAQ.

Template:faq=11
Please read the MUSHclient FAQ - point 11.

Template:function=AddTrigger
AddTrigger

The documentation for the AddTrigger script function is available online. It is also in the MUSHclient help file.


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

Template:post=9687
Please see the forum thread: http://gammon.com.au/forum/?id=9687.

Nick Gammon said:

Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

Template:saveplugin=ConsiderMobs
To save and install the ConsiderMobs plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as ConsiderMobs.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file ConsiderMobs.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.

Template:scripting
Scripting tutorial

There is extensive information about scripting in MUSHclient at http://mushclient.com/scripting. This includes screen shots and examples.


Template:search
Please try searching this forum.

Template:search=stat roller
Please try searching this forum for the phrase "stat roller".

SmaugFUSS (Fixed Up Smaug Source)

The SmaugFUSS reference site is http://www.smaugmuds.org/.


Template:starting
Tips on getting started with MUSHclient are in the Getting Started part of the Forum. Most have screen shots to show in detail how to do things.

There are also some some YouTube videos demonstrating various aspects of MUSHclient in operation.


Template:version
Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.

Template:what
Please help us by showing:
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The error message, if any, that you got

Australia Forum Administrator #50
Quoting the above message:

Nick Gammon said:

Testing:

bold

italic

underline


*ordered list item 1
*ordered list item 2



*unordered list item 1
*unordered list item 2


(quote)
a quoted item


------
some code
------


monospaced stuff


horizontal rule:
-----

escaped brackets: [ ] \

(bug)
(codetag)
(copying)
(faq)
(faq=11)
(function=AddTrigger)
(pasting)
(post=9687)
(quote=Nick Gammon)
(regexp)
(saveplugin=ConsiderMobs)
(scripting)
(search)
(search=stat roller)
(smaugfuss)
(starting)
(version)
(what)

USA #51
Nick Gammon said:

(quote=Twisol)
Adding a 'Quote' button on each post would also be nice; I frequently find myself wanting to quote someone, but having to go back and copy it manually.


OK - I think I got the quote button working. It was quite fiddly, I didn't want to keep all the forum tags in the quoted message, for one thing that looked messy, and for another you had the problem with nested tags.

So, a quoted message basically has the forum tags stripped from it - it may not work perfectly, if you find something obviously wrong I'll try to correct it.
[quote=E.A.Poe]
(quote=TheRaven)
Nevermore.


But how will we quote code? :)



I broke it! :)
Amended on Fri 21 Aug 2009 07:01 AM by WillFa
USA #52
Maybe the forum software can process [code] and [quote] expansions before it converts to (plain tags)?
Amended on Fri 21 Aug 2009 07:13 AM by Twisol
Australia Forum Administrator #53
I remember now why it is hard to get quotes (or anything) going as a nested thing, using regular expressions. Basically regexp matches can be greedy or non-greedy, but neither one matches correctly on a message with both nested and non-nested quotes in it.


           [quote=Nick] aaa [quote=Willfa] bbb [/quote] [/quote]  [quote=Twisol] ccc [/quote]
greedy:    ^-------------------------------------------------------------------------^
nongreedy: ^-----------------------------------^
correct:   ^--------------------------------------------^


The greedy one goes too far, and the non-greedy one doesn't handle the nesting.

Now you could recursively descend into it (and then you have the problems of handling badly-formed messages) but this is something that has to happen on every post, on every page. (There are up to 15 posts a page).

I was worried about the overhead of doing that all the time.

The current system just blindly replaces form codes with html, eg. [b] becomes <b>.

Twisol said:

One of many solutions I can think of is counting the number of start tags versus end tags


Counting won't detect this:


[/quote] ..... [quote]

Australia Forum Administrator #54
WillFa said:


But how will we quote code? :)





..... must ..... not ..... quote ..... code ......
USA #55
WillFa said:

Balanced tags are easy in LPEG! Quick, Nick, rewrite the forum software in Lua!


;)



;)

What a can of worms we've opened...
Amended on Fri 21 Aug 2009 07:19 AM by WillFa
Australia Forum Administrator #56
Nick said:



<aliases>
  <alias
   match="target *"
   enabled="y"
   variable="target"
   send_to="9"
   sequence="100"
  >
  <send>%1</send>
  </alias>
</aliases>



There! I quoted code.
Australia Forum Administrator #57
Er, maybe not.
Australia Forum Administrator #58
Ah, why did it do that? I didn't give it permission to render the page that way.

A <code> tag must have an implied end of paragraph.
USA #59
Yup, a code tag is a new block element.

You could make .code a css class that has white-space: pre; and font-family: monospace; then change the php so it doesn't write <pre><code> tags, but a <div class="code"> tag...

A div will not nest inside of a <P> tag, so it will behave like the rest of the forum even when not nested.


USA #60
Nick Gammon said:

Counting won't detect this:

------
[/quote] ..... [quote]
------



I slept on it. What if you counted (again), but each start was +1 and each end was -1? That means that if at any point you're under 0, or if at the end you're NOT zero, something's wrong.
USA #61
Is a recursive descent really that expensive? I imagine that it's probably not much worse than a regular expression match. It's just a linear string scan, really. I think that malformed posts might be the trickier thing to deal with.
Australia Forum Administrator #62
Template:post=9700
Please see the forum thread: http://gammon.com.au/forum/?id=9700.

That is good enough as far as I am concerned. ;)
Amended on Fri 21 Aug 2009 10:11 PM by Nick Gammon
Australia Forum Administrator #63
David Haley said:

I think that malformed posts might be the trickier thing to deal with.


Yes, tricky.
USA #64
Yay! The little things often add so much to the big picture - I really like the new updates. ^_^
USA #65
Echo. The new changes are great! :-) Thanks much.
Australia Forum Administrator #66
Twisol said:

I slept on it. What if you counted (again), but each start was +1 and each end was -1? That means that if at any point you're under 0, or if at the end you're NOT zero, something's wrong.


David Haley said:

Is a recursive descent really that expensive? I imagine that it's probably not much worse than a regular expression match. It's just a linear string scan, really. I think that malformed posts might be the trickier thing to deal with.


It all works fairly well with the simplified method, so I won't bother doing either of those, thanks for the suggestions however. :-)

Twisol said:

I really like the new updates.


Glad everyone likes them.

Now, back to business with MUD clients ...
USA #67
Just to throw in my gratz too, Nick, I also really like the recent template & quote & code changes, and so does my wife, Dragona. The template changes look great and seem like a really good idea in general. The most recent quote & code tag changes look really good and were probably overdue, especially the ability to attribute quotes directly. In short, good job! :)