Jump to content

Starting with Gizmo


BenDLeadbetter
 Share

Recommended Posts

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

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...