The Mud Connector

Author Topic: GUI snippet  (Read 9260 times)

jbrianclar

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #30 on: April 21, 2011, 10:33 AM »
Hey,

I typically do close it with </send> but for some reason
mushclient must have a bug and was sending the </send> as
plain text, so I omitted the send so it would display right.
Zmud does not have an issue using the full <send href> tags
with ending </send>, but still seems to work if you omit it.

ch would be a pointer to the player's character structure
array and at this point they are in state con_playing.

the other information passed in that function is nothing
more than the data with the integer/string values inserted
in for an object's vnum, name, and a tag if it has a
trigger.

      send_to_char(ch, "%3d. [%5d] %-40s %s\r\n",
                   ++found, obj_index[nr].vnum,
obj_proto[nr].short_description,
                   obj_proto[nr].proto_script ? "[TRIG]" :
"" );

All I did was add in two more obj_index[nr].vnum calls and
two more %d to put the correct vnum for my send commands.

Here are the guidelines I was following for using MXP:
http://www.zuggsoft.com/zmud/mxp.htm#Links


KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #31 on: April 21, 2011, 11:26 AM »
> I typically do close it with </send> but for some reason
> mushclient must have a bug and was sending the </send> as
> plain text, so I omitted the send so it would display right.

Are you sure you didn't just forget to put a \t in front of the </send>?  You can't just leave the tags open, they need to be closed or they'll bleed.  The README.TXT has an example of how to do it.

> All I did was add in two more obj_index[nr].vnum calls and
> two more %d to put the correct vnum for my send commands.

Hrm, could it be that you're calling ProtocolOutput() too early, and it's stripping out the tags before applying the arguments?  Try using sprintf() to copy it to a string first, then send that string to send_to_char(), and see if that fixes it.  If so, the TBA installation instructions may need to be changed.
KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


Macademus

  • Guest
RE: GUI snippet
« Reply #32 on: April 21, 2011, 1:40 PM »
if you visit www.mudbytes.net someone has made a patch for adding the GUI to TBA.... I'd suggest checking out that!

jbrianclar

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #33 on: April 21, 2011, 6:33 PM »
I installed based off that single diff. I did not get any of
the other documentation, although I have now. That was a bit
dumb of me. The problem with the send tags was certainly all
my fault. I did not put a \t before the </send>. I corrected
this and it worked perfectly.

That being said, it still crashes when used via telnet. I will
give what has been mentioned here a try and see what I can
come up with.

KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #34 on: April 21, 2011, 6:50 PM »
> I installed based off that single diff. I did not get any of
> the other documentation, although I have now.

Not sure which documentation you're using, but my latest TBA instructions can be found here: http://www.godwars2.org/download/INSTALL_TBA.TXT

> That being said, it still crashes when used via telnet. I will
> give what has been mentioned here a try and see what I can
> come up with.

Try the sprintf() thing.
KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


jbrianclar

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #35 on: April 25, 2011, 2:59 PM »
Ok, doing the sprintf does not crash the MUD, but it also
does not send the MXP tags. It really doesn't help me drill
down any further into what is causing the problems. I can
repeat this on stock tbaMUD so right now MXP tags sent via
send_to_char to a non MXP client running putty or something
of the sort will crash the MUD.

sprintf code:

      sprintf(buf, "%3d. [\t<send href=\"vstat obj
%d\">%5d\t</send>] %-40s %s\r\n",
                   ++found, obj_index[nr].vnum,
obj_index[nr].vnum, obj_proto[nr].short_description,
                   obj_proto[nr].proto_script ? "[TRIG]" :
"" );
      send_to_char(ch, "%s", buf);

output on mud for both MXP/non MXP clients:

vnum obj sword
  1. [  <send href="vstat obj 21">   21 </send>] War's Blood                              
[TRIG]
  2. [  <send href="vstat obj 1293"> 1293       </send>] a
