Advertisement

Scripting and XML

Started by April 13, 2003 04:17 AM
4 comments, last by PhiberOptic 21 years, 4 months ago
Is it possible to use some sort of XML for simple scripts, such as navigation routes and stuff? (I''m not good at XML or any other new web/app things, so don''t diss me if this idea is totaly fucked up..)
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
XML is just a format for storing data, there are no limitations as to the type of data you can store. So yes, you could use XML to store scripting data, maybe something like this:


  <route from="spawn_point" to="health_pack">    <node x="3.0" y="1.9" z="12.0"></node>    <node x="4.0" y="7.2" z="12.0"></node></route>  


Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
Advertisement
Yes, Alan is right. Though you''ll be doing all the hard work yourself to interpret the XML data -- like writing all the scripting environment.

If you find yourself writing too much code to interpret this data, go for python or lua for example. I''d recommend them instead.


Artificial Intelligence Depot - Maybe it''s not all about graphics...

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

So there is no XML parser thingy in Visual Studio or something?
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
quote: Original post by PhiberOptic
So there is no XML parser thingy in Visual Studio or something?

There are all manner of free XML parsers that you can get your hands on, but what are you expecting them to do? You have said that you want to create a simple scripting environment, but XML is a data representation format, and does not have the semantics of a scripting language. To be able to script in XML you would have to design your own set of language primitives, assign XML representations for each primitive, and then design the grammatical rules for how to combine the primitives. An XML parser will not handle this for you - it will merely call back into your code when it hits the "edges" of the XML document. So, in effect, you would be designing your own scripting language from the ground-up, and it would be expressed within the loose rules of XML, which is a particularly ugly format for a programming language. Rather than going through all this effort, you would be more productive if you embedded an existing scripting language into your applications.
Okay... naa.. I was just askin if it''s possible. I don''t really have any clues how XML works...

I have written some minor parsers for particle scripts and even a simple AI scripter w/ variables and stuff.. it''s just that it''s so damn timeconsuming. And well.. I guess Lua and such things are the best way to do it..
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"

This topic is closed to new replies.

Advertisement