Load autosave using Lua

  • #1, by dror-ben-hurFriday, 25. May 2018, 07:04 2 years ago
    Hi all,
    How can I implement this code in Lua script?


    Thanks.

    Newbie

    27 Posts


  • #2, by sebastianFriday, 25. May 2018, 07:24 2 years ago
    Hi, 

    currently there is no possible way to load a savegame via lua directly.
    You may need to start the action via lua which contains your actionparts :

    startAction("Actions[name_of_action]") 

    Thread Captain

    2337 Posts

  • #3, by dror-ben-hurFriday, 25. May 2018, 07:43 2 years ago
    Thanks for the help.
    Sorry for the question but how do I know the 'name_of_action'?
    This Action (in the screenshot) is located under entry/button of menu called 'menuGameRestart'.

    Newbie

    27 Posts

  • #4, by esmeraldaFriday, 25. May 2018, 08:39 2 years ago
    Rightclick on the action and select "copy Lua path". 

    Great Poster

    389 Posts

  • #5, by dror-ben-hurFriday, 25. May 2018, 08:51 2 years ago
    On RightClick I have only a view option...
    I am using visionaire v 4.2.5

    Newbie

    27 Posts

  • #6, by esmeraldaFriday, 25. May 2018, 09:13 2 years ago
    Ah sorry, this function must be new in Visionaire5.

    In your case the Lua path should be:

    Scenes.menuGameRestart.Objects.YesBttn.Actions["'Left click' executed"]

    (I filled in the bold parts according to your screenshot)

    Great Poster

    389 Posts

  • #7, by dror-ben-hurFriday, 25. May 2018, 09:28 2 years ago
    Thanks, 
    that one works like charm! smile

    Newbie

    27 Posts

  • #8, by afrlmeFriday, 25. May 2018, 12:12 2 years ago
    Out of curiosity why are you using Visionaire Studio 4.2.5 instead of 5.x?

    Imperator

    6842 Posts

  • #9, by dror-ben-hurFriday, 25. May 2018, 12:26 2 years ago
    I found it very herd to start learning Visionaire Studio and Lua. 
    All of the code, resources and tutorials that I'm using are on 4.2.5 so it was the obviously choice...

    Newbie

    27 Posts

  • #10, by afrlmeFriday, 25. May 2018, 12:37 2 years ago
    It doesn't matter. Old Lua scripts will still work in 5.x, but you now have some newer methods available too for extra shorthand.

    While 5.x might look a lot different to 4.2.5 & below, in large part due to the new GUI, it still more or less works the same. I recommend starting with 5.x for many reasons. 4.2.5 is outdated, has various unaddressed bugs & will not be getting any new updates to fix said bugs.

    Now in regards to Lua script... do you already know any scripting/programming languages or is this the first scripting language you are learning? if it is then I'd just focus on learning how to use Visionaire Studio itself first rather than diving ass first into the deep end (as I like to call it).

    Imperator

    6842 Posts

  • #11, by dror-ben-hurSunday, 27. May 2018, 17:52 2 years ago
    AFRLme, 
    first I like to say I am appreciate your commitment to every post, Thank you.

    Now I dive into Visionaire I do feel safe to upgrade my environment to 5.x, is thet change is straightforward?

    About the scripting, I am developer and using in my day job many scripting and programming languages, tell the truth, I am felling more comfortable will reading Lua code  smile


    Newbie

    27 Posts

Write post