Allowing multiple Send/Script calls on same line, Repeat on same line

Posted by Kevnuke on Fri 05 Mar 2010 02:35 AM — 42 posts, 150,560 views.

USA #0
I recently read every single entry in the release notes section for MUSHclient. And yes, it took a while, but it was worth it. For one thing it gave me a good idea of what the client is capable of and gave me a few ideas for suggestions. I'm glad to see telnet subnegotiation was simplified since I was here last. (More on that in a different post.) Ultimately I discovered the reason that something I was trying to do wasn't working. MUSHclient allows a trigger to match the same pattern more than once on the same line of text from a MUD. What it will -not- do is send the contents of the Send box or parse a script in the Script box more than once on the same line. This is very annoying when I am trying to make one trigger to capture the contents of my rift on achaea and I have to make a seperate trigger for each herb/item to do so.

For example:

[  90] prickly ash bark    [ 100] sileris   [2050] skullcap--the line coming from the MUD might look like this
"[\s*(\d+)]\s(prickly ash bark|sileris|skullcap)"--I was planning to use a trigger like this with all the herbs in the list
print ("%2", %1)--This is just an example, I actually was trying to do something like inr["%2"]=%1

I was wondering if a flag could be added to the triggers that allows one to send for -each- match on a trigger that repeats on same line.
Amended on Fri 05 Mar 2010 02:36 AM by Kevnuke
USA #1
How bizarre. For the record, I've confirmed this with the following:

<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="testers"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("Got")</send>
  </trigger>
</triggers>


Simulate("testers testers\r\n")


Output: two yellow-colored words "testers", but only one note "Got".


I'm personally in favor of not even bothering with a separate option and just applying a fix to all "Repeat on same line" reflexes.
Amended on Fri 05 Mar 2010 02:42 AM by Twisol
Australia Forum Administrator #2
It is supposed to do that. From the help:


Repeat on same line

If checked, the trigger is matched repeatedly against the same line (this only applies to regular expressions). This lets you colour individual words which might appear more than once on a line.


It colours multiple words, but the send text (or script or whatever) is only done once. In any case it would be hard to identify which wildcard you wanted in each iteration of the script.

This is mentioned here:

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


In your case, since it looks like the text is simple, a simple regex in Lua would process the matching line, and break it up for you.
USA #3
You mean the rex library in Lua? O.o
USA #4
I think he means something more like string.match, the normal string library. Though 'rex' is an interface to the exact same library MUSHclient uses for matching.

Assuming the line always has one to three sets of herbs (and also assuming this is for the herb-storing Rift in, say, Achaea or another IRE game), you could probably use this pattern instead:

