Jump to content
cw777

Where do I start in Gizmo?

Recommended Posts

Hello everyone, 


 I myself am a computer programmer but only in the past week needed to do something in X-Plane. So, I looked into Gizmo, installed it, checked out its docs, it looks great. Except for one thing, where do you actually start? Where does a lua script go in order to run? On the topic of actually getting started, I have found absolutely nothing, anywhere online. I've never seen anything with such little documentation! So, that is why I thought it be best to ask here. In no way am i asking anyone to write me a tutorial, but any hints at all I would really appreciate. What is the basic template and procedure to run a hello world pop up in X-Plane? As i said, if there is anywhere you can point me to, an example project, etc, that would be extremely helpful.

Also, I hope to write code that will control avionics of high end aircraft such as the famous VMAX professional 777. Does that involve communcating with the normal datarefs or will I need to program specifically for that aircraft?

Cheers

Edited by cw777

Share this post


Link to post
Share on other sites

Create a folder named "scripts" in your aircraft root directory, and add a init.lua file. That's the file structure needed to start. For more here is the API: http://gizmo64.com/Gizmo64_API.htm.

In these forums you can also find a lot of example, Q&As, etc.

If you are looking to do work on that aircraft, I'm sure it uses normal datarefs, plus a ton of custom ones, which I don't if they are published.

Share this post


Link to post
Share on other sites

Inside your aircraft folder you will need a folder named "scripts".  Inside that folder you MUST have (at least) a script file named "init.lua".  From there you're free to do as you wish within what the Gizmo API and Lua provide.

You can communicate with "sim" DataRefs, as well as creating custom Datarefs of your own.  Attempting to customize an existing aircraft that already uses a plug-in will be an adventure at the very least, and may violate the developers EULA.

 

Edited by JGregory

Share this post


Link to post
Share on other sites

Ah this makes sense. So i just tried this, and ran X-Plane and opened the relevant aircraft. My code is

function OnDraw_Windows()
    gfx.setColor(color.red)
    gfx.drawString( "Hello World!", 512, 384 )
end

and I get a error in the gizmo console: 

Quote

init.lua:2 attempt to index global 'color' (a nil value): OnDraw_Windows

Even though this example is straight from the docs. Do i need to import color as a module or something? Clearly its missing. Cheers

Share this post


Link to post
Share on other sites
26 minutes ago, cw777 said:

Even though this example is straight from the docs. Do i need to import color as a module or something? Clearly its missing. Cheers

Ben can possibly answer your question better than I, but, it's possible the version of Gizmo you are using does not have the color table in it, as that is a somewhat newer feature.  Try this for now... gfx.setColor(1, 0, 0, 1)... or... create your own color table....   local color = {"red" = {1, 0, 0, 1}} and then you can use color.red  !

 

  • Upvote 1

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.

×