sharp looking samurai sword            
  3. [  <send href="vstat obj 3021"> 3021       </send>] a
small sword                            
  4. [  <send href="vstat obj 3022"> 3022       </send>] a
long sword          

KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #36 on: April 25, 2011, 5:56 PM »
> Ok, doing the sprintf does not crash the MUD, but it also
> does not send the MXP tags.

Because you're doing it like this:

> send_to_char(ch, "%s", buf);

As I said in my previous post, it appears you're calling ProtocolOutput() too early, and it's stripping out the tags before applying the arguments.  There are no tags in the string "%s", therefore nothing is being stripped out.

Try: send_to_char(ch, buf);

Or better yet, move the call to ProtocolOutput below the vsnprintf() - this works correctly if you follow the installation instructions I posted, rather than the diff.

Here is the link once more: http://www.godwars2.org/download/INSTALL_TBA.TXT

I'd suggest going through it and making sure everything is in the right place.
KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


jbrianclar

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #37 on: April 25, 2011, 9:36 PM »
I moved protocoloutput below the vsnprintf and now nothing
works. It sends the actual tabs to the client....

code:

  wantsize = size = vsnprintf(txt, sizeof(txt), format,
args);

  length = strlen(format);
  format = ProtocolOutput( t, format, &length );  /* <---
Add this line */
  if ( t->pProtocol->WriteOOB > 0 )         /* <--- Add this
line */
      --t->pProtocol->WriteOOB;             /* <--- Add this
line */

mud output now is
------------------
 1204] the overseer's outpost [ INDOORS ] [ Inside]
   The main hang out of the Gods, the Immortal Board Room is
the place to be.  
Gods exchange messages here most every day.  The mortal
board room is to the
east and the meeting room for the gods is to the south.  To
the north is the
Gods' Inn and to the west is a post office for Gods.  In the
northeast corner
you spot a small staircase leading upwards.
[ Exits:        (n      )       (e      )       (s      )      
(w      ) ]
[3098] A large expensive computer terminal is here waiting
to be accessed.

500HP 100AP 82MV >
vnum obj sword
  1. [  <send href="vstat obj 21">   21 </send>] War's Blood                              
[TRIG]
  2. [  <send href="vstat obj 1293"> 1293       </send>] a
sharp looking samurai sword            
  3. [  <send href="vstat obj 3021"> 3021       </send>] a
small sword                            
  4. [  <send href="vstat obj 3022"> 3022       </send>] a
long sword


KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #38 on: April 26, 2011, 4:55 AM »
> I moved protocoloutput below the vsnprintf and now nothing works.

Because you're still using that diff file from MudBytes, and not the instructions I posted a link to.  The code needs to look like this:
  wantsize = size = vsnprintf(txt, sizeof(txt), format, args);
  strcpy(txt, ProtocolOutput( t, txt, (int*)&wantsize )); /* <--- Add this line */
  size = wantsize;                    /* <--- Add this line */
  if ( t->pProtocol->WriteOOB > 0 )   /* <--- Add this line */
    --t->pProtocol->WriteOOB;         /* <--- Add this line */
  if (t->character)
    wantsize = size = proc_colors(txt, sizeof(txt), COLOR_ON(t->character));
If you follow the instructions in INSTALL_TBA.TXT, your implementation will work.
KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


jbrianclar

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #39 on: April 26, 2011, 2:54 PM »
You are right, and I am sorry for not listening sooner. I will go through INSTALL_TBA.TXT tonight and ensure everything matches up as it should.

(Comment added by jbrianclar on Tue Apr 26 14:47:33 2011)

Ok, the only line I was missing was that 1 line from comm.c. I
did follow the other instructions and made the changes to
protocols.c and such earlier.

That one change fixed the problem and now it works perfectly!

KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #40 on: May 22, 2011, 7:11 PM »
If anyone has used the Merc installation instructions, please be aware that I missed something - thanks go to Bryantos for pointing it out.