^[\s*(\d+)] ([a-z '-]+?)\s*(?:[\s*(\d+)] ([a-z '-]+?)\s*(?:[\s*(\d+)] ([a-z '-]+?))?)?$


It's not pretty - ugly as a matter of fact - but it does work. Example trigger:

<triggers>
  <trigger
   enabled="y"
   match="^[\s*(\d+)] ([a-z '-]+?)\s*(?:[\s*(\d+)] ([a-z '-]+?)\s*(?:[\s*(\d+)] ([a-z '-]+?))?)?$"
   name="herbtrigger"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="100"
  >
  <send>if GetTriggerOption("herbtrigger", "script") == "" then
  local func_name = "_" .. GetUniqueID()
  _G[func_name] = function(name, line, matches, styles)
    tprint(matches)
  end
  SetTriggerOption("herbtrigger", "script", func_name)
end</send>
  </trigger>
</triggers>


This trigger takes advantage of the fact that the Send box is run before the Script function in order to make it an atomic unit, by setting the trigger's script field when it's first triggered. It's not something you'd really do often, and it's unrelated to the matter at hand, but in case you were wondering...

Example output:
-- Simulate("[  90] prickly ash bark    [ 100] sileris   [2050] skullcap\r\n")

0="[  90] prickly ash bark    [ 100] sileris   [2050] skullcap"
1="90"
2="prickly ash bark"
3="100"
4="sileris"
5="2050"
6="skullcap"

-- /Simulate("[  90] prickly ash bark\r\n")
0="[  90] prickly ash bark"
1="90"
2="prickly ash bark"
3=false
4=false
5=false
6=false




Nick: To you I must ask, why does "Repeat on same line" behave this way anyways? It seems inconsistent with what you would expect.
Amended on Fri 05 Mar 2010 03:39 AM by Twisol
USA #5
That's the problem, if i only have one or two herbs in my rift then that won't work. And you lost me at the "'-" part of that pattern O.o Not sure what that does.. but anyway, I'm not sure how hard it would be to just make it so it would Send or parse a script function each time a repeat on same line trigger matched. And if it worked the way i was trying to use it, th wildcards match would be simple, Nick. Just the first and second wildcard for -each- match. Like according to the trigger it would just print the name of the herb and how many of them there were for that herb. Oh and i wouldn't mind if you dissected that pattern for me ^^, looks like a couple backreferences in there, am i right?
Amended on Fri 05 Mar 2010 05:19 AM by Kevnuke
Australia Forum Administrator #6
Well, bearing in mind the client was developed over 10 years, and that triggers colouring stuff on lines was done early, and scripting was added later.

However I think also that the event "the trigger matches a line" has a corresponding "the send box is executed" (or the script). The multiple-colouring is really a sub-event, if you see what I mean.

Really, processing that extra stuff is something you can simply do with a string.gmatch, iterating over the line you matched on.

The other thing to consider is, changing something like that is a *major* change that is likely to break a lot of existing scripts.
Australia Forum Administrator #7
It's easy to process the line in Lua, don't get too worked up about trying to do it in a huge regexp in the trigger. As long as the trigger matches the general idea, do the fiddly stuff in Lua, eg.


test = [[
  [  23] yarrow             [ 588] colewort           [ 144] wormwood
  [ 192] kombu              [ 158] reishi             [ 103] arnica
  [1305] coltsfoot          [ 201] yellowtint         [ 251] pearl
  [ 304] moonstone          [1077] platinum           [1200] gold
  [ 425] greentint          [ 297] marble             [1497] wood
  [ 502] rope               [  90] redtint            [ 279] amethyst
  [ 188] jade               [ 359] bloodstone         [ 298] bluetint
  [ 240] ruby               [ 105] turquoise          [ 351] beryl
  [ 260] emerald            [ 405] onyx               [ 300] gems
  [ 281] opal               [ 244] purpletint         [ 399] cloth
  [ 225] coral              [ 880] steel              [ 288] garnet
  [ 303] sapphire           [  21] goldtint           [ 100] coal
  [ 678] salt               [ 600] sulfur             [ 169] pennyroyal
  [ 682] sparkleberry       [ 152] earwort            [1056] marjoram
  [ 107] rosehips           [  11] sage               [ 180] silver
  [ 129] myrtle             [ 170] horehound          [  39] galingale
  [ 909] calamus            [ 174] kafe               [  29] merbloom
  [ 385] iron               [  26] juniper            [ 416] mistletoe
  [ 219] spices             [ 436] diamond            [ 328] leather
  [ 165] chervil            [ 200] sargassum
]]

for num, herb in string.gmatch (test, "%[%s*(%d+)%] (%a+)") do
  print (num, herb)
end -- for

--> Output

23 yarrow
588 colewort
144 wormwood
192 kombu
158 reishi
103 arnica
1305 coltsfoot
201 yellowtint
251 pearl
304 moonstone
1077 platinum
1200 gold
425 greentint
297 marble
1497 wood
502 rope
90 redtint
279 amethyst
188 jade
359 bloodstone
298 bluetint
240 ruby
105 turquoise
351 beryl
260 emerald
405 onyx
300 gems
281 opal
244 purpletint
399 cloth
225 coral
880 steel
288 garnet
303 sapphire
21 goldtint
100 coal
678 salt
600 sulfur
169 pennyroyal
682 sparkleberry
152 earwort
1056 marjoram
107 rosehips
11 sage
180 silver
129 myrtle
170 horehound
39 galingale
909 calamus
174 kafe
29 merbloom
385 iron
26 juniper
416 mistletoe
219 spices
436 diamond
328 leather
165 chervil
200 sargassum

Amended on Fri 05 Mar 2010 05:30 AM by Nick Gammon
USA #8
Kevnuke said:

That's the problem, if i only have one or two herbs in my rift then that won't work. And you lost me at the "'-" part of that pattern O.o Not sure what that does.. but anyway, I'm not sure how hard it would be to just make it so it would Send or parse a script function each time a repeat on same line trigger matched. And if it worked the way i was trying to use it, th wildcards match would be simple, Nick. Just the first and second wildcard for -each- match. Like according to the trigger it would just print the name of the herb and how many of them there were for that herb. Oh and i wouldn't mind if you dissected that pattern for me ^^, looks like a couple backreferences in there, am i right?


Nope! I'll dissect it for you, but first notice that it did match when I only gave it one herb listing. It just filled matches 3 to 6 as 'false', which is perfectly useful as a "hey, this only had one (or two) herb" flag.

The basic 'component' here is this:

\[\s*(\d+)\] ([a-z '-]+?)


This will match, for example, "[ 100] eagle's feather". You have \[\s*(\d+)\] that does that, you should recognize it. Then there's ([a-z '-]+?), which is a character group being captured. It matches the herb's name, which can have (lowercase) letters, spaces, apostrophes, and dashes. I don't know if any riftables have dashes, but I threw it in there just in case. You know the + at the end, but when it's modified by a ?, it becomes non-greedy. This is so that it doesn't swallow up the trailing spaces that come before the next item in the list.

Lets call that section HERBREX. This doesn't mean anything and you can't use that name in practice, it's just for explanatory purposes here. Replacing the above section with HERBREX in the full regex, it looks like this:

^HERBREX\s*(?:HERBREX\s*(?:HERBREX)?)?$


Now maybe you can see, it matches either one, two, or three HERBREX's. :)
USA #9
Nick Gammon said:
Well, bearing in mind the client was developed over 10 years, and that triggers colouring stuff on lines was done early, and scripting was added later.

[...]

The other thing to consider is, changing something like that is a *major* change that is likely to break a lot of existing scripts.

Fair point!

Nick Gammon said:
However I think also that the event "the trigger matches a line" has a corresponding "the send box is executed" (or the script). The multiple-colouring is really a sub-event, if you see what I mean.

I always considered it to be something that acted on matches, not lines. The typical use case has a match per line, which is why this perspective was unchallenged for so long, but when you have multiple matches on the same line, it clearly breaks down. I would much prefer that the whole trigger act per-match rather than per-line, simply because if you have a simple pattern and you want it to match multiple times on a single line, that's what you would expect. But I understand that it's far too late by now.
Amended on Fri 05 Mar 2010 05:40 AM by Twisol
USA #10
As far as I've seen, none of the achaean riftable items have apostrophes or dashes, at least not the herbs, anyway. and the "?:" is a quantifier that means 0 or 1 of the item it points to? I looked for it in the PCRE file but maybe I just missed it. But as far as being a major change... that's why I suggested that it could just be a flag option. Not sure if that makes huge a difference in terms of coding it. I know some Lua, a little more than just basics, but I still have trouble wrapping the finer points of coding logic around my brain. I know you gave an example above for how it could be done, but i'm not sure I would know how to change it to work for something else. And on a final note, I was actually planning to use it in a plugin to set the number of herbs in my rift as part of a curing system, when I figured out how to get it working. Thanks for all the input and help so far.

EDIT: And i'm aware of the plugin callbacks like OnPluginLineReceived and such but i'm not sure if that would make things any easier, as far as the actual coding goes. Could that be used to replace a trigger entirely since it gets called before everything else?

And just to be clear i have a table called "inr" and an index for each herb, like for the item "prickly ash bark" the index is "ash", i want the trigger to capture the name of the herb and how many there are. I know the name conversion can be done with a simple table like:

herbs = {["prickly ash bark"] = "ash", ["bayberry bark"] = "bayberry", etc}

and in the trigger it would look like this:

if herbs["%2"] then
    inr[herbs["%2"]] = %1
end

if i used the trigger I used earlier with %1 being the number and %2 being the name of the herb in the output.
Amended on Sat 06 Mar 2010 12:35 AM by Nick Gammon
Australia Forum Administrator #11
I just don't think that having the trigger repeat on the same line, and pass the match each time to your script is going to make your life much easier.

Take this line for example:


  [  23] yarrow             [ 588] colewort           [ 144] wormwood


A fairly simple trigger will match that, eg.:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^(\s*\[\s*\d+\] \w+){1,3}\s*$"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>matched! %%0 = %0</send>
  </trigger>
</triggers>


Now that gives you a match on that type of line and no other types, and then you run the string.gmatch over %0 to pull out the 3 lots of data.

But to do "repeat on same line" you have to narrow the regexp down to the part that repeats, in other words something that matches on, say "[ 23] yarrow". And then you set it to repeat, OK, that is your plan right?

But now it can be spoofed. I could say to you:


Nick says, "Hey Kevnuke, guess what? [  99] yarrow [ 777] colewort [ 200] wormwood"


And your trigger will fire and start processing data incorrectly. That is why the "repeat on same line" was really for colouring words, eg. if you have a friend "Nick" you can make a trigger that colours "Nick" every time, even multiple times on the same line. But for scripting? I don't think it is as useful.
USA #12
Kevnuke said:
As far as I've seen, none of the achaean riftable items have apostrophes or dashes, at least not the herbs, anyway.

Eagle's feather. Lady's slipper.

Kevnuke said:
and the "?:" is a quantifier that means 0 or 1 of the item it points to? I looked for it in the PCRE file but maybe I just missed it.

Nope. Example: \d+? means "zero or one", but (?:\d+) means "don't save this capture group". You can think of ?: as a modifier for the opening ( of the capture.

Kevnuke said:
EDIT: And i'm aware of the plugin callbacks like OnPluginLineReceived and such but i'm not sure if that would make things any easier, as far as the actual coding goes. Could that be used to replace a trigger entirely since it gets called before everything else?

Yes, it could be, and in fact I know someone who's doing just that for his own custom (and rather advanced) system. But in general you'd just be rewriting exactly what MUSH itself does.
USA #13
Twisol said:

Eagle's feather. Lady's slipper.

Those are not -herbs-..
They are used for concoctions by the forestal classes.
Amended on Wed 10 Mar 2010 11:15 PM by Kevnuke
USA #14
Lady's slipper is absolutely an herb! You find it in the grasslands. (I think I know my herbs, I'm a long-time Sylvan. ;) )

Also, you can find non-herb items on the same line as herb items in the rift, so if you don't account for all possibilities in the match, you'll have a hard time getting a match when you should be. Match the general case, and trim down to the specific case in script.
Amended on Wed 10 Mar 2010 11:22 PM by Twisol
USA #15
Twisol said:

Lady's slipper is absolutely an herb! You find it in the grasslands. (I think I know my herbs, I'm a long-time Sylvan. ;) )

