Jump to content

How does the scripts work


Borov

Recommended Posts

ok so this is a question about how the entire MTA DM is structured. I need to understand it in order to learn the scripting... please

Lua is like java, the program is compiled into something like bytecode and then run by a virtual machine. So, is MTA DM's server program the virtual machine? When does the lua script get compiled into bytecode? From the tutorials it seems like all the scripts are going to be packed into zip files, does the server compile it when it starts?

Thanks

Link to comment

Scripts are organised as 'resources'. Resources can be run by the program MTA server.exe, by typing 'start [resource name]'.

For a resource to work it needs a few things:

  • A working code written in Lua (or XML)
  • A meta.xml file that points to all the files that will be used
  • All of the files placed in either an unpassworded WinZip file or a folder (either will work)
  • To be located in the following subfolder:
    MTA\server\mods\deathmatch\resource\

The files are read by the server when it starts and there is no need for you to compile them.

For more information, read the Scripting Introduction, on the MTA wiki.

Link to comment

map files use xml syntax and can be used for configuration of scripts but that configuration has to be read by the lua file (apart from map files which are mostly parsed by the server) also the meta files which tell the server what goes where are xml

Link to comment
You might want to read this:

http://www.development.mtasa.com/index. ... troduction

It is a good tutorial for getting started scripting.

You cannot script in XML as XML is not a scripting language, however it is used for many things in MTA such as defining what scripts are used in the meta.xml and player accounts, basically xml files are used for storing data relating to your scripts.

lol I read that (partially at least), just wanted something more like technical reference than, you know, "do this and this and poof COOL!"

Link to comment

Got another question... since the order of execution matters, when I want to organize code into several .lua files, in order to make the order correct, I have to list them accordingly in the meta.xml file, right?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...