Post subject: JPC-rr TASScript 2.0 -- A new way of creating DOS TASses
Active player (372)
Joined: 9/25/2011
Posts: 652
TASScript 2.0 is an enhancement to JPC-rr that gives the TASser direct access to the event stream, providing quick and easy command input and editing functionality. It offers complete control over event timing down to the sub-millisecond, and precise control over mouse and joystick movements. Furthermore, it enables a macro-like ability to copy a series of inputs and insert them when and where desired. But most importantly, TASScript 2.0 finally breaks down the barrier to refactoring DOS TASses that has long frustrated TASsers. Download Link - JPC-rr 11.2 w/ TASScript 2.01 (Updated 2018/11/06 - Minor bug fixes) EDIT: Now merged into JPC-rr 11.8, and proposed as a new version 11.9-alpha. Please use this one moving forwards. History For years I have been fed up with the inability to refactor TASses in JPC-rr. Numerous times when making a TAS I've realized a mistake earlier in my run. Being forced to retreat, fix the problem, and then redo all my work from that point on killed any joy I had in making the TAS. Last year, I decided I'd had enough and wrote some lua scripts (TASScript 1.0) to try and solve the issue. Although it was somewhat successful, allowing me to refactor a short 41 second movie, it was tedious and imprecise. When I tried to use it to refactor a longer 9 minute movie, it became an unbearable slog. Then in January, I saw dwangoAC at AGDQ changing the event stream on Donkey Kong Country mid-playback and said to myself, "I want THAT!" I have since been putting my time into creating a version of that for JPC-rr, and TASScript 2.0 is the result of that work. Description TASScript 2.0 provides a new window for viewing, entering and modifying events: The TASScript window is separated into four parts: Past Script (Top) This shows events that already occurred in your TAS. The Past Script is not editable. Future Script (Middle) This shows events that are scheduled to happen. Edit this area to create/update your TAS. Message Area (Bottom) This area shows messages from the TASScript system. Action Buttons There are five action buttons:
    1) Unlock/Lock Click "Unlock" to open the Future Script for editing. You can also click on the Future Script area to open it. To save your changes, click "Lock". You must fix all errors before you can lock in your changes. 2) Cancel Click "Cancel" to discard your changes and revert to the last-saved Future Script. Editing is automatically cancelled if you advance a frame or load a save state. 3) Export Clicking "Export" will let you export your TASScript to a file. 4) Sound Unchecking "Sound" will turn off the sounds made by the TASScript window. 5) Help The question mark button opens the Help window.
Entering Commands You can type commands directly in to the Future Script area and lock it to save your changes, or you can use the classic methods of creating events to append to the end of the current Future Script. If there is a series of commands you repetitively use, you can copy those to a text file and paste them into the Future Script area whenever you need them. Here are the commands you can enter in the Future Script area: Wait:# Emulator waits without creating any events for the specified number of milliseconds. # can be any decimal value. If a Wait comes before a Type command, the value may be altered slightly on locking to ensure the Type command occurs at a valid timestamp. Example: "Wait:24.5" Type:{list of keys} Emulator types the keys listed. Usually you will want to type each key twice, once for key-down and once for key-up. Only the lower case key values are valid. To type an upper case or special character, use a shift key first. See the virtual keyboard for the list of normal keys. Special keys are listed below. Example: "Type:<lshift>ttaassvv<lshift>iiddeeooss..oorrgg<lshift>11<lshift>" will type "TASVideos.org!"
    Special Keys: <esc> = escape <bksp> = backspace <tab> = tab <enter> = enter <lctrl> = left ctrl <rctrl> = right ctrl* <lshift> = left shift <rshift> = right shift <lalt> = left alt <ralt> = right alt* <caps> = caps lock <num> = num lock <f1>-<f12> = f1-f12 <scroll> = scroll lock <num0>-<num9> = numpad 0-9 <num> = numpad minus <num> = numpad plus <numdel> = numpad delete <prtscr> = print screen* <numenter> = numpad enter* <home> = home* <up> = up* <down> = down* <left> = left* <right> = right* <pgup> = page up* <pgdown> = page down* <end> = end* <ins> = insert* <del = delete* <pause> = pause*
