Skip to content

Instantly share code, notes, and snippets.

@lostsnow
Last active October 30, 2019 10:50
Show Gist options
  • Save lostsnow/179edc8e36cd50f31f40c41dea1a0303 to your computer and use it in GitHub Desktop.
Save lostsnow/179edc8e36cd50f31f40c41dea1a0303 to your computer and use it in GitHub Desktop.
#include <ansi.h>
# https://www.zuggsoft.com/zmud/mxp.htm
#define MXP_OPEN_TAG CSI"0z"
#define MXP_SEC_TAG CSI"1z"
#define MXP_LOCK_TAG CSI"2z"
#define MXP_RESET_TAG CSI"3z"
#define MXP_LSEC_TAG CSI"6z"
string mxp_room(string name, string desc, string* exits) {
string room;
int i, total;
room = MXP_LSEC_TAG;
room += @LONG
<!-- Elements to support the Automapper -->
<!ELEMENT RName '<FONT COLOR=Red><B>' FLAG="RoomName">
<!ELEMENT RDesc FLAG='RoomDesc'>
<!ELEMENT RExits '<FONT COLOR=Gray>' FLAG='RoomExit'>
<!-- The next element is used to define a room exit link that sends -->
<!-- the exit direction to the MUD if the user clicks on it -->
<!ELEMENT Ex '<SEND>'>
<!ELEMENT Chat '<FONT COLOR=Gray>' OPEN>
<!ELEMENT Gossip '<FONT COLOR=Cyan>' OPEN>
<!-- in addition to standard HTML Color specifications, you can use -->
<!-- color attribute names such as blink -->
<!ELEMENT ImmChan '<FONT COLOR=Red,Blink>'>
<!ELEMENT Auction '<FONT COLOR=Purple>' OPEN>
<!ELEMENT Group '<FONT COLOR=Blue>' OPEN>
<!-- the next elements deal with the MUD prompt -->
<!ELEMENT Prompt '<FONT COLOR=Purple>' FLAG="Prompt">
<!ELEMENT Hp FLAG="Set hp">
<!ELEMENT MaxHp FLAG="Set maxhp">
<!ELEMENT Mana FLAG="Set mana">
<!ELEMENT MaxMana FLAG="Set maxmana">
<!ENTITY test_entity test123 PUBLISH>
LONG;
room += "<RName>" + HIM + name + NOR + "</RName>\n";
room += desc;
room += "<RExits>这里明显的出口是:";
total = sizeof(exits);
for (i = 0; i < total; i++)
{
room += "<Ex>" + HIC + exits[i] + NOR + "</Ex>";
if (i < total - 2) {
room += "、";
} else if (i == total - 2) {
room += " 和 ";
} else {
room += "。</RExits>\n\n";
}
}
room += "<Prompt>[<Hp>100</Hp>/<MaxHp>120</MaxHp>hp <Mana>50</Mana>/<MaxMana>55</MaxMana>mana]</Prompt>\n";
room += MXP_RESET_TAG;
return trans_color(room, 2);
}
int main(object me, string arg)
{
string name = "客店";
string desc = @LONG
<RDesc> 这是一家价钱低廉的客栈,生意却是非常兴隆。外地游客
多选择这里落脚,你可以在这里打听到各地的风土人情。店小
二里里外外忙得团团转,接待着南腔北调的客人。客店的主人
从不露面,他究竟是谁,有各种各样的猜测。客店的西墙上挂
着一个牌子(<send "look &text;">$HIY$paizi$NOR$</send>)。
</RDesc>
LONG;
string *exits = ({"south", "west", "up"});
string room = mxp_room(name, desc, exits);
write(room);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment