GMCP in Aardwolf MUD using CMUD.
GMCP in CMUD
Cmud support for GMCP is available in Cmud 3.22 beta and higher. GMCP comes enabled by default in CMUD. To set high level GMCP modules supported, enter the 'protocols' section of 'preferences' and add/remove items as necessary in the "supported packages" window. Each of the options is included below. For most users, we recommend leaving the defaults enabled and adding a "Debug 1" option.
CMUD - room.info trigger
A sample script to access/print room data in CMUD is:
#PRINT GMCP.room: %gmcp.room #PRINT GMCP.room.exits: %gmcp.room.info.exits #PRINT GMCP.room.exits.n: %gmcp.room.info.exits.n #PRINT Continent: %gmcp.room.info.coord.id #PRINT -----------------------------------------------
Which produces:
GMCP.room: info="num=16542|brief=A Quiet Section of the Swamp|zone=fens|sector=forest|flags|exits=""n=16543|s=16545|w=16541""|coord=""id=2|x=5|y=33""" GMCP.room.exits: n=16543|s=16545|w=16541 GMCP.room.exits.n: 16543 Continent: 2
CMUD - char.vitals.health trigger
The trigger below is a simple example to show data available in CMUD when GMCP messages are received. Whenever the player health changes, a GMCP message is sent to the client. The trigger is on a change in char.vitals.health:
The full code for this trigger is:
execwin stats { #clr } #win stats {%ansi(high, white) --------------- Stats for %gmcp.char.base.name -------------------%cr} #win stats {%ansi(high, green)Class : %ansi(high, white)%gmcp.char.base.class %ansi(high, green)Subclass: %ansi(high, white)%gmcp.char.base.subclass} #win stats {%ansi(high, green)Race : %ansi(high, white)%gmcp.char.base.race %ansi(high, green)Clan : %ansi(high, white)%gmcp.char.base.clan} #win stats {%cr%ansi(high, cyan)Strength : %ansi(high, green)%gmcp.char.stats.str%ansi(high, white) / %ansi(high, green)%gmcp.char.maxstats.maxstr %ansi(high, cyan)Health : %ansi(high, green) %gmcp.char.vitals.hp%ansi(high, white) / %ansi(high, green)%gmcp.char.maxstats.maxhp } #win stats {%ansi(high, cyan)Intelligence : %ansi(high, green)%gmcp.char.stats.int%ansi(high, white) / %ansi(high, green) %gmcp.char.maxstats.maxint %ansi(high, cyan)Mana : %ansi(high, green)%gmcp.char.vitals.mana%ansi(high, white) / %ansi(high, green)%gmcp.char.maxstats.maxmana } #win stats {%ansi(high, cyan)Wisdom : %ansi(high, green)%gmcp.char.stats.wis%ansi(high, white) / %ansi(high, green) %gmcp.char.maxstats.maxwis %ansi(high, cyan) Moves : %ansi(high, green) %gmcp.char.vitals.moves%ansi(high, white) / %ansi(high, green)%gmcp.char.maxstats.maxmoves } #win stats {%ansi(high, cyan)Dexterity : %ansi(high, green)%gmcp.char.stats.dex%ansi(high, white) %ansi(high, white) / %ansi(high, green)%gmcp.char.maxstats.maxdex} #win stats {%ansi(high, cyan)Constitution : %ansi(high, green)%gmcp.char.stats.con%ansi(high, white) / %ansi(high, green) %gmcp.char.maxstats.maxcon %ansi(high, cyan) Hitroll: %ansi(high, green)%gmcp.char.stats.hr } #win stats {%ansi(high, cyan)Luck : %ansi(high, green)%gmcp.char.stats.luck%ansi(high, white) / %ansi(high, green) %gmcp.char.maxstats.maxluck %ansi(high, cyan)Damroll: %ansi(high, green) %gmcp.char.stats.dr } #win stats {%cr%ansi(high, cyan)Exp To Level : %ansi(high, green)%gmcp.char.status.tnl %ansi(high, cyan)Level : %ansi(high, green)%gmcp.char.status.level} #win stats {%ansi(high, cyan)Alignment : %ansi(high, yellow)%gmcp.char.status.align %ansi(high, cyan)Gold : %ansi(high, yellow)%gmcp.char.worth.gold} #win stats {%cr%ansi(high, red)Fighting : %gmcp.char.status.enemy%cr%ansi(high, green)E nemy Health : %gmcp.char.status.enemypct}
Sample output from this trigger is:
Disclaimer - there are probably better ways to present and format this data. For example, the formatting will completely break once someone with a different class or race uses it. The point of this trigger is to demonstrate how easy it is to get at the GMCP data. Someone else can make it pretty.
Advanced Version-The version below will update status, and keep formatting "pretty" no matter what stats you have/class/align/ ect.
advanced version(approve sites)