NOTE: Special keys with asterisks (*) take twice as long to input in JPC-rr than other keys. Use alternatives where possible. MXMove:#, MYMove:# Emulator moves the mouse along the X or Y axis by the specified amount. # must be a whole number between -255 and 255 inlclusive. Example: "MXMove:-75" Example: "MYMove:40 MZMove:# Emulator moves the mouse scroll wheel by the specified amount. # must be a whole number between -7 and 7 inclusive. Example: "MZMove:7" MClick:# Emulator clicks the specified mouse button. # must be a whole number between 0 and 4 inclusive. Example: "MClick:2" JButtonA:#, JButtonB:#, JButtonC:#, JButtonD:# NOTE: org.jpc.modules.Joystick must be in the run's assembly module list. Emulator sets the state of the corresponding joystick button. # must be either 0 for off or 1 for on. Example: "JButtonA:1" JAxisA:#, JAxisB:#, JAxisC:#, JAxisD:# NOTE: org.jpc.modules.Joystick must be in the run's assembly module list. Sets the corresponding joystick axis value. # must be a positive or negative whole number, or zero. Example: "JAxisA:-10000" TASScript Examples The package comes with a TASScripts directory that has three examples of simple TASScripts you can use to boot the system. You will never need to TAS the start up ever again!
    Basic Boot.TAS This boots the system skipping fdconfig.sys and autoexec.bat. This is the fastest way to boot up, but you won't activate himem mode, which may be an issue for some games. Himem Boot with Mouse.TAS This boots the system in himem mode and installs the mouse driver with settings to work with the mouse support enhancement (see below) Himem Boot no Mouse.TAS This boots the system in himem mode but no mouse
If you'd like an example of a TASScript for a whole game, here is the one for my QFG2 submission. Usage To refactor a movie, simply load that movie and run until you get to just before the place you want to change. Be sure to create a save state, then unlock the Future Script area and make your changes. Be sure to lock again before continuing. I also found the TASScript window very useful for new TASsing as well, especially when typing. Not having to use the Virtual Keyboard is a plus in my books. Also, the precise mouse movements come in handy, though dragging the pointer is still useful to get it in the right area. Other Enhancements There are other previous enhancements I made that are part of this bundle:
    Multiple Save Directories When you first try to save or load, it will ask you which directory you want to use. You can always change this directory using the 'D' key. This will let you keep a detailed folder structure of all your saves you can go back to any previous save and never have to overwrite an old save because you've used up all 12 function keys worth. Mouse Support For most games, to get mouse support to work properly, before loading the game uninstall ctmouse (or just skip over it in the Autoexec), and then install it again using: "ctmouse /r32". Once you start up your game, you'll be able to click on the mouse pointer and then drag it to where you want it to go, and let go of it. That will increment the frame and move the mouse for you. Check the menus for other manual ways of moving the mouse, as well as ways of changing the mouse settings if /r32 doesn't work for you and you want to use different numbers. Keyboard Support When you have the virtual keyboard window active, you can now just type and it will submit the keyboard commands for the letters you've typed. Much better than clicking on the keyboard buttons. I personally still find entering "Type:" commands in the TASScript window even easier.
