Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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
| Xinefus
(106 posts) Bio
|
Date
| Reply #30 on Thu 30 Apr 2020 12:01 AM (UTC) |
Message
| Ok, so I have confidently added the little snipped of code to comm.c and mud.h so that things should be sending GMCP data to the client.
I am trying to find any plugins here that I can adapt to see if it is working!
I downloaded the GMCP_handler_NJG plugin, and GMCP_message_receiver_test plugin.
I know that these are/were specific to other MUDs, but I had hoped to be able to understand it enough to implement.
I have been able to get my client to display
every time the prompt is refreshed... This is promising!
Now I just need to know how to get that JSON info turned into the actual hp! The info is definitely there..
Am I going in the right direction? | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #31 on Thu 30 Apr 2020 12:06 AM (UTC) |
Message
| If the message gets to the client and isn't immediately displayed but you can access it, then yes you're going the right direction. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #32 on Thu 30 Apr 2020 12:26 AM (UTC) |
Message
| I have a strange suspicion that I am not getting quite what I'm looking for. In other words, I haven't set it up correctly to send me the right information.
*pbuf = '\0';
send_to_char( buf, ch );
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"hp\": %d}" IAC_SE, ch->hit);
return;
The above is what I put at the end of display_prompt. Within display_prompt, the hp is stated as:
case 'h':
pstat = ch->hit;
break;
It seems that ch_printf is given the right info, but i'm only getting
<38hp 106m 110mv>
GMCP: Char.Status
from while using the above mentioned plugins. Without the plugins, nothing is seen.
How can I convert this Char.Status into the information that lays beneath? Essentially, how do I make it show 38?
Getting closer. :) | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #33 on Thu 30 Apr 2020 02:07 AM (UTC) Amended on Thu 30 Apr 2020 03:43 AM (UTC) by Nick Gammon
|
Message
| I was about to suggest you do something like that. Yes, you are on the right track. When I tested by forcing through the packet by using the Game -> Test Trigger (Ctrl+Shift+F12) and entering:
I got displayed, from the GMCP_handler_NJG plugin, and with gmcpdebug set to 2, the following:
Then I added the line of code you quoted into my SmaugFUSS comm.c file, compiled and tested. It also worked. In this case:
You can see that it correctly showed the HP as being 24.
So, I don’t know what you have done. Did you copy and paste the exact code you put into the file? Did you get any compiler warnings?
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #34 on Thu 30 Apr 2020 09:27 AM (UTC) Amended on Thu 30 Apr 2020 09:28 AM (UTC) by Xinefus
|
Message
| I got just what you did Nick!
If I were to read the GMCP_handler_NJG plugin notes correctly, I would know that there are more than just 0 and 1, but in fact 0,1,and 2 debug modes!
Alright, So the server is sending the correct information. The whole goal of this is to have it on a miniwindow such as all the examples here are so great at doing.
I have gone ahead and added this:
ch_printf (ch, IAC_SB_GMCP "Char.Status {\"cur_hp\": %d, \"max_hp\": %d, \"cur_mana\": %d, \"max_mana\": %d, \"cur_mv\": %d, \"max_mv\": %d}" IAC_SE, ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move);
Ugly for now, I'll make it nice later...
But with that I was able to have the debug give me:
<38hp 106m 110mv>
Char.Status {"cur_hp": 38, "max_hp": 38, "cur_mana": 106, "max_mana": 106, "cur_mv": 110, "max_mv": 110}
Now I'm having trouble understanding the Health_Bar_Miniwindow_Telnet. I have looked at reply 133 of http://www.gammon.com.au/forum/bbshowpost.php?id=10043 but I can't seem to find where the script is catching the information or it is missing some steps.. | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #35 on Thu 30 Apr 2020 11:15 AM (UTC) Amended on Thu 30 Apr 2020 11:17 AM (UTC) by Xinefus
|
Message
| As an aside, I have loaded smaugfuss194
https://smaugmuds.afkmods.com/files/smaugfuss-194-501/
Just to have the most up to date and bug free system. I've redone the changes and have the same results so far. Still investigating how to use the miniwindow plugins to capture that data.
Cheers, | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #36 on Thu 30 Apr 2020 09:00 PM (UTC) |
Message
| On this page is an example of handling the GMCP messages:
https://www.gammon.com.au/gmcp
The example plugin https://github.com/nickgammon/plugins/blob/master/GMCP_message_receiver_test.xml demonstrates how you might do it.
Basically, the plugin, which you installed, called GMCP_handler_NJG, detects the GMCP messages. It then does a BroadcastPlugin function call to send that message to any "listening" plugins.
GMCP_message_receiver_test is an example of such a plugin. It detects the message name (eg. "char.vitals") and then decodes the JSON which is the rest of the message into a Lua table.
It then calls a handler for that message type, for example for char.vitals:
function gotCharacterVitals (vitals)
-- tprint (vitals)
-- example:
print ("HP is now:", tonumber (vitals.hp))
end -- gotCharacterVitals
Now instead of doing a print, you could update a health bar.
That part would be like the standard health bar plugin, except getting the data from a trigger it gets it from the GMCP data. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #37 on Fri 01 May 2020 09:22 AM (UTC) |
Message
| Thank you so much folks! Your help is setting me up to implement a whole lot of new tantalising features in my MUD!
I was having a bunch of problems with syntax, but I have successfully been able to get an infobox working with HP/SP!
I am still working on using a simple miniwindow perhaps as I want the ability to move them around..
I think there is the ability to just add that to an infobox? But I also want to learn how the miniwindows work in general so may go back to my other posts and get that going. | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #38 on Fri 01 May 2020 04:35 PM (UTC) |
Message
| Ok, I am trying to sit down and plan out my way forward so that I can make this project something manageable.
First I want to say that over the past couple weeks, I've been reading and searching the web - to the two main people that have helped me: I am so lucky to be able to get your help! Right now, to me, you are celebrities when it comes to MUD stuffs, server and client.
Thank YOU!
That aside, I am going to work towards having a similar concept to how Aardwolf modules. It seems fairly straight forward. ref: http://www.aardwolf.com/wiki/index.php/Clients/GMCP#aardmodules_room
What I am wondering, as I'm going to start with some char. modules, how would I go about efficiently putting the right lines of code into the codebase? Here for a start you've suggested in display_prompt, but in post 7 of
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=10043
You have made a lot of other changes, e.g. show_status, fixup_lua_strings, want_telnet_info. I suppose to make GMCP work efficiently, there is a lot of optimisation that can be done; I don't think I'm in a position to do all that at this time.
I believe that most char. modules would be best positioned to be within display_prompt; would you suggest that victim/fighting be here as well?
I've also seen the use of snprintf(), whereas in this thread I have been suggested to use ch_printf() (essentially printf()). Is there a preference here?
Thanks again! Happy Friday/weekend. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #39 on Fri 01 May 2020 06:32 PM (UTC) Amended on Fri 01 May 2020 08:29 PM (UTC) by Fiendish
|
Message
|
Quote: I've also seen the use of snprintf(), whereas in this thread I have been suggested to use ch_printf() (essentially printf()). Is there a preference here?
printf and snprintf are part of a family of system-level functions in the C language that put data into a computer memory buffer. printf is for streams, sprintf is for character arrays, snprintf is like sprintf but safer because it won't write more bytes than you explicitly tell it to write (like if you're unsure how long your total text is and you don't want to overrun the finite space that has been preallocated for storing the result). Etc (there are more). They all use the same style of syntax with %-symbol format specifiers that are then replaced by the subsequent variable values according their meaning. We can call that style printf-family syntax.
ch_printf is a SMAUG function that uses printf-family syntax to send colorized messages to a character. ch_printf may use print/sprintf/snprintf internally, but is is not interchangeable with them. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Xinefus
(106 posts) Bio
|
Date
| Reply #40 on Sat 02 May 2020 01:58 AM (UTC) |
Message
| Ok, so I added that little bit of code the way that it was shown in my earlier post.
I got the strangest replies from a couple of the players... the ones using Gmud can actually see the text... Obviously from MUSHclient there was nothing to be seen, we tried Mudlet and nothing could be seen either. I didn't have access to c/zmud to test.
Is this something you know of? Is there a way to fix it? | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #41 on Sat 02 May 2020 04:50 AM (UTC) Amended on Sat 02 May 2020 05:06 AM (UTC) by Nick Gammon
|
Message
| Yes, that is what the negotiation is all about. See: http://www.gammon.com.au/gmcp
The server should send (when connecting to the client, eg. after establishing the player name):
IAC WILL GMCP (ie. 0xFF 0xFB 0xC9)
Then if you receive (sooner or later):
IAC DO GMCP (ie. 0xFF 0xFD 0xC9)
Then you turn on a flag, which you use in your code to decide whether or not to send the GMCP messages. Obviously this flag has to be stored on a per-player basis, so it is part of the player struct (or possibly the descriptor struct).
And, if you receive:
IAC DONT GMCP (ie. 0xFF 0xFE 0xC9)
Or, no response at all, then you set the flag to false (ie. that would be its default value) and don't send GMCP messages. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #42 on Sat 02 May 2020 04:53 AM (UTC) |
Message
| You will need to add telnet negotiation code to the place where the server receives incoming data from the client, if it isn't there already. It might be. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #43 on Sat 02 May 2020 04:54 AM (UTC) Amended on Sat 02 May 2020 04:59 AM (UTC) by Fiendish
|
Message
|
Quote: the ones using Gmud
should change clients for their own good. Gmud is not compliant with the telnet specification. Nobody should use it. Gmud will just ignore your attempts to negotiate per KaVir's comment in this thread: http://www.mudbytes.net/forum/comment/51717/ |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #44 on Sat 02 May 2020 05:05 AM (UTC) |
Message
| As per my suggestion though, if the client ignores the negotiation you can assume it doesn't support it. So you should really be waiting for "IAC DO GMCP" before sending GMCP stuff. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
191,522 views.
This is page 3, 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