In read_from_description(), you need to replace this:
    /* Check for overflow. */
    iStart = strlen(d->inbuf);
    if ( iStart >= sizeof(d->inbuf) - 10 )
With this:
    /* Check for overflow. */
    iStart = 0;
    if ( strlen(d->inbuf) >= sizeof(d->inbuf) - 10 )
Without that change, spammed commands will be silently dropped, which can be rather annoying (particularly for movement).
KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


Keriwena

  • Posts: 0
    • View Profile
RE: GUI snippet
« Reply #41 on: May 23, 2011, 12:20 AM »
Cool, thanks. I'd noticed that happen, hadn't related it to the snippet.

KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #42 on: June 14, 2011, 6:47 AM »
I've updated the snippet to resolve a couple of issues that were recently brought to my attention.  If you're already using the snippet, I recommend using diff first, so that you don't wipe over your MSSP variables.

The first issue is broken packets.  If the client splits the data across multiple packets, the snippet can now handle it correctly.  Thanks go to Tyche for pointing this out.

The second issue is a bit more tricky.  RFC 1091 provides a mechanism for cycling through multiple terminal types, and the mud uses this standard to detect support for XTerm 256 colors.  However when used with Windows telnet, the client is left in a terminal emulation mode that appears unable to communicate with the mud - and it refuses to return to the top of the list.  Or to put it in simple terms: Windows telnet freezes when it connects to the mud.

My solution is a bit nasty, but it's simple and effective.  If the first TTYPE is "ANSI", the mud won't request any further terminal types.  This has no impact on dedicated mud clients such as WinTin++ and BlowTorch, as they identify themselves by name on the first TTYPE request.

There is an alternative approach using escape codes, which I may add in the future, but it comes with a different drawback; the mud would need to pause for a few seconds before displaying the login screen.  However this approach would also allow you to avoid the automatic disabling of echo for Windows telnet users.


KaVir at God Wars II: godwars2.org 3000
Roomless world. Manual combat. Endless possibilities.


KaVir

  • Jr. Member
  • **
  • Posts: 95
  • God Wars II
    • View Profile
    • God Wars II