Final Comments This has been a long time coming, and I'm glad to finally have this out the door. Please let me know your thoughts and ideas in this thread, including any errors you run into and any improvements you can think of. I'm going to be devoting my spare time to something else for a while, but I'll be monitoring the thread and will be happy to fix any problems or fine-tune this to make it even better. Given that this adds a whole new method of input and editing to JPC-rr, I'd also like to recommend adding this version to the TASVideos JPC page for people to find and download. My hope is that the TASScript window will lower the learning curve for the emulator and motivate more people to make DOS TASses. However that will only work if people know about it. If someone is willing to integrate my changes with the latest version of JPC-rr to make a new version, I'd be very happy to provide my support. Kudos, and many thanks for the TASVideos community for keeping up the push to gaming perfection.
DrD2k9
He/Him
Editor, Judge, Expert player (2056)
Joined: 8/21/2016
Posts: 1011
Location: US
Thank you for all your work that went into this! The DOS TASing community will benefit greatly from this. I'm very much looking forward to trying this out next time I do some DOS TASing. Although it may be a while as I've got a number of other projects with a bit higher priority. If I had any worthwhile programming ability, I'd gladly help with implementing all this into a new JPC version....but it's way beyond my understanding. EDIT: In case it happens to anyone else. Chrome is warning me that the download may be dangerous because it's not a commonly downloaded file (whatever that means).
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
Just letting you know guys, DOSBox inside libTAS has very high chance of being accepted for DOS TASing. And libTAS has input roll like in lsnes.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Active player (372)
Joined: 9/25/2011
Posts: 652
feos wrote:
Just letting you know guys, DOSBox inside libTAS has very high chance of being accepted for DOS TASing. And libTAS has input roll like in lsnes.
I saw that earlier this month, and my first reaction was to wonder if my work will have been for naught. But I think that, at the very least, this enhancement will aid in improving existing DOS TASses, and be used by those of us who are used to using JPC-rr or just want to work in Windows instead of linux. Depending on the feature set of libTAS, my improvements may extend the life of JPC-rr after libTAS is legal. I guess we’ll have to wait and see.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4014
Probably JPC-rr-TASScript will have sub-millisecond input and DOSBox inside libTAS won't, so which emulator is optimal will depend on what you're TASing.
DrD2k9 wrote:
EDIT: In case it happens to anyone else. Chrome is warning me that the download may be dangerous because it's not a commonly downloaded file (whatever that means).
Browsers like Chrome keep track of which executibles and zips have been downloaded very few times globally, and assumes they are malware by default. But it is just making a guess to help low information users' safety. If you know it is safe because you trust the creator, you can ignore the warning.
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
DrD2k9
He/Him
Editor, Judge, Expert player (2056)
Joined: 8/21/2016
Posts: 1011
Location: US
feos wrote:
Just letting you know guys, DOSBox inside libTAS has very high chance of being accepted for DOS TASing. And libTAS has input roll like in lsnes.
I saw that as well. And it'll likely open the door to many more games being TASable. Still, JPC will remain a useful and viable option for those who can't/don't want to learn/use Linux just so they can TAS a DOS game. A bit off topic, but I have a question on TASing DOSBox via libTAS...how are CPU speeds (DOSBox cycles) going to be regulated? With JPC, the CPU speed is set and unchangeable mid run. In DOSBox, cycles can be changed at any time. If it helps....the approximation formula for converting between cycles and CPU clock speed is as follows: DOSBox Cycles = 7.45(CPU clock speed in mHz)2
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11264
Location: RU
The way I see it, any emulator configuration and hotkey should be banned during playing. In MAME I can simply erase all hotkeys that access emulator features, and when a TAS is played back that uses them, it desyncs. I only leave game controls enabled, and the run that uses only them works. Don't know how this is set up in dosbox, but we'll try to limit it in the same manner: config prior to tasing.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
DrD2k9
He/Him
Editor, Judge, Expert player (2056)
Joined: 8/21/2016
Posts: 1011
Location: US
feos wrote:
The way I see it, any emulator configuration and hotkey should be banned during playing. In MAME I can simply erase all hotkeys that access emulator features, and when a TAS is played back that uses them, it desyncs. I only leave game controls enabled, and the run that uses only them works. Don't know how this is set up in dosbox, but we'll try to limit it in the same manner: config prior to tasing.
There are hotkeys for changing cycle speed in DOSBox. I think they're Ctrl+F11 and Ctrl+F12 for increasing/decreasing cycles. It's also possible to set cycle speed in the DOSBox config files.
Reviewer, Expert player (2392)
Joined: 5/21/2013
Posts: 414
Looks like an interesting script, really good work. I would say JPC-rr is not going anywhere, even when DOSBox TASing is a thing, since JPC-rr can do multiple button presses per frame. As for DOSBox submissions, we should probably have this discussion in another thread, but there are already rules for CPU speed: http://tasvideos.org/MovieRules.html#DosMoviesJpcRr Although these would have to be slightly adapted for DOSBox. Using DrD2k9's formula, 20 MHz ≈ 3000 cycles. I think that the config file should be supplied in the submissions, and obviously no clock speed changes in the middle of the run (this pops up in the terminal so it will be easy to see).
Active player (372)
Joined: 9/25/2011
Posts: 652
Out of curiosity, I did a quick dig into the memory classes of JPC-rr, and it looks like everything is already in place to whip up a full-fledged RAM Search/Watch window. If someone's interested, I could point them in the right direction, or maybe that'll be something I take on in the new year. :)
Active player (372)
Joined: 9/25/2011
Posts: 652
FYI, just updated the download link with a new version that fixes a few null pointer bugs and an export bug.
Joined: 9/27/2011
Posts: 207
Location: Finland
From a scale from success to Charlie Sheen, I'd like to give this a very stocky "Winning!" This will directly improve the odds someone will want to TAS Alone in the Dark some day (a game I've been studying for years to run segmented: a TAS-only category is speculated to exist).
DrD2k9
He/Him
Editor, Judge, Expert player (2056)
Joined: 8/21/2016
Posts: 1011
Location: US
Svimmer wrote:
From a scale from success to Charlie Sheen, I'd like to give this a very stocky "Winning!" This will directly improve the odds someone will want to TAS Alone in the Dark some day (a game I've been studying for years to run segmented: a TAS-only category is speculated to exist).
Do we know if Alone in the Dark works on JPC-rr?
Joined: 9/27/2011
Posts: 207
Location: Finland
DrD2k9 wrote:
Do we know if Alone in the Dark works on JPC-rr?
I didn't know the emulator had limitations as to what it could run. I don't think I know anyone who's tried it. I've got tons to do even without the TAS and the trick requires some serious technical ability anyway. Sorry to off-topic this. Here's the AitD thread. Thanks once again to c square for making DOS TASing better for everyone!
Active player (372)
Joined: 9/25/2011
Posts: 652
You're quite welcome, Svimmer. I tried running the demo in JPC-rr and got an Missing Operation IllegalStateException. That's using JPC-rr 11.2, it's possible it's supported in a later version. I hope someone more knowledgeable about these sorts of things can help figure this out, and make your wish for an AitD TAS a reality!
Active player (372)
Joined: 9/25/2011
Posts: 652
Merged TASScript 2.0 code in with JPC-rr 11.8, and published a JPC-rr 11.9 candidate. More on this at the JPC-rr development thread.