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.
Entire forum
➜ MUDs
➜ General
➜ Is GMCP still a thing?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
4
5
6
7
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #15 on Tue 28 Apr 2020 10:38 PM (UTC) Amended on Tue 28 Apr 2020 10:46 PM (UTC) by Nick Gammon
|
Message
| Levering off reply #1, something like this when the hitpoints change (or when you send a prompt, for example):
ch_printf (ch, "\xFF\xFA\xC9Char.Status {\"hp\": %d}\xFF\xF0", ch->hit);
Untested, but that would be the general idea.
For more readability, define those things in mud.h, eg.
#define IAC_SB_GMCP "\xFF\xFA\xC9"
#define IAC_SE "\xFF\xF0"
And then have your message look like this:
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"hp\": %d}" IAC_SE, ch->hit);
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #16 on Tue 28 Apr 2020 10:49 PM (UTC) Amended on Wed 29 Apr 2020 09:35 AM (UTC) by Xinefus
|
Message
| Ok, so I'm just wanting to confirm I'm on the right track.
Under player.c: line 1000
ch_printf( ch, "%sHP: %s%d %sof %s%d\r\n", s1, s2, ch->hit, s1, s2, ch->max_hit );
This is what I can find that refers to HP. There is also one for mana, gold, and a list of stats, etc.
Is this where I should be starting to dig when I want to add the GMCP wrap?
And looking at Nick's last post:
ch_printf( ch, "\xFF\xFA\xC9Char.Status {\"%sHP: %s%d %sof %s%d\r\n": %i}\xFF\xF0", s1, s2, ch->hit, s1, s2, ch->max_hit );
Char.Status being what would be used on a client side plugin as per #1 in http://www.gammon.com.au/forum/?id=10043.
I get pretty confused with all the diff namings, i think in the ref post it's tt vice Char.Status..
Am I going in the right direction? | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #17 on Tue 28 Apr 2020 11:08 PM (UTC) |
Message
| In the version of SMAUG I am looking at (which is probably different to yours) in the file comm.c there is a function "display_prompt".
This would appear to be a logical place to send character hitpoints via GMCP.
Quote:
Char.Status being what would be used on a client side plugin as per #1 in http://www.gammon.com.au/forum/?id=10043.
I get pretty confused with all the diff namings, i think in the ref post it's tt vice Char.Status..
Yes, well that post shows different ways of doing it. If you want to send:
Then you can. Then you make the client interpret that.
Or you can send it the JSON way:
Now you make the client interpret that JSON string (which obviously isn't too hard, in that particular case). Using JSON has a bit more flexibility, if you want that, because you can add extra things, like mana, movement points, room number, etc. now or later if you want to.
For example:
Char.Status {"hp": 1234, "mana": 88, "move": 666, "room": 21000}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #18 on Tue 28 Apr 2020 11:40 PM (UTC) Amended on Wed 29 Apr 2020 09:36 AM (UTC) by Xinefus
|
Message
| Ok, so if I wanted to edit the prompt so that the client would receive hp JSON data through GMCP, I should start with the display_prompt?
This brings me around in a loop back to write_to_buffer..
But I don't know how to wrap a GMCP. I thought we were on a closer path when it came to the player data in my previous post?
Or do I need to add a line of
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"hp\": %d}" IAC_SE, ch->hit);
within the char display_prompt ?
Not saying exactly that, but something like that? for instance in display_prompt it shows
case 'h':
pstat = ch->hit;
break;
case 'H':
pstat = ch->max_hit;
break;
Would then the line I need to add at the bottom of display_prompt would be
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"hp\": %h, \"maxhp\": %H}" IAC_SE, ch->hit);
I think I'm starting to get this... maybe? | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #19 on Wed 29 Apr 2020 01:49 AM (UTC) |
Message
| Can you paste your whole (current) display_prompt function here, please, so we are both talking about the same thing? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #20 on Wed 29 Apr 2020 01:50 AM (UTC) |
Message
|
Quote:
But I don't know how to wrap a GCMP.
That was in the code I showed you. I don't understand what you mean when you say that. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #21 on Wed 29 Apr 2020 01:53 AM (UTC) |
Message
| So we don’t confuse ourselves, and other readers, please refer to GMCP as that, and not start calling it GCMP, as you have done multiple times.
It’s “Generic MUD Communication Protocol”.
It isn’t “Generic Communication MUD Protocol”.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #22 on Wed 29 Apr 2020 10:07 AM (UTC) Amended on Wed 29 Apr 2020 10:14 AM (UTC) by Xinefus
|
Message
| So sorry about the acronym error. I really ought to know better. I'm in the military and we live for acronyms... I have updated my posts to reflect GMCP.
As for the comm.c default_prompt function ( I also said char default instead of void default in an earlier post, was reading the wrong line)
comm.c detault_prompt function:
Quote:
https://github.com/DBNU-Braska/GMCP-Learning/blob/master/comm.c.display_prompt
| Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #23 on Wed 29 Apr 2020 02:37 PM (UTC) Amended on Wed 29 Apr 2020 02:41 PM (UTC) by Fiendish
|
Message
|
Quote: What is that stuff doing in color.c??
Interpreting inline color codes. The primary difference between send_to_desc and write_to_buffer is that send_to_desc first converts SMAUG color codes into a form that the client understands as colors.
Nick suggests using ch_printf because it lets you format your messages a particular comfortable way (if you know printf format). Just keep in mind that that will also interpret any color codes you include because it's higher in the chain than send_to_desc. If you don't want ampersands etc to get converted into colorized text in your GMCP messages, I think you'll need to bypass the colorization by calling write_to_buffer directly or do whatever SMAUG needs you to do to get them sent literally. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #24 on Wed 29 Apr 2020 06:13 PM (UTC) Amended on Wed 29 Apr 2020 06:14 PM (UTC) by Xinefus
|
Message
|
Fiendish said:
I think you'll need to bypass the colorization by calling write_to_buffer directly or do whatever SMAUG needs you to do to get them sent literally.
There is no need for me to have the client get colour codes in this way. So you are suggesting that I use write_to_buffer instead of ch_printf? I'm just trying to see where to put this.
From the beginning, you read me before I even started asking questions! The logic is the important part - and this is where I have great difficulty.
i'm trying to track my way through the files so I can understand.
In write_to_buffer, it already has all the data from the prompt all packaged up. I'm not sure I know how something like hp would be written in or look like by this time. I can't follow it enough. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #25 on Wed 29 Apr 2020 08:38 PM (UTC) Amended on Wed 29 Apr 2020 08:40 PM (UTC) by Nick Gammon
|
Message
|
If you don’t want ampersands etc to get converted into colorized text in your GMCP messages, I think you’ll need to bypass the colorization by calling write_to_buffer directly or do whatever SMAUG needs you to do to get them sent literally.
However there are no ampersands in:
The last few lines of the function you linked are:
So, you would output the GMCP stuff at the end:
Note that if they turn the prompt off, they wouldn’t get the GMCP either. You might want to find where display_prompt is called (there is an “if” test in front of it) and do the GMCP stuff there, regardless of whether they want the prompt or not.
However even doing it here should be enough for you to test it.
The reason I suggest doing it here or near where the prompt is displayed is because the prompt is usually updated when the HP changes, and that is what you are trying to send.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #26 on Wed 29 Apr 2020 09:06 PM (UTC) |
Message
| Thank you Nick.
From reading up on GMCP on some of the other sites and reading some of the refs on your page about standards, it looks like I'm going to have to document a lot of this so I don't get mixed up the further I go.
I read in many places that things such as hp/sp/ep are Char.Vitals, whereas Char.Status is for stats such as int/dex/wealth/etc.
As you state in your guide, should I just take a standard and go with that? Is there one you recommend, more complete/less complete?
I am going to try and implement this, along with using the tools for MUSHclient you have written to see if I can't get something to work!
More to come, I'm sure. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #27 on Wed 29 Apr 2020 10:39 PM (UTC) Amended on Wed 29 Apr 2020 10:54 PM (UTC) by Fiendish
|
Message
|
Quote:However there are no ampersands in: Char.Status {"hp": 1234, "mana": 88, "move": 666, "room": 21000}
Not in that, but the moment you decide to start sending more than just stats, things like room names and descriptions for easier script handling, then you're likely to start seeing some. So it's good to be aware of the differences between the different functions. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #28 on Wed 29 Apr 2020 10:52 PM (UTC) |
Message
| You two are so good at this!
I am trying to read through the post: http://www.gammon.com.au/forum/bbshowpost.php?id=10043&page=9
It at least gives me some of the logic behind how this completely works.
I understand what
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"hp\": %d}" IAC_SE, ch->hit);
this means and how it works. But isn't there something I need to put before this to enable the telnet negotiations? I haven't got through the whole thread (as the link suggests) but I'm hoping it will outline a bit more on what other amendments I need to do to my codebase?
I did see on one of the pages some edits that @Nick made to a few of the files. I'm not sure I understand why all of them were made yet, and perhaps there will be more further on.
Thanks again for your support folks, I really appreciate this and am learning how to implement this. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #29 on Wed 29 Apr 2020 10:56 PM (UTC) Amended on Wed 29 Apr 2020 11:17 PM (UTC) by Fiendish
|
Message
|
Xinefus said:
But isn't there something I need to put before this to enable the telnet negotiations?
Technically no. I'm pretty sure that negotiating activation is just a courtesy between the client and server. Any subnegotiation messages that you send that the client can't understand _should_ just be ignored. Though I guess I don't remember whether MUSHclient cares if you send it IAC SB 201 without ever first saying that you're going to be sending them. |
https://github.com/fiendish/aardwolfclientpackage | 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.
201,969 views.
This is page 2, subject is 7 pages long:
1
2 3
4
5
6
7
It is now over 60 days since the last post. This thread is closed.
Refresh page
top