Stop animation in specific frame

  • #10, by TinTinFriday, 29. January 2016, 16:32 8 years ago
    I sent it.
    Sorry but my project was heavy so I made another project as default and paste your codes.please check your mail

    Thanks so much

    Forum Fan

    196 Posts


  • #11, by afrlmeFriday, 29. January 2016, 16:57 8 years ago
    haha... sorry. Was my fault. I forgot to declare the script as a function.
    function setFrames(anim, a, b)
     if b == nil then b = a end -- fallback in case only a value was entered
     -- + --
     ActiveAnimations[anim].AnimationFirstFrame = a
     ActiveAnimations[anim].AnimationLastFrame = b
    end
    

    ... that is the reason it was returning an error. Should work if you replace the script with the fixed block I just added (above).

    Imperator

    7278 Posts

  • #12, by TinTinFriday, 29. January 2016, 17:06 8 years ago
    Great!!!. It works perfect now .
    Thanks a lot

    p.s : would you mind please lead me for a reference or book absolute beginner for Lua.

    Forum Fan

    196 Posts

  • #13, by afrlmeFriday, 29. January 2016, 17:40 8 years ago
    I recommend looking at the wiki. I've added tons of Lua stuff to it, but yeah sure, for a non-Visionaire Studio related Lua I really recommend checking out this blog: http://www.phailed.me/2011/02/learn-lua-the-hard-way-1/ as it's very easy to follow. There's also various exercises listed on it to try out.

    P.S: I recommend downloading and installing a text editor. Sublime Text is the best one (I use that). Alternatively GitHub have created a nice editor "Atom" that is almost on par with Sublime Text & it's 100% free. wink

    Imperator

    7278 Posts

  • #14, by TinTinSaturday, 30. January 2016, 05:23 8 years ago
    Thanks a lot. I appreciate for your helps.

    Forum Fan

    196 Posts

  • #15, by ke4Saturday, 30. January 2016, 09:41 8 years ago
    I'm using Atom now and it's nice... smile

    Key Killer

    810 Posts

  • #16, by TinTinSaturday, 30. January 2016, 13:20 8 years ago
    Is it possible auto complete VS write coding in Sublime Text or Atom?

    Forum Fan

    196 Posts

  • #17, by afrlmeSaturday, 30. January 2016, 14:02 8 years ago
    Yes to a degree. Both Sublime Text & Atom have auto-complete features for many languages, including Lua script, however, they will not auto-complete Visionaire Studio data structure fields, seeing as there is no way of directly tying in the VisObj system into the text editor.

    I believe Simon plans on adding auto-complete to the internal VS script editor at some point in the future. Auto-complete, search & replace, & multi-line / word editing are features I heavily use in Sublime Text, which is why I write all my scripts in Sublime.

    P.S: There is supposed to be a method for remotely debugging your VS scripts by a third party application. http://wiki.visionaire-tracker.net/wiki/Remote_Debugging - It's not something I personally use as I tend to rely on my own cognitive logic & the basic errors / warnings returned in the messages log file, when I mess up! wink

    Imperator

    7278 Posts

  • #18, by TinTinSaturday, 30. January 2016, 16:11 8 years ago
    Nice job.Remote debugging is great for check errors. Thanks a lot smile
    I hope Simon make more user friendly for script editor . I can't see 'find' tool for search even.

    Forum Fan

    196 Posts

  • #19, by afrlmeSaturday, 30. January 2016, 16:50 8 years ago
    Yeah the current text editor in VS is just the basic functions of Scintilla which is what Sublime Text is also based up. In other words it's technically possible for Simon or one of the other devs to create similar features that Sublime Text / Atom have, but only time will tell.

    P.S: I believe David intended on adding debugging directly into the engine itself. I don't know if he still plans on sorting that out at some point or not.

    Imperator

    7278 Posts

  • #20, by zurikTuesday, 26. February 2019, 19:44 5 years ago
    Hi. I found this post and trying to do the same, but obviously I am doing something wrong.
    To play an animation and stop it on a specific frame. For example if I am animating a Battery or a Fuel status bar. I put that script in the Script tab, but how do I run the function? From the animation frames or action parts?

    Thanks

    Newbie

    40 Posts