Freakyy Posted April 28, 2015 Share Posted April 28, 2015 (edited) GTALua - A Powerful Scripting Engine for GTA V in LuaCurrent Features NEW Timers NEW Events (OnPedCreated, OnVehicleCreated) NEW Object-Oriented Wrappers for natives (+ Documentation & lots of examples) NEW Flexible/Simple GUI-module All 5300 Natives accessible in Lua Console that contains error messages and has support for own commands Good Documentation to get you started with GTALua (Wiki & Tutorials & Examples) Load/Reload/Unload your scripts with a simple command in the console while ingame Intro movie skipper Planned Features Automatic Refresh (instead of current manual method) Script Database (maybe) Scripting DocumentationMake sure to check out the examples, you can find them in GTALua/addons/We also have a wiki, you can find a tutorial and other things there! Check it outNot convinced? Less code, same resultBoth scripts do exactly the same, but the left one is way easier and cleaner.MenusCheck out: gui.SimpleMenu ChangelogNEW Current Version: 1.1.0 (Alpha) Added Timers Added Events (OnPedCreated, OnVehicleCreated) Added ScriptThread:Tick Added lots of more wrappers for Blips & ui.CreateBlip Added gtalua.ini (contains configuration for console) Improved gui.SimpleMenu Improved error handling for ScriptThread:Run Fixed print Fixed Vector:Distance Fixed Entity:GetOffsetVector, Entity:SetVelocity (with Vector as parameter) Version: 1.1.0 (Alpha) Added (more than 80) Object-Oriented Wrappers for the natives (+ Documentation with lots examples) Added GUI module to easily create menus Added support for OUT-parameters Addons can now be loaded/unloaded at any time Script-Threads now run on one main thread (without blocking each other, using coroutines) Huge documentation with new tutorials & examples Check out the updated Tutorials! Getting StartedVersion: 1.0.1 (Alpha) Updated to work with 1.0.350.1/2 Removed leftover debug messages Updated native call layouts for animations (thanks gcWorld!) Note: With this update you'll have to overwrite dinput8! Version 1.0.0 (Alpha) Initial Version Supported Game Versions: Steam/Retail 1.0.335.2 InstallationDownloadClick here if you need further help! Or take a look at the Spoiler below.Support + Getting Started as Developer WikiThe wiki contains Tutorials and a useful Getting Started page!ExamplesYou can find several examples in GTALua/addons/IRCIf you have any questions, you can ask here or join the GTANet IRC!Host: irc.gtanet.comPort: 6667Just send me a message (Freaky) or join #gtalua or #gtamoddingHere / PMIf you have any questions, feel free to ask them here or via PM. Edited June 18, 2015 by TJGM Link2012, Aleph-Zero, GN 92 and 6 others 9 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/ Share on other sites More sharing options...
burnsyboo Posted April 28, 2015 Share Posted April 28, 2015 Nice release bro im going to test this out now Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067387815 Share on other sites More sharing options...
headscript Posted April 28, 2015 Share Posted April 28, 2015 GTALua - A Powerful Scripting Engine for GTA V in Lua Current Features All 5300 Natives accessible in Lua Console that contains error messages and has support for own commands Good Documentation to get you started with GTALua (Wiki & Tutorials & Examples) Reload your scripts with a simple command in the console while ingame Planned Features Automatic Refresh (instead of current manual method) Helper functions & classes for the natives Adding even more examples Drawing functions & library Script Database (maybe) Scripting Documentation Make sure to check out the examples, you can find them in GTALua/addons/ We also have a wiki, you can find a tutorial and other things there! Check it out Changelog Current Version: 1.0.0 (Alpha) Initial Version Supported Game Versions: Steam/Retail 1.0.335.2 Installation Download Click here if you need further help! Or take a look at the Spoiler below. Support + Getting Started as Developer Wiki The wiki contains Tutorials and a useful Getting Started page! Examples You can find several examples in GTALua/addons/ IRC If you have any questions, you can ask here or join the GTANet IRC! Host: irc.gtanet.com Port: 6667 Just send me a message (Freaky) or join #gtamodding Here / PM If you have any questions, feel free to ask them here or via PM. where is the benefit from yours compared to mine? Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067387860 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 (edited) where is the benefit from yours compared to mine? I have proper documentation (wiki, tutorial, examples), a much easier addons-system, each script has its own script thread so people are free to do what they want, my code is well-structured, documented and optimized (that's why my files aren't nearly 3mb). Also please do me a favour and remove the quote, it takes away loads of space. Edited April 28, 2015 by Freakyy burnsyboo and GN 92 2 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067387902 Share on other sites More sharing options...
Drkz Posted April 28, 2015 Share Posted April 28, 2015 (edited) Excellent. Though dumb question where can i find the model hash of peds and vehicles, things like that ? Reading through the example scripts, you call the models by hash, just wondering where i can find the said hash to spawn whatever i want. Thanks. Edited April 28, 2015 by Drkz Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067387971 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 (edited) Excellent. Though dumb question where can i find the model hash of peds and vehicles, things like that ? Not a dumb question at all They are everywhere around the internet. I will add a list of them on the Wiki later. Edited April 28, 2015 by Freakyy burnsyboo 1 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388015 Share on other sites More sharing options...
SgtDirtyMike Posted April 28, 2015 Share Posted April 28, 2015 I commend your work on this release, but you must agree it is redundant. The other solution is much simpler to use, and whilst it's true that it may not provide as much functionality, yours is more cluttered and less organized. No one cares about a few megabytes... Why not contact headscript first and suggest ideas instead of using his idea to make a more complicated release? Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388186 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 (edited) I commend your work on this release, but you must agree it is redundant. The other solution is much simpler to use, and whilst it's true that it may not provide as much functionality, yours is more cluttered and less organized. No one cares about a few megabytes... Why not contact headscript first and suggest ideas instead of using his idea to make a more complicated release? More cluttered and less organized? I appreciate the feedback, i really do, but that's not true. What are you referring to? I have a proper file structure with comments, an addon-system, in C++ I'm using classes and I also tried to port object-oriented-programming as good as possible over to Lua. The fact that you need to create your own script thread might be a complication, but it's 5-7 lines. It has the advantage that you are free to do what you want - you never conflict with other scripts, you don't block other scripts if you have an error, etc. And the fact that it's smaller is not even an important fact, it's the optimization and performance. By the way, if you want to be exact, the work on GTALua began before he released his - he was just the first to release Edited April 28, 2015 by Freakyy Link2012 and Glumok 2 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388245 Share on other sites More sharing options...
headscript Posted April 28, 2015 Share Posted April 28, 2015 And the fact that it's smaller is not even an important fact, it's the optimization and performance. show me your performance against mine im totally raw on the natives nothing blocking or changing everything is 100% direct http://pastebin.com/6zkg8Had Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388463 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 And the fact that it's smaller is not even an important fact, it's the optimization and performance. show me your performance against mine im totally raw on the natives nothing blocking or changing everything is 100% direct http://pastebin.com/6zkg8Had We have a totally different approach of calling natives. In my code, the arguments are pushed and the native called completely in Lua, whereas you registered a function for every native. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388496 Share on other sites More sharing options...
headscript Posted April 28, 2015 Share Posted April 28, 2015 And the fact that it's smaller is not even an important fact, it's the optimization and performance. show me your performance against mine im totally raw on the natives nothing blocking or changing everything is 100% direct http://pastebin.com/6zkg8Had We have a totally different approach of calling natives. In my code, the arguments are pushed and the native called completely in Lua, whereas you registered a function for every native. which is faster? you cant tell me that calling 1 + n(each variable which u push to natives) functions from lua to c++ is faster than one lua to c+ + Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388509 Share on other sites More sharing options...
n00854180t Posted April 28, 2015 Share Posted April 28, 2015 OP, I have a question for ya. I'd like to call GET_PED_NEARBY_PEDS, which takes an array pointer as a parameter. I tried passing a table, but it complained about wanting a "number" (pointer, of course). Do you know how I can call that function from Lua properly? Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388625 Share on other sites More sharing options...
Aleph-Zero Posted April 28, 2015 Share Posted April 28, 2015 Nice. Looks like you put some effort, but i hope you plan on abstracting the natives 'cause if not i don't see the point. (might as well be using the C++ hook directly) Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388672 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 (edited) which is faster? you cant tell me that calling 1 + n(each variable which u push to natives) functions from lua to c++ is faster than one lua to c+ + It might not be faster than your approach, but it is definetly more clean. The reason I have that method in the first place is because of the natives/native_call_layout.ini file - people are able to change the parameters there, add undocumented natives. However, I'll do some benchmarking to find some actual numbers. Edit: I just read through the last replies, people reported that they couldn't set the name plate correctly. In my case they would just have to edit the native_call_layou.ini, change the parameter type to string and then it would work. This is one of the main reasons why I chose this method. Maybe at a later point, when all natives have been analyzed, I will switch over. OP, I have a question for ya. I'd like to call GET_PED_NEARBY_PEDS, which takes an array pointer as a parameter. I tried passing a table, but it complained about wanting a "number" (pointer, of course). Do you know how I can call that function from Lua properly? It's not possible, I'll add this ASAP. Nice. Looks like you put some effort, but i hope you plan on abstracting the natives 'cause if not i don't see the point. (might as well be using the C++ hook directly) Thank you. You're absolutely right. It's exactly what I'm planning. Although one advantage over the C version is that you don't have to restart your game Edited April 28, 2015 by Freakyy Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388690 Share on other sites More sharing options...
V7X3 Posted April 28, 2015 Share Posted April 28, 2015 (edited) More isn't always better, buuuuuuuut, people who wanna go "balls-deep" in messing about w/ Lua should definitely check this out. Otherwise, the version headscript released suffices just fine. Nonetheless, nice release OP, looks like a fair amount of effort was put forth into this, so... kudos there. Edited April 28, 2015 by V7X3 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388783 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 More isn't always better, buuuuuuuut, people who wanna go "balls-deep" in messing about w/ Lua should definitely check this out. Otherwise, the version headscript released suffices just fine. Nonetheless, nice release OP, looks like a fair amount of effort was put forth into this, so... kudos there. Thanks for the feedback! But more means more possibilities V7X3 1 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388826 Share on other sites More sharing options...
n00854180t Posted April 28, 2015 Share Posted April 28, 2015 @Freakyy, dang, thought as much. I'm excited to see the next version with these types of functions working. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067388867 Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Author Share Posted April 28, 2015 The next version will include the following changes: KEY_ constants (like KEY_F9 for example) Support for OUT-values (like arrays) Minor bug fixes and code cleanup The most exciting new feature will be the wrappers, here is a quick example: (do not try to use this on the current version) streaming.RequestAndWaitForModel("cs_priest")local bodyguard = game.CreatePed("cs_priest", LocalPlayer():GetPosition())bodyguard:AllowWeaponSwitching()bodyguard:DelayedGiveWeapon("WEAPON_PISTOL") Any suggestions or wishes for the next update? Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067389491 Share on other sites More sharing options...
n00854180t Posted April 28, 2015 Share Posted April 28, 2015 (edited) Awesome updates there! One other request I have is support for controller key constants and/or a wrapper for doing controller key presses. I know there's functionality for detecting gamepad presses in the natives, but the button codes aren't obvious. Edited April 28, 2015 by n00854180t Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067389635 Share on other sites More sharing options...
Freakyy Posted April 29, 2015 Author Share Posted April 29, 2015 Awesome updates there! One other request I have is support for controller key constants and/or a wrapper for doing controller key presses. I know there's functionality for detecting gamepad presses in the natives, but the button codes aren't obvious. Added to my To-Do List! Thanks for the suggestion. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067390851 Share on other sites More sharing options...
alexslx Posted April 29, 2015 Share Posted April 29, 2015 (edited) Awesome updates there! One other request I have is support for controller key constants and/or a wrapper for doing controller key presses. I know there's functionality for detecting gamepad presses in the natives, but the button codes aren't obvious. Added to my To-Do List! Thanks for the suggestion. My suggestion is to keep the names of warped methods similar to .NET or C++ framework as much as possible and with a readable form. Regards, Edited April 29, 2015 by alexslx Freakyy 1 Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067390965 Share on other sites More sharing options...
Loset Posted April 29, 2015 Share Posted April 29, 2015 can you guys give me a good example? example_addon = ScriptThread("example_addon_script_thread")example_addon:Register()function example_addon:Run()while self:IsRunning() do-- Set time-- 08:00:00natives.TIME.SET_CLOCK_TIME(8, 0, 0)-- Waitself:Wait(50)endend this is what I understand from the example in the tutorial but I am not sure its 100% accurate? Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067391015 Share on other sites More sharing options...
Ivey Posted April 29, 2015 Share Posted April 29, 2015 ivy_bodyguard = ScriptThread("ivy_bodyguard") function ivy_bodyguard:Run() print("test") while self:IsRunning() do if IsKeyDown(0x78) then print("test2") end self:Wait(50) endendfunction ivy_bodyguard:OnError() print("Oh no! Example Thread caused an error!") self:Reset()end ivy_bodyguard:Register() Literally cannot get this to register the second "test2" in the console. I don't know if key presses are broken... it just does not work for me. Maybe you have some information on the subject. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067391056 Share on other sites More sharing options...
Pixelazed Posted April 29, 2015 Share Posted April 29, 2015 ivy_bodyguard = ScriptThread("ivy_bodyguard") function ivy_bodyguard:Run() print("test") while self:IsRunning() do if IsKeyDown(0x78) then print("test2") end self:Wait(50) endendfunction ivy_bodyguard:OnError() print("Oh no! Example Thread caused an error!") self:Reset()end ivy_bodyguard:Register() Literally cannot get this to register the second "test2" in the console. I don't know if key presses are broken... it just does not work for me. Maybe you have some information on the subject. I cannot get it register any keypresses either. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067391589 Share on other sites More sharing options...
alexslx Posted April 29, 2015 Share Posted April 29, 2015 I've sent you a commit with my vehicle const list, just to save you a bit of work. Also, as a suggestion, I think you should follow a standard documentation format such as javadoc (even it is made to use with java, I worked with a huge amount of project using it for other languages). In addition, don't let to document after (You'll never do it), and commenting the code will make easier to run a doc gen tool and generate a pretty api or docs page. Regards, Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067391696 Share on other sites More sharing options...
Cylonsurfer Posted April 29, 2015 Share Posted April 29, 2015 So I'm trying to create a script to move various parts of the HUD so they are usable in VR. I assume I need to use SET_HUD_COMPONENT_POSITION but all I get returned in the console window is: SET_HUD_COMPONENT_POSITION(a nil value) Could someone give me an example of where I'm going wrong? I want to start by moving the radar for example. This is what I tried - and it's clearly wrong. example_addon = ScriptThread("example_addon_script_thread")function example_addon:Run() while self:IsRunning() do SET_HUD_COMPONENT_POSITION(RADAR, 1.0, 1.0) endendexample_addon:Register() Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067391988 Share on other sites More sharing options...
Freakyy Posted April 29, 2015 Author Share Posted April 29, 2015 can you guys give me a good example? example_addon = ScriptThread("example_addon_script_thread")example_addon:Register()function example_addon:Run()while self:IsRunning() do-- Set time-- 08:00:00natives.TIME.SET_CLOCK_TIME(8, 0, 0)-- Waitself:Wait(50)endend this is what I understand from the example in the tutorial but I am not sure its 100% accurate? You forgot to register the thread. Put example_addon:Register() at the end of the file. ivy_bodyguard = ScriptThread("ivy_bodyguard") function ivy_bodyguard:Run() print("test") while self:IsRunning() do if IsKeyDown(0x78) then print("test2") end self:Wait(50) endendfunction ivy_bodyguard:OnError() print("Oh no! Example Thread caused an error!") self:Reset()end ivy_bodyguard:Register() Literally cannot get this to register the second "test2" in the console. I don't know if key presses are broken... it just does not work for me. Maybe you have some information on the subject. I cannot get it register any keypresses either. Okay, I will look into this. Could you post your code too? Or join IRC / send me a PM? I've sent you a commit with my vehicle const list, just to save you a bit of work. Also, as a suggestion, I think you should follow a standard documentation format such as javadoc (even it is made to use with java, I worked with a huge amount of project using it for other languages). In addition, don't let to document after (You'll never do it), and commenting the code will make easier to run a doc gen tool and generate a pretty api or docs page. Regards, I already wrote it in the comment on Github, but thanks a lot men! I really appreciate the help, I will merge the commit later today. (I'm also glad you followed my "style" like with the KEY_ consts) That's a good idea, you know any specific ones for Lua? So I'm trying to create a script to move various parts of the HUD so they are usable in VR. I assume I need to use SET_HUD_COMPONENT_POSITION but all I get returned in the console window is: SET_HUD_COMPONENT_POSITION(a nil value) Could someone give me an example of where I'm going wrong? I want to start by moving the radar for example. This is what I tried - and it's clearly wrong. example_addon = ScriptThread("example_addon_script_thread") function example_addon:Run() while self:IsRunning() do SET_HUD_COMPONENT_POSITION(RADAR, 1.0, 1.0) end end example_addon:Register() I responded to your PM with the solution Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067392125 Share on other sites More sharing options...
alexslx Posted April 29, 2015 Share Posted April 29, 2015 -snip- I was talking about the C++ code documentation, which I think should be using javadoc format. For lua, I think this is a good format: http://keplerproject.github.io/luadoc/manual.html#howto Regards, Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067392743 Share on other sites More sharing options...
Freakyy Posted April 29, 2015 Author Share Posted April 29, 2015 @alexslx Thanks, but do I need a C++ documentation ?I'm not planning to add binary plugins any time soon. Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067392778 Share on other sites More sharing options...
SirGoodSmoke Posted April 29, 2015 Share Posted April 29, 2015 (edited) Great work with this. Have an issue tho not sure if its me, I can't seem to execute scripts that are loaded after the first script. Example: Using bothing your example scripts, If both of them load I can only execute the one that loaded first. Hope this makes sense In the console it will show that both scripts have registered but only the first registered script will allow me to execute it Edited April 29, 2015 by SirGoodSmoke Link to comment https://gtaforums.com/topic/790179-gtalua-script-engine-in-lua/#findComment-1067392821 Share on other sites More sharing options...
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