<pclass="rvps7"><spanclass="rvts20">TAS Editor v1.0 comes with the library of 24 functions available for Lua scripts running in FCEUX emulator. With Lua scripts you can automate some aspects of TASing and even create your own tools for movie editing.</span></p>
<pclass="rvps7"><spanclass="rvts20">In FCEUX folder there's </span><spanclass="rvts19">/luaScripts</span><spanclass="rvts20"> folder with </span><spanclass="rvts19">/taseditor</span><spanclass="rvts20"> subfolder in it. There you can find examples of scripts using functions of this library.</span></p>
<pclass="rvps7"><spanclass="rvts20">If you don't know how to make and run Lua scripts in emulators, read </span><aclass="rvts24"href="AdvancedFeatures.html#UsingLua">Advanced Features</a><spanclass="rvts20"> and also refer to </span><aclass="rvts24"href="http://www.fceux.com/web/help/fceux.html?Commands.html"target="_blank">FCEUX Help</a><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Registers a callback function ("Auto Function") that runs periodically. The Auto Function can be registered and will be called even when TAS Editor isn't engaged.</span></p>
<pclass="rvps7"><spanclass="rvts20">When FCEUX is unpaused, your function will be called at the end of every frame (running 60 times per second on NTSC and 50 times per second on PAL).</span></p>
<pclass="rvps7"><spanclass="rvts20">When FCEUX is paused, your function will be called 20 times per second.</span></p>
<pclass="rvps7"><spanclass="rvts20">User can switch on/off auto-calling by checking "Auto function" checkbox in TAS Editor GUI.</span></p>
<pclass="rvps7"><spanclass="rvts20">Like other callback-registering functions provided by FCEUX, there is only one registered callback at a time per registering function per script. If you register two callbacks, the second one will replace the first, and the call to </span><spanclass="rvts19">taseditor.registerauto()</span><spanclass="rvts20"> will return the old callback. You may register </span><spanclass="rvts63">nil</span><spanclass="rvts20"> instead of a function to clear a previously-registered callback.</span></p>
<pclass="rvps7"><spanclass="rvts20">If a script returns while it still has registered callbacks, FCEUX will keep it alive to call those callbacks when appropriate, until either the script is stopped by the user or all of the callbacks are de-registered.</span></p>
<pclass="rvps7"><spanclass="rvts20">Registers a callback function ("Manual Function") that can be called manually by TAS Editor user. The function can be registered even when TAS Editor isn't engaged.</span></p>
<pclass="rvps7"><spanclass="rvts20">The Manual function doesn't depend on paused or unpaused FCEUX status. It will be called once every time user presses </span><spanclass="rvts26">Run function</span><spanclass="rvts20"> button in TAS Editor GUI.</span></p>
<pclass="rvps7"><spanclass="rvts20">You can provide a new name for this button.</span></p>
<pclass="rvps7"><spanclass="rvts20">The Manual function cannot be run more often than TAS Editor window updates (60/50 FPS or 20FPS when emulator is paused).</span></p>
<pclass="rvps7"><spanclass="rvts20">In FCEUX code Manual function runs right after Auto Function.</span></p>
<pclass="rvps7"><spanclass="rvts20">You can use this feature to create new tools for TAS Editor. For example, you can write a script that reverses currently selected input, so user will be able to reverse input by selecting a range and clicking </span><spanclass="rvts26">Run function</span><spanclass="rvts20"> button.</span></p>
<pclass="rvps7"><spanclass="rvts20">Like other callback-registering functions provided by FCEUX, there is only one registered callback at a time per registering function per script. If you register two callbacks, the second one will replace the first, and the call to </span><spanclass="rvts19">taseditor.registermanual()</span><spanclass="rvts20"> will return the old callback. You may call </span><spanclass="rvts19">taseditor.registermanual(</span><spanclass="rvts63">nil</span><spanclass="rvts19">)</span><spanclass="rvts20"> to clear a previously-registered callback.</span></p>
<pclass="rvps7"><spanclass="rvts20">If a script returns while it still has registered callbacks, FCEUX will keep it alive to call those callbacks when appropriate, until either the script is stopped by the user or all of the callbacks are de-registered.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns </span><spanclass="rvts63">true</span><spanclass="rvts20"> if TAS Editor is currently engaged, </span><spanclass="rvts63">false</span><spanclass="rvts20"> if otherwise.</span></p>
<pclass="rvps7"><spanclass="rvts20">Also when TAS Editor is engaged, </span><spanclass="rvts19">movie.mode()</span><spanclass="rvts20"> returns "taseditor" string.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns </span><spanclass="rvts63">true</span><spanclass="rvts20"> if given frame is marked in TAS Editor, </span><spanclass="rvts63">false</span><spanclass="rvts20"> if not marked.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, returns </span><spanclass="rvts63">false</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Sets Marker on given frame. Returns index number of the Marker created.</span></p>
<pclass="rvps7"><spanclass="rvts20">If that frame is already marked, no changes will be made, and the function will return the index number of existing Marker.</span></p>
<pclass="rvps7"><spanclass="rvts20">You can set markers even outside input range.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns string representing the Note of given Marker.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns </span><spanclass="rvts63">nil</span><spanclass="rvts20"> if TAS Editor is not engaged.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given index is invalid (if Marker with this index number doesn't exist), returns note of the zeroth marker.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns </span><spanclass="rvts63">nil</span><spanclass="rvts20"> if TAS Editor is not engaged.</span></p>
<pclass="rvps7"><spanclass="rvts20">When you want to check Recorder's read-only state, use </span><spanclass="rvts19">emu.readonly()</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns a table (array) containing numbers of currently selected frames. These numbers are sorted in ascending order.</span></p>
<pclass="rvps7"><spanclass="rvts20">If no frames are selected at the moment, returns </span><spanclass="rvts63">nil</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, returns </span><spanclass="rvts63">nil</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Changes current selection to the given set of frames. Frame number in your table don't have to be sorted.</span></p>
<pclass="rvps7"><spanclass="rvts20">Call </span><spanclass="rvts19">taseditor.setselection(</span><spanclass="rvts63">nil</span><spanclass="rvts19">)</span><spanclass="rvts20"> to clear selection.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns a number representing input of given joypad stored in current movie at given frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is negative, returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is outside current input range, returns 0, which can be interpreted as a blank frame (no buttons pressed at this frame yet).</span></p>
<pclass="rvps7"><spanclass="rvts20">Joypad value must be one of the following:</span></p>
<pclass="rvps7"><spanclass="rvts20">0 –</span><spanclass="rvts20">to get hardware commands (bit 0 = reset, bit 1 = poweron, bit 2 = FDS insert disk, bit 3 = FDS switch side)</span></p>
<pclass="rvps7"><spanclass="rvts20">2 –</span><spanclass="rvts20">to get 2P buttons</span></p>
<pclass="rvps7"><spanclass="rvts20">3 –</span><spanclass="rvts20">to get 3P buttons</span></p>
<pclass="rvps7"><spanclass="rvts20">4 –</span><spanclass="rvts20">to get 4P buttons</span></p>
<pclass="rvps7"><spanclass="rvts20">You should handle returned number (if it's not equal to -1) as a byte, each bit corresponds to one button (e.g. if bit 1 is set that means A button is pressed). Use Bitwise Operations to retrieve the state of specific buttons.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given joypad is outside [0-4] range, returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">Sends request to TAS Editor asking to change input of given joypad at given frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">Actual movie input won't be changed until the moment you call </span><spanclass="rvts19">taseditor.applyinputchanges()</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Using several consecutive requests and then calling </span><spanclass="rvts19">applyinputchanges()</span><spanclass="rvts20"> at the end, you can change several frames of current movie in one moment.</span></p>
<pclass="rvps7"><spanclass="rvts20">When applying the pile of requests, TAS Editor will execute them in consecutive order.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is negative, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is outside current input range, TAS Editor will expand movie during </span><spanclass="rvts19">applyinputchanges()</span><spanclass="rvts20"> to fit the frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given joypad is outside [0-4] range, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">Given input will be treated by TAS Editor as a sequence of bits representing state of each button of given joypad </span><spanclass="rvts20">(</span><spanclass="rvts20">bit</span><spanclass="rvts20"> 0 = A, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 1 = B, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 2 = Select, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 3 = Start, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 4 = Up, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 5 = Down, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 6 = Left, </span><spanclass="rvts20">bit</span><spanclass="rvts20"> 7 = Right)</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps7"><spanclass="rvts20">Sends request to TAS Editor asking to insert given number of blank frames before given frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">Actual movie won't be changed until the moment you call </span><spanclass="rvts19">taseditor.applyinputchanges()</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Insertion can move down some old input and Markers (if "</span><aclass="rvts24"href="ProgramCustomization.html#BindMarkerstoInput">Bind Markers to Input</a><spanclass="rvts20">" option is checked by user).</span></p>
<pclass="rvps7"><spanclass="rvts20">If given number is less or equal to zero, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is negative, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is outside current input range, TAS Editor will expand movie during </span><spanclass="rvts19">applyinputchanges()</span><spanclass="rvts20"> to fit the frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps7"><spanclass="rvts20">Sends request to TAS Editor asking to delete given number of frames starting from given frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">Actual movie won't be changed until the moment you call </span><spanclass="rvts19">taseditor.applyinputchanges()</span><spanclass="rvts20">.</span></p>
<pclass="rvps7"><spanclass="rvts20">Deletion can move up some old input and Markers (if "</span><aclass="rvts24"href="ProgramCustomization.html#BindMarkerstoInput">Bind Markers to Input</a><spanclass="rvts20">" option is checked by user).</span></p>
<pclass="rvps7"><spanclass="rvts20">If given number is less or equal to zero, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is negative, TAS Editor will ignore such request.</span></p>
<pclass="rvps7"><spanclass="rvts20">If given frame is outside current input range, TAS Editor will expand movie during </span><spanclass="rvts19">applyinputchanges()</span><spanclass="rvts20"> to fit the frame.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps7"><spanclass="rvts20">Instantly applies the list of previously requested changes to current movie. If these requests actually modified movie data, new item will appear in History Log (so user can undo these changes), and Greenzone may become truncated, Playback cursor may lose its position, auto-seeking may be triggered.</span></p>
<pclass="rvps7"><spanclass="rvts20">Returns number of frame where first actual changes occurred.</span></p>
<pclass="rvps7"><spanclass="rvts20">If no actual changes were found (for example, you asked TAS Editor to set buttons that were already pressed), returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">If pending list of changes is empty, returns -1.</span></p>
<pclass="rvps7"><spanclass="rvts20">You can provide a name that will be assigned to this change. This name will be shown in History Log. If you don't provide a name, TAS Editor will use default name ("Change").</span></p>
<pclass="rvps7"><spanclass="rvts20">After applying all requests TAS Editor clears the list of requests.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps7"><spanclass="rvts20">Clears the list of previously requested changes, making TAS Editor forget about them before you call </span><spanclass="rvts19">applyinputchanges()</span><spanclass="rvts20">. Use this function to discard previously submitted input changes.</span></p>
<pclass="rvps7"><spanclass="rvts20">It's also recommended to call this function before making several requests in a row, so that you'll be sure that only your new changes will apply.</span></p>
<pclass="rvps7"><spanclass="rvts20">If TAS Editor is not engaged, nothing will be done.</span></p>
<pclass="rvps6"style="clear: both;"><spanclass="rvts16">Created with the Personal Edition of HelpNDoc: </span><aclass="rvts17"href="https://www.helpndoc.com/create-epub-ebooks">Full-featured EPub generator</a></p>