riderj Posted January 25, 2016 Share Posted January 25, 2016 Since the wiki is horribly written I am coming here to ask if anyone has found any tutorials that are above average. Unlike the wiki I would like to have tutorials that explain what the syntax is achieving, and going into depth with each and every step. Some topics that I would like to know about include: Basic/Advanced Meta.xml Lecture on exports Lecture on updated programming practices for the api (such as mysql using dbConnect instead of the module) Expansion on advanced/intermediate/basic techniques for event triggers, and what to be careful of. In-depth guide of how ACL works Link to comment
Bonsai Posted January 25, 2016 Share Posted January 25, 2016 The wiki is pretty good in my opinion. You might be using it wrong Also there is this forum where you can ask for help or use the search. Link to comment
riderj Posted January 25, 2016 Author Share Posted January 25, 2016 The wiki is great if you want to lookup things about each topic, but learning from scratch with no prior experience with the API makes the wiki a lame place to learn the API. I like the way it's setup, but the writing doesn't go into much detail on certain topics like events, the fact that you can call a function in a different lua file in the resource. I encountered the last point earlier today when I was messing with a resource, but I don't know if it's a default feature or if something enables you to call functions across the resource. Link to comment
ALw7sH Posted January 25, 2016 Share Posted January 25, 2016 https://forum.multitheftauto.com/viewforum.php?f=148 Link to comment
riderj Posted January 25, 2016 Author Share Posted January 25, 2016 Thanks for the sarcastic reply, but too bad those 106 topics go over one topic many times. That topic would be basic lua, and adding support for notepad++. I've read the topics I was interested int, and am looking for a more external source such as a github or website dedicated to learning. I also am looking for a good resource to study and learn from, currently I am studying an RP resource, but the coding in it is sloppy. Since this topic is going nowhere so far I will recycle this thread for another question: What in the MTA API allows lua to call functions in a different file without requiring the file? Is there a specific setting that needs to be enabled in the meta.xml to achieve this or is it default? Link to comment
Noki Posted January 25, 2016 Share Posted January 25, 2016 In the resource you want to call, you need to append a line to the meta.xml file. Like this: <export function="functionName" type="server"/> Valid types are: client, server and shared. You may call that function from another resource using the call function: exports.resourceName:functionName(arguments) Granted that if you're calling a server sided function, the script you're calling it from must be declared shared or server under type in the meta.xml file. The same principle applies to client. Link to comment
riderj Posted January 25, 2016 Author Share Posted January 25, 2016 @Noki See I thought that this was the only way of sharing functions through the resource and is the reason I am confused. The current resource that I'm messing with, I can create a function inside a separate file that is not declared neither server nor client by the meta.xml, and call the same function from a different file within the resource. I do not see any lines that would enable this unless it's embedded within another resources export. Link to comment
tosfera Posted January 25, 2016 Share Posted January 25, 2016 If it is the same resource, you don't have to export nor addEvents for it to call them. you can cross the borders of files IF the types are the same ( server to server, client to client ). As an example; file1: function book() outputChatBox("Ha! you said book!"); end file2: function readBook() outputChatBox ( "I'm going to say book..." ); book(); end That'll work. Exporting a function is sharing functions over the entire server, no matter which resource it is coming from. Link to comment
Dealman Posted January 25, 2016 Share Posted January 25, 2016 If you want to learn scripting and/or programming you'll need to face the fact that it requires patience upon more patience. Essentially it's all about trial and error, there's no easy way around it so don't expect it to be handed to you on a silver platter. The MTA Wiki is particularly well written, in fact, it's quite possibly the most detailed documentation of an API I have seen thus far. Not only does it thoroughly explain what each function does, it tells you exactly what arguments it needs - what kind they need to be and if there are any optional arguments. It tells you what it returns and more often than not have at least one example on how to use it properly. Now it's true that the MTA Wiki doesn't really have all too many tutorials, and it shouldn't. We already have a whole forum dedicated to tutorials so I'd suggest you check those out instead. If you can't take the time to sit down, do some reading and testing - then I'd say scripting is probably not your kind of cake. A good place to start would be general Lua tutorials on Google, you can use a website such as repl.it to play around with a whole plethora of stuff. For example multi-dimensional arrays, how to manipulate them and output specific values and yadda yadda. Link to comment
riderj Posted January 26, 2016 Author Share Posted January 26, 2016 @Dealman Thanks for trying to show up and act like I'm new to this, but I've been in the game for over eight years. I have particularly worked with Lua for six out of those eight years. I have done programming for WoW, Roblox, and stand alone applications/games that I had written myself. I also have my bachelors in computer science to make the point even more clear. If you believe this wiki is well documented, than this must be the only wiki you've ever looked at. I agree the functions are slightly better looking, but it's still leaves a ton of information out of them for people starting out with the API like myself. None of the event handling pages talk about the discrepancies with switching information between client and server. Another example would be the terribly written introduction to scripting article. This article may go over how to find your resources and immediately create a script, but it leaves you asking questions such as: "What can I do with this API that Lua doesn't do by default?". The prime example would be my question above, I noticed that you could access functions across similar scripts without requiring the file in the script you want to access that function from. Main point is: The introductory articles should be more detailed and talk about every part of the API that categorizes as Basic/Intermediate. When I'm trying to learn a new API I like it to be well documented, especially if I lack the access to figure out how it works. Regarding the forum board for tutorials: There are 106 tutorials total, of these tutorials 12 are about basic lua, 3 are about IDE's and 91 are about MTA in some way shape or form, but go over specific topics such as PHP integration, creating simple foums, MTA:SQL, etc. There were roughly 3 beginner tutorial video series, and one of which is poorly recorded and hard to follow. So official tutorials on the wiki are better than the tutorials we currently have here on the forum. Link to comment
Bonsai Posted January 26, 2016 Share Posted January 26, 2016 I feel like you are trolling. Kinda regret answering at all. MTA doesn't have that much players and even less that care about scripting and such stuff. And from the few that do, only a very small part is above beginner level. So who is gonna do all the stuff you request? You are free to improve the wiki until it meets your standards. Link to comment
Dealman Posted January 26, 2016 Share Posted January 26, 2016 If you feel that I somehow decreased the size of your e-penis then I am truly sorry, it was not my intention. If you've "been with the game for over eight years" surely you would know the very basics of client and server communication, the standard is for the most part the same across all games. Let alone, be able to figure it out by simply looking at 2 functions. The scripting introduction is not there to learn you how to make entire roleplay gamemodes with all the needed features ready in a copy and paste format. It's there to give you the basic idea of how to create and manage your own resources. If the tutorials available doesn't hold you hand then too bad, welcome to reality. Everything isn't readily served on a silver platter for you. If you want to learn it, then sit your ass down and do some research. Don't come here acting all high and mighty demanding that X should be like this and Y should be like that. On top of that, since this is MTA you'll quickly realize that the majority of users are fairly young and as such are not necessarily experienced enough to make advanced and descriptive tutorials for spoiled brats like yourself(that said, there are some very talented individuals here despite their young age). Then also add to the fact that making scripts for games such as MTA, World of Warcraft and Roblox is about as easy as it gets. The APIs are written in such a way they are foolproof, so even people who haven't got the slightest idea of how scripting works will be able to get in. So instead of coming here being all disrespectful and making demands, sit down and do some research like everyone else. If there's something you're confused about, the people on these forums are usually very helpful. Or like previously mentioned, if it's not good enough for you - then by all means contribute to the Wiki, after all that's what a Wiki is for isn't it? Link to comment
knightscript Posted January 26, 2016 Share Posted January 26, 2016 I don´t want to fight or anything, but @Dealman is right, i know some other programming languages like PHP, and adapting to LUA has been pretty easy, I have even scripted around 90% of my server on my own, and in my opinion, the MTA Wiki is pretty well documented, but the Wiki wont give you exactly what you want, you have to adapt the code, lets say the wiki gives you the base. Also if you have questions, there is not 1 question I have made on the forum that hasn´t been answered and ended on success!. I wish you luck! (and myself too haha). 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