Author Topic: Help me with LUA  (Read 2250 times)

jackyes

  • New to the forum
  • *
  • Posts: 15
Help me with LUA
« on: March 27, 2017, 08:17:12 AM »
Hi all,

i'm writing my first lua script but i have some question.

1) what is the lens.dof_far max value? (the value for infinity?)

2) i'm playing with focus stacking. Moving the focus point, sometime it say "Focus: soft limit reached" (i'm at the max/min focus point of the lens?)....there is a way to prevent or stop the script just before or when it happen?

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1736
Re: Help me with LUA
« Reply #1 on: March 27, 2017, 08:27:53 AM »
@jackyes

In my lua scripts I define infinity as:

Code: [Select]
infinity = 655000

BTW you can access my scripts at: http://photography.grayheron.net/

These should give you some ideas.

Also look through the scrip area of the ML forum.

Cheers

Garry

jackyes

  • New to the forum
  • *
  • Posts: 15
Re: Help me with LUA
« Reply #2 on: March 27, 2017, 09:16:08 AM »
Thank you garry23,

is this https://davidmilligan.github.io/ml-lua/ the only official source of info for lua script  :o ?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12222
  • Maintenance mode
Re: Help me with LUA
« Reply #3 on: March 27, 2017, 09:53:19 AM »
Main page -> Documentation -> Lua API
Main page -> Downloads -> Nightly builds -> Lua API

Suggestion for a better place for this link?

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1736
Re: Help me with LUA
« Reply #4 on: March 27, 2017, 01:06:09 PM »
@A1ex

I think the Lua API link is accessible and visible, ie under the experimental tab.

I think the 'issue' is always going to be with us, ie you don't know what you don't know  ;)

Once you know where the Lua API link is, all is well with the world  :)

We also have the 'Scripting Corner' link.

Having been through the 'Lua development' (and I'm still learning), I think knowing you can ask questions, eg in the Scriptng Corner, to help in your personal development, is really of value.

From my perspective, having you, Daniel and David etc nudge me in the right direction, really helped me as I wrote my scripts.

Bottom line: I still believe the Lua environment is one of the ML 'star tools', and it still has more to offer as things get 'unlocked', eg refined focus position control etc.


jackyes

  • New to the forum
  • *
  • Posts: 15
Re: Help me with LUA
« Reply #5 on: March 27, 2017, 02:19:44 PM »
@A1ex
It is in the right place.
Sorry i have found that (old?) page searching "ML LUA API" on google =)

@garry23
Bottom line: I still believe the Lua environment is one of the ML 'star tools', and it still has more to offer as things get 'unlocked', eg refined focus position control etc.

I agree! it is a fantastic feature!

jackyes

  • New to the forum
  • *
  • Posts: 15
Re: Help me with LUA
« Reply #6 on: April 21, 2017, 11:49:49 PM »
i'm making some test with lua...i have write this miniscript to take 3 braketed shoot. i have used shoot(false) because i don't want to refocus each time.
The script in photo mode works great but in liveview refocus each time and take only 2 shoot.. i'm confused   :-\ ...


EDIT: solved using shoot(64, false)

Code: [Select]
keymenu = menu.new
{
    name   = "Take Bracket!",
    help   = "Bracket script.(Tv)",
    select = function(this) task.create(main) end,
}

function main()
    local shutterok = camera.shutter.value
    console.show()
    console.clear()
    print("First shot")
    msleep(750)
    shoot(false)
    msleep(750)
    camera.shutter.value = shutterok * 4
    console.clear()
    print("Second shot at 2EV ")
    msleep(750)
    shoot(false)
    msleep(750)
    camera.shutter.value = shutterok / 4
    console.clear()
    print("Third shot at -2EV ")
    msleep(750)
    shoot(false)
    camera.shutter.value = shutterok
    console.hide()
end

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1736
Re: Help me with LUA
« Reply #7 on: April 22, 2017, 08:46:41 PM »
@jackyes

As Lua develops things get changed, and the shoot is one such change.

I would suggest you try using the latest nightly or the experimental Lua and check the API documentation on the download page.

If your script is working with shoot(64, false), then you are using an older ML build.