I'm referring to herbs you -eat- to cure an affliction. As I said -that- herb is used to make concoctions. None of the ones you eat or smoke or apply have apostrophes or dashes.

Twisol said:

Also, you can find non-herb items on the same line as herb items in the rift, so if you don't account for all possibilities in the match, you'll have a hard time getting a match when you should be. Match the general case, and trim down to the specific case in script.


If even one item in a pattern matches, then it matches the whole line. Such is evident when you have only one thing on a line match and "omit from output" is on for that trigger. So realizing this.. i could simply use a trigger that does this "(\d+)\s(\w+)" that is only on when i type "info rift" and is turned off by the prompt (Use the minimum needed to match, as Nick suggested earlier). since it isn't anchored and is assumed greedy, it will match whether i get the minimum of one herb on that line or the maximum three on the line, then use a function with string.gmatch as Nick suggested earlier.

Correct me if I'm wrong

EDIT: Typo
Amended on Thu 11 Mar 2010 11:11 PM by Kevnuke
USA #16
Kevnuke said:
Twisol said:
Lady's slipper is absolutely an herb! You find it in the grasslands. (I think I know my herbs, I'm a long-time Sylvan. ;) )

I'm referring to herbs you -eat- to cure an affliction. As I said -that- herb is used to make concoctions. None of the ones you eat or smoke or apply have apostrophes or dashes.

