BenDLeadbetter Posted April 23, 2018 Report Share Posted April 23, 2018 Hi everyone, Hoping someone can help me, bit of a noob with programming. I have gotten as far as a hello world sketch. Is there any example scripts anywhere? I have looked through the wiki and can see the functions etc but looking for the next part of the puzzle. Thanks for your help! Ben Quote Link to comment Share on other sites More sharing options...
airfighter Posted April 23, 2018 Report Share Posted April 23, 2018 1 hour ago, BenDLeadbetter said: Hi everyone, Hoping someone can help me, bit of a noob with programming. I have gotten as far as a hello world sketch. Is there any example scripts anywhere? I have looked through the wiki and can see the functions etc but looking for the next part of the puzzle. Thanks for your help! Ben Hi Ben, You should start from learning to programming in Lua. You need some good lua programming skills first and then start scripting. Otherwise, nothing will make sense. It will be like trying to write an essay in Chinese, without knowing Chinese! Check those links: https://www.lua.org/manual/5.3/ https://www.youtube.com/watch?v=iMacxZQMPXs After learning a bit of Lua, then you can check Gizmo API...it will make a lot more sense then. http://gizmo64.com/Gizmo64_API.htm Quote Link to comment Share on other sites More sharing options...
BenDLeadbetter Posted April 26, 2018 Author Report Share Posted April 26, 2018 On 23/04/2018 at 7:36 PM, airfighter said: Hi Ben, You should start from learning to programming in Lua. You need some good lua programming skills first and then start scripting. Otherwise, nothing will make sense. It will be like trying to write an essay in Chinese, without knowing Chinese! Check those links: https://www.lua.org/manual/5.3/ https://www.youtube.com/watch?v=iMacxZQMPXs After learning a bit of Lua, then you can check Gizmo API...it will make a lot more sense then. http://gizmo64.com/Gizmo64_API.htm Thanks for the tips, Sorry I should have clarified that I have been using lua with AirManager and FlyWithLua for a while to animate gauges and work with timers/buttons etc I guess my subconscious didn't register it as important information as I am self aware about how little I know, alot of the tasks I do with it are variations of what I have already done before I will take onboard your suggestion and focus on learning more about the language. Are there any example scripts I can try and digest to build my understanding? The thing that sparked my questions was trying some of the examples people had posted (which worked at the time of posting) and they either spat out errors or crashed xplane Quote Link to comment Share on other sites More sharing options...
airfighter Posted April 26, 2018 Report Share Posted April 26, 2018 OK then, some things you need to know about the structure needed. Gizmo scripts should live inside a folder called "script_src". You absolutely need an init.lua file. This is the file the Gizmo will look for and run. If you want to have separate files ie. for each system you can do that, as long as you indicate that in the init file using Lua common methods such as dofile "systems.lua" Also you need a main function that will run your stuff once per frame. Better try examples from the newer to the older. At a point was a switch to the way you call a dataref. If I'm not wrong the old way was xp.getDataref(...), while the new is dref.getDataref(...). Changing this might make them work. Quote Link to comment Share on other sites More sharing options...
BenDLeadbetter Posted April 27, 2018 Author Report Share Posted April 27, 2018 Great thanks for the pointers, I appreciate it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.