This is in response to F_Smith's suggestion to use XML in the macros.
I haven't followed Clash's development for some time, so this may be completely redundant. Any pointers to previous discussions/definitions of the macro language will be appreciated.
I've been experimenting with an XML-based app for a few weeks, and I've become convinced that XML is quite useful for data.
But I'm not convinced yet that I'd like to use it for a macro language, or rather: I'm not so sure if I'd like to actually write anything in that language.
Anyway, I like the idea from a "cool, let's see if it works"-perspective, and I couldn't stop myself from brewing up a few examples of what I imagine an XML-based macro language to look like
(Sorry, no DTDs or implementation details for these examples)
Is the above example intuitive? ugly?
Procedures with conditionals, loops, and such may be a bit more complicated. I'm not satisfied at all with the below attempt.
I haven't followed Clash's development for some time, so this may be completely redundant. Any pointers to previous discussions/definitions of the macro language will be appreciated.
I've been experimenting with an XML-based app for a few weeks, and I've become convinced that XML is quite useful for data.
But I'm not convinced yet that I'd like to use it for a macro language, or rather: I'm not so sure if I'd like to actually write anything in that language.
Anyway, I like the idea from a "cool, let's see if it works"-perspective, and I couldn't stop myself from brewing up a few examples of what I imagine an XML-based macro language to look like
(Sorry, no DTDs or implementation details for these examples)
<!--
This event will create the Angry Mothers civ in 20,30 and give the
Nasty Evil Buggers 1000 monetary units and the Evil Empire tech
if the Nasty Evil Buggers conquer the Really Important Province
before 1230 OR if the Annoyingly Good Guys are destroyed before that same year
-->
<event type="one-shot" >
<cause>
<any>
<province-conquered>
<province>Really Important Province</province>
<conqueror>Nasty Evil Buggers</conqueror>
<turn comparator="<" >1230</turn>
</province-conquered>
<civ-destroyed>
<civ>Annoyingly Good Guys</civ>
<turn comparator="<" >1230</turn>
</civ-destroyed>
</any>
</cause>
<effects>
<create-civ>
<name>Angry Mothers</name>
<population>100</population>
<location>20,30</location>
<otherParam>Blah blah</otherParam>
</create-civ>
<give-to-civ>
<civ>Nasty Evil Buggers</civ>
<gift>
<money>1000</money>
<tech>Evil Empire</tech>
</gift>
</give-to-civ>
</effects>
</event>
Is the above example intuitive? ugly?
Procedures with conditionals, loops, and such may be a bit more complicated. I'm not satisfied at all with the below attempt.
<!--
This procedure will show a "You are really poor" message to all players of
civilizations that have less than 100 monetary units or less than 2 cities and
the turn is year 1900.
-->
<procedure name="my-procedure" >
<for>
<range variable="aCiv">
<get>civilizations</get>
</range>
<do>
<if>
<condition>
<all>
<turn>1900</turn>
<any>
<has>
<civ><variable>aCiv</variable></civ>
<money comparator="<">100</money>
</has>
<has>
<civ><variable>aCiv</variable></civ>
<cities comparator="<">2</cities>
</has>
</any>
</all>
</condition>
<then>
<popup-message>
<civ><variable>aCiv</variable></civ>
<text>You are really poor!</text>
</popup-message>
</then>
</if>
</do>
</for>
</procedure>
Martin
[This message has been edited by mca (edited September 02, 1999).]
Comment