Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: RAW on May 28, 2014, 11:35:53 PM

Title: how do u write script?
Post by: RAW on May 28, 2014, 11:35:53 PM
Hello
  I guess u been ask too many times this same question.  I want to write a script so if Magic Lantern crashed (rarely happen). I want to have the script do some cleanup so I can reboot camera. Yes I crashed it so hard the camera locked up even canon menu. Somehow the ML, booted in safe mode, but was slow.
Is it possible for a script to do this?
thanks
Title: Re: how do u write script?
Post by: a1ex on May 28, 2014, 11:44:42 PM
If the camera is locked, there's not much you can do. If you find a way to take the battery out from a script, that would be something :D

A better option is to find a way to reproduce the crash and file a bug report.
Title: Re: How do you write and launch a script? (simplified baby steps)
Post by: l_d_allan on March 28, 2018, 07:43:55 AM
Hope people don't mind that this Lua newbie is re-opening a stale thread to document my baby-steps to get a script to launch

The content of the OP was about attempting to use a Lua script to recover from a bricked camera. Probably not going to happen.

However, to address the question in just the Subject: How do you write a script? ...
Following are a series of simplified baby-steps to modify the existing hello.lua script.

The steps worked for me with a Canon 6d, a 5dm2, and Windows-10 computer. It may or may not work the same for other cameras and platforms:

The are possibly omissions, unnecessary steps, typos, errors, misconceptions, etc. on my part. Assistance appreciated to clean up.