Borov Posted April 4, 2008 Share Posted April 4, 2008 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
Morelli Posted April 4, 2008 Share Posted April 4, 2008 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
Borov Posted April 4, 2008 Author Share Posted April 4, 2008 thanks. so if there's error, it'll be displayed when the server starts, right? Link to comment
Morelli Posted April 4, 2008 Share Posted April 4, 2008 (edited) thanks. so if there's error, it'll be displayed when the server starts, right? Correct. It'll be displayed in the window of the MTA server.exe An example error would look something like this: Edited April 4, 2008 by Guest Link to comment
lil Toady Posted April 4, 2008 Share Posted April 4, 2008 Errors will be displayed in the server window or right in game if you type (debugscript 3) in console. You do not need to compile the as they are precompiled right in the server Link to comment
Borov Posted April 4, 2008 Author Share Posted April 4, 2008 thanks. I saw morelli said I can use lua or xml, are they just interchangable? like you can either write the entire game in lua or xml, or is xml only for certain configurations? Link to comment
Cazomino05 Posted April 4, 2008 Share Posted April 4, 2008 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
Stevvo Posted April 4, 2008 Share Posted April 4, 2008 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. Link to comment
Borov Posted April 4, 2008 Author Share Posted April 4, 2008 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
Borov Posted April 5, 2008 Author Share Posted April 5, 2008 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
Stevvo Posted April 5, 2008 Share Posted April 5, 2008 Yes, you must list every lua file you use in your script in the meta.xml file. If you need more help regarding to scripting you will probably be able to find what your looking for either somewhere on the scripting wiki, or in the lua manual (http://www.lua.org/pil/index.html) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now