At no other point did you make this distinction clear!

Kevnuke said:
Twisol said:
Also, you can find non-herb items on the same line as herb items in the rift, so if you don't account for all possibilities in the match, you'll have a hard time getting a match when you should be. Match the general case, and trim down to the specific case in script.

If even one item in a pattern matches, then it matches the whole line. Such is evident when you have only one thing on a line match and "omit from output" is on for that trigger. So realizing this.. i could simply use a trigger that does this "(\d+)\s(\w+)" that is only on when i type "info rift" and is turned off by the prompt (Use the minimum needed to match, as Nick suggested earlier). since it isn't anchored and is assumed greedy, it will match whether i get the minimum of one herb on that line or the maximum three on the line, then use a function with string.gmatch as Nick suggested earlier.

Correct me if I'm wrong

Hmm. That is possible, yes. It's not really as explicit as I personally prefer, but yes.
USA #17
Twisol said:
Hmm. That is possible, yes. It's not really as explicit as I personally prefer, but yes.


Only having it on between the command and the prompt isn't explicit enough? It's less than a one second window.. O.o
USA #18
I was more referring to matching just a snippet of the line instead of using as much of the line as you can. I disagree with using the least possible to match, because the more you can use, the more reliable the matches can be. It's very, very easy for extra content to sneak between the command and the response output.
USA #19
My bad, I actually trigger it off of the "Glancing into your rift you see:" line, to turn on that trigger. I turn on the glancing line trigger with the command, or the script does it, and starts the chain reaction.

