Jump to content
BenDLeadbetter

Starting with Gizmo

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

×