RE: GUI snippet
« Reply #43 on: August 28, 2011, 7:30 PM »
I've updated the snippet again, primarily because the MSDP specification has undergone several changes since the snippet was released, but also to resolve a few issues I've encountered while helping other people install it.

  • Added an AllocString() wrapper function, as strdup() isn't standard C.
  • Added support for the new MSDP tables and arrays.
  • Added support for the new UNREPORT and RESET MSDP commands.
  • Added a new REPORTED_VARIABLES list, as described in the latest MSDP spec.
  • Renamed VARIABLES to SENDABLE_VARIABLES as described in the latest MDSP spec.
  • Cleaned up the code, adding consts and fixing -ansi and -pedantic warnings.
  • Added support for the new Mudlet GUI autoinstaller.
  • Added an MCCP flag to make integration with the snippet easier.
  • Updated CopyoverGet() and CopyoverSet() to include TTYPE, MCCP and CHARSET.
  • Added an MSDPFlush() function for variables that need to be sent immediately.
  • ProtocolOutput() now lets you send tabs.
  • The snippet now recognises that DecafMUD supports 256 colours.
  • Updated the TBA instructions with a fix for strfrmt().
  • Updated the installation instructions to use MSDP tables.

    You can download the latest version from my website here - I've updated it on MudBytes as well, but it's still pending approval.

    An updated version of the generic MUSHclient plugin can be downloaded from here.

    The following muds are now using the snippet to offer their players cutting-edge protocol support:

  • 4 Dimensions (only on the test port for now, but see here and here)
  • Ansalon MUD (ansalonmud.net 8679)
  • Arcane Nites (arcanenites.com 7000)
  • ChaosMUD (chaosmud.com 1111)
  • CyberASSAULT (cyberassault.org 11111)
  • Dark Lair (tiopon.mudmagic.com 3500)
  • Fallout: The Dirty South (falloutsouth.net 4000)
  • God Wars II (godwars2.org 3000)
  • GodWars: Rebirth of Apocalypse (apoc.godwars.net 6660)
  • Land of Eternal Sun (simba.darknessmuds.co.uk 5645)
  • Pict (omen.genesismuds.com 4200)
  • Realms of Despair (realmsofdespair.com 4000)
  • Storm Hunters (sh.ackmud.net 7000)
  • The Builder Acadamy (tbamud.com 9091)
  • The Realm of War (row.godwars.net 2000)
  • Tir na nOg (66.212.25.125 6789)

    If you've added the snippet but aren't on the above list, please let me know!

    There are also a few other muds that have implemented their own MSDP solutions, including The 7th Plane (7thplane.net 8888), which has also incorporated a few of the other features from the snippet, ConQUEST (conquest.sdmud.com 5000), Elvenblade (elvenblade.ca 23), and Lowlands (lolamud.net 6969).

    Meanwhile, I've seen a few more muds adding support for GMCP, which offers similar functionality to MSDP.  Both protocols make it considerably easier to design graphical interfaces, so it's pretty exciting to see more and more muds taking the plunge.



    (Comment added by KaVir on Mon Aug 29  2:07:03 2011)

    The latest version is now available directly from MudBytes.

    (Comment added by KaVir on Thu Sep  1  6:04:07 2011)

    If you're using version 3, there's a bug in AllocString() - you need to replace malloc(Size) with malloc(Size+1), to take into account the NUL string terminator.  The above link now points to version 4, which includes the fix.
  • KaVir at God Wars II: godwars2.org 3000
    Roomless world. Manual combat. Endless possibilities.


    scandum

    • New to TMC
    • *
    • Posts: 12
      • View Profile
    RE: GUI snippet
    « Reply #44 on: September 02, 2011, 1:15 AM »
    I wasn't sure whether to start a new thread for this, but figured to post this here as the subject is identical.


    I finished work on MTH 1.4, a public domain telnet / protocol handling snippet this week and it's now available for download here.

    MTH 1.3 (released April 6, 2009) added support for NAWS, TTYPE, NEW-ENVIRON, MCCP, and MSSP. The MCCP implementation might be of interest to some because it uses 32K of memory per player, instead of the 138K used by most MCCP implementations.


    MTH 1.4 adds support for EOR, MSDP, MTTS, Arachnos, and xterm 256 colors.


    MSDP follows specification and should work with KaVir's MUSHClient plugin. In addition the MTH snippet has a walkthrough for implementing the ROOM variable, which combined with this TinTin++ script provides you with a status bar and fully automatic automapping. screenshot Not a whole lot of eye candy, but it's very effective, and will work with any other client that can parse MSDP and has an OOB mapper.



    MTTS is a standard I created to negotiate terminal capabilities to the server. It's currently only supported by TinTin++, and in MTH it's used to detect 256 color support, and can be used to detect ANSI, VT100, UTF-8, and SCREEN READER support as well. MTTS is very easy to add both client and server side, unlike other alternatives.


    Arachnos is an MSDP based Intermud network. Arachnos is relatively easy to implement for any MSDP enabled MUD. Instead of the traditional Intermud systems where you connect your MUD to a central server, an Arachnos spider connects to your mud using the normal connection, then uses MSDP to receive and transmit chat messages. Intermud gaming spiders are a likely future addition as anyone can create and run a spider. More information is available in the spec.

    xterm 256 colors MTH extends the classic 16 color ANSI color system to a 32 color system using xterm color codes. ANSI supports 6 primary, 6 secondary, and 4 gray-shade colors. MTH adds the 12 tertiary colors, and 4 gray-shade colors. A stand alone version of the color snippet and a screenshot is available here. The code also supports color code compression.


    Enjoy.