Also, does achaea always send one or the other DO or WILL, when it requests to negotiate in ATCP or is it random? All the examples i've seen are that it sends WILL.

EDIT: Typo
Amended on Fri 12 Mar 2010 03:16 AM by Kevnuke
USA #20
Kevnuke said:
My bad, I actually trigger it off of the "Glancing into your rift you see:" line, to turn on that trigger. I turn on the glancing line trigger with the command, or the script does it, and starts the chain reaction.

And I assume that line itself is only enabled once you use the command? Much better. Still possible to get the wrong thing, but the more layers the better.

Now, the big problem is when you get an error message. Maybe you're underground (not actually sure if that prevents IR or not). There are lots of error messages, and some of them don't necessarily refer specifically to your command. It's a problem I hit and can't do much about with a MAP plugin I wrote. =/
Amended on Fri 12 Mar 2010 02:52 AM by Twisol
USA #21
I was actually planning to replace (\w+) with an ored list of all the curing herbs.

For example:

"[\s*\d+]\s(sileris|bayberry bark|skullcap)"

not to mention, that not much is going to match on that initial number in square brackets pattern :)
USA #22
That would work too. I personally prefer to use regex to validate a line's format first, then use script to actually check the values. To each his/her own, in the end.
USA #23
Kevnuke said:
Also, does achaea always send one or the other DO or WILL, when it requests to negotiate in ATCP or is it random? All the examples i've seen are that it send WILL.


If it were random, someone would have complained very loudly to the Achaea admins by now. No, I'm pretty sure it's always WILL.
USA #24
Sweet! Then i don't have to make a nested if statement heh.
You wouldn't happen to have a dump from Achaea of the telnet negotiations it sends from the time you connect to the time you DC would ya? And does the Char.Vitals negotiation get sent with the prompt, or more often?
USA #25
Kevnuke said:
You wouldn't happen to have a dump from Achaea of the telnet negotiations it sends from the time you connect to the time you DC would ya? And does the Char.Vitals negotiation get sent with the prompt, or more often?


No, not really. I know you get an IAC WILL ATCP, then you send IAC DO ATCP in response, and immediately send your 'hello' message and module list according to the spec. Then after that it's ATCP messages in IAC SB ATCP <message> IAC SE.

Char.Vitals is sent with every prompt, yes.

I wrote an ATCP plugin specifically to deal with the low-level details, although it seems like it might get phased out soon. If you don't want to do the work yourself, you can grab it from [1]. A good base to work from is my roomname plugin [2], also - just edit scripts/main.lua to do what you want, and use the current content to see how to communicate with the ATCP plugin.

[1] http://jonathan.com/?page_id=29
USA #26
Yeah i was actually going to make a plugin for myself (and others if they want it) that grabs the subnegotiations and uses them for an autosipper and a curing system. Not sure how long it'll take me but I just want to see what I can accomplish. And I greatly appreciate all the plugins from various authors out there. They are great for ideas. :)
USA #27
Kevnuke said:

Yeah i was actually going to make a plugin for myself (and others if they want it) that grabs the subnegotiations and uses them for an autosipper and a curing system. Not sure how long it'll take me but I just want to see what I can accomplish. And I greatly appreciate all the plugins from various authors out there. They are great for ideas. :)


Well, a spot of advice for you: Writing it yourself to learn is all fine and stuff - it's a fantastic way to improve your abilities - but when there's already something that works well, and is proven to work, and there are already at least two other versions of the same thing, you might not want to make a point of releasing it for other people to use. What will yours do that mine (and Nick's, and Worstje's(?)) can't? Or how does it do it better? Mine in particular has existed for a long time, and I'm only the third and most recent maintainer.

Again, writing it yourself to learn is great, I would never say no to that. Go for it! But when you have three plugins, and they each need a different kind of ATCP plugin, which all do the same thing, something's wrong!
Amended on Fri 12 Mar 2010 04:33 AM by Twisol
USA #28
Perhaps every plugin could not only implement ATCP functionality by duplicating code, but indeed implement different handling of ATCP functionality. :P
USA #29
David Haley said:

Perhaps every plugin could not only implement ATCP functionality by duplicating code, but indeed implement different handling of ATCP functionality. :P


Well, that's what I mean by "What will yours do that mine can't? Or how does it do it better?" I don't mean to discourage ATCP-plugin development altogether, but I do want to encourage thinking about why, specifically, it should be released.
USA #30
I meant primarily close friends.. I'm just a control freak. I like to make sure things work exactly the way i want. :D
Everything is gonna be in one or two plugins for me.
Australia Forum Administrator #31
If you want to see what Achaea sends, install this in a fairly recent version of MUSHclient:

Template:saveplugin=Achaea_Test
To save and install the Achaea_Test 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 Achaea_Test.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 Achaea_Test.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.




<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Achaea_Test"
   author="Nick Gammon"
   id="3d13120b92f9f93af9ac6f42"
   language="Lua"
   purpose="Tests Achaea ATCP"
   date_written="2010-02-05"
   requires="4.50"
   version="1.0"
   >

</plugin>

<!--  Script  -->

<script>
<![CDATA[

function OnPluginTelnetSubnegotiation (type, option)
  AppendToNotepad ("Achaea", "'" .. string.gsub (option, "\n", "\r\n") .. "'\r\n\r\n")
end -- function OnPluginTelnetSubnegotiation

function OnPluginTelnetRequest (type, data)
 if type == 200 and data == "WILL" then
   return true
 end -- if
end -- function OnPluginTelnetRequest

]]>
</script>


