<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[深入浅出制作全自动Mud机器人-条件指令]]></title><description><![CDATA[<p dir="auto">条件指令解决的是复杂Mud配置的问题。</p>
<p dir="auto">Mud全自动机器人本质是一个典型的后台服务，和后台服务器一样，配置基本是多个纯文(变量)本来进行的。</p>
<p dir="auto">同时，由于一般的Mud客户端的变量设置都没有语法支持，基本就是纯纯文本。所以会需要一个易写易读的配置格式。</p>
<p dir="auto">这种情况下，我引入了条件指令的格式。</p>
<p dir="auto"><a href="https://github.com/hellclient-scripts/newhelljs/blob/main/script/helllibjs/conditions/action.js" target="_blank" rel="noopener noreferrer nofollow ugc">代码连接</a></p>
<p dir="auto">具体格式为</p>
<pre><code>条件1 条件参数1,!条件2&gt;#指令.参数 数据
</code></pre>
<p dir="auto">逗号分隔多个条件,前置感叹号代表取反，必须所有条件都符合。</p>
<p dir="auto">指令参数数据看具体的实现，先不深入。</p>
<p dir="auto">具体使用什么条件，就是从上往下依次读，看条件匹配，匹配了，就执行，不继续执行(特殊配置可能继续匹配)。</p>
<p dir="auto">不匹配看下一条。</p>
<p dir="auto">这样人脑比较好解读。</p>
<p dir="auto">同时，为了避免过于复杂的场合难以解读，还引入了可选的分组的概念</p>
<pre><code>分组1:条件1 条件参数1,!条件2&gt;#指令.参数 数据
</code></pre>
<p dir="auto">这样能直观的进行组别判断。</p>
<p dir="auto">以我最复杂的战斗设置为例</p>
<p dir="auto">大概是这么个画风</p>
<pre><code class="language-text">#before #wpon;yun recover;
#start yong cuff.jingang;perform unarmed.chang1;perform finger.chao and strike.qimen
yun recover
perform finger.chao and strike.qimen

#block 秦岭
ctype qinling&gt;#apply
#before yun recover;$wpon;summon xiao;unwield xiao
#start yong cuff.jingang;wield xiao;perform sword.feilong qin and finger.ding qin;get xiao;unwield xiao
wield xiao;perform sword.feilong qin and finger.ding qin;get xiao;unwield xiao
</code></pre>
<p dir="auto"><em>注意，这里还引入了block区块的概念</em></p>
<p dir="auto">条件本身是有一个全局注册的</p>
<p dir="auto">大概代码为</p>
<pre><code class="language-javascript">    //注册maxexp 条件
    App.Quests.Conditions.RegisterMatcher(App.Quests.Conditions.NewMatcher("maxexp", function (data, target) {
        return App.Data.Player.HP["经验"] &lt;= (data - 0)
    }))
    //注册yueli 条件
    App.Quests.Conditions.RegisterMatcher(App.Quests.Conditions.NewMatcher("yueli", function (data, target) {
        return App.Data.Player.Score["阅历"] &gt;= (data - 0)
    }))
    //注册pot 条件
    App.Quests.Conditions.RegisterMatcher(App.Quests.Conditions.NewMatcher("pot", function (data, target) {
        return App.Data.Player.HP["潜能"] &gt;= (data - 0)
    }))
    //注册quest 条件
    App.Quests.Conditions.RegisterMatcher(App.Quests.Conditions.NewMatcher("quest", function (data, target) {
        let rq = App.Quests.Running
        return rq &amp;&amp; rq.ID == data
    }))
</code></pre>
]]></description><link>https://forum.hellclient.com/topic/21/深入浅出制作全自动mud机器人-条件指令</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 22:41:15 GMT</lastBuildDate><atom:link href="https://forum.hellclient.com/topic/21.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jan 2026 08:35:06 GMT</pubDate><ttl>60</ttl></channel></rss>