</muclient>



I see stuff like:


'Char.Vitals
H:580/580 M:580/580 E:1800/1800 W:1800/1800 NL:4/100 '

'Room.Num 13215'

'Room.Brief Kinsarmar Road near Cactii Gate'

'Room.Coordinates 16,-7,3,0'

'Room.Environment Urban'

'Room.Exits ne,e,se,sw,w,nw'

'Room.FullExits ne(13219),e(13271),se(16754),sw(1980),w(13247),nw(13272)'

'Char.Vitals
H:580/580 M:580/580 E:1800/1800 W:1800/1800 NL:4/100 '

'Char.Vitals
H:580/580 M:580/580 E:1800/1800 W:1800/1800 NL:4/100 '


Amended on Fri 12 Mar 2010 05:27 AM by Nick Gammon
Australia Forum Administrator #32
David Haley said:

Perhaps every plugin could not only implement ATCP functionality by duplicating code, but indeed implement different handling of ATCP functionality. :P


Yes indeed. And each plugin could handle combat differently too. ;)
Australia Forum Administrator #33
What I mean by that is, if you look at the post above the last one, you see that all ATCP is, is a series of messages, much like MUD prompts. No harm in individually handling them, is there?

And my post shows just how simple ATCP is - no real need for over 1000 lines of code, eh?
Amended on Fri 12 Mar 2010 05:25 AM by Nick Gammon
USA #34
I've got an ATCP DEBUG alias in my ATCP plugin, too, that outputs the same data, except only the IAC SB ATCP <content> IAC SE messages. I use it a lot when I'm debugging a problem a user is having.
USA #35
Nick Gammon said:
And my post shows just how simple ATCP is - no real need for over 1000 lines of code, eh?

That depends! My purposes include distributing the ATCP data in a friendly manner. The core of the plugin is probably the same size as yours.
USA #36
Nick Gammon said:

'Room.Num 13215'

'Room.Brief Kinsarmar Road near Cactii Gate'

'Room.Coordinates 16,-7,3,0'

'Room.Environment Urban'

'Room.Exits ne,e,se,sw,w,nw'

'Room.FullExits ne(13219),e(13271),se(16754),sw(1980),w(13247),nw(13272)'



Droooooollll. I'm envious. I've suggested Room.Environment before but haven't ever heard back. They implement it - and more! - for you in a matter of days.
Amended on Fri 12 Mar 2010 05:53 AM by Twisol
USA #37
thanks Nick that's what I was looking for. I suppose i can get the rest when i get back online. :)
USA #38
I know it's been a while since I looked at this thread but would the same plugin work for GMCP just by changing 200 to 201?

Edit: The old ATCP plugin you posted isn't printing ATCP messages to the output window. I'm not sure if this is due to a version update or something IRE changed on the server side.

BTW I copied and pasted the plugin to notepad++ Saved As.. Achaea_Test.xml then tried to add it while disconnected. No output came from it.

Any thoughts?
Amended on Thu 29 Dec 2011 03:49 AM by Kevnuke
Australia Forum Administrator #39
I've lost track of the changes that IRE have been making to GMCP. The 201 type might work or it might have a different message format. Twisol probably knows ...
USA #40
any idea how I can reach him?
And Swype can't seem to figure out that this is a text box..it doesn't want to auto-capitalize the beginning of my sentences. And for a moment it wasn't auto-spacing between words either Hmm..
USA #41
'Allo.

ATCP and GMCP have different message formats. GMCP uses a JSON object as its payload, whereas ATCP has a relatively custom delimiter-based format per message. The semantics themselves aren't really that different, but it's not as simple as switching 200 to 201.

I've uploaded my GMCP plugin to my public Dropbox folder [1]. I can't guarantee that it works, I haven't logged into Achaea in at least a couple months now. If you find any issues though, I'd be glad to investigate.

[1]: http://dl.dropbox.com/u/10356966/GMCP.plugin.zip