Как сделать авто сплиты в livesplit

Как сделать авто сплиты в livesplit

LiveSplit has integrated support for Auto Splitters. An Auto Splitter can be one of the following:

At the moment LiveSplit can automatically download and activate Auto Splitters that are LiveSplit Components or ASL Scripts. Support for applications using the LiveSplit Server is planned, but is not yet available.

Features of an Auto Splitter

An Auto Splitter can provide any of the following features:

Game Time can either be Real Time without Loads or an actual Game Timer found in the game. This depends on the game and the speedrun community of that game. If the game has been run in Real Time for multiple years already, introducing a new timing method might not be worth it.

An Auto Splitter, as the name suggests, can also provide automatic splits to increase the accuracy of the individual segment and split times. An Auto Splitter might not necessarily implement Automatic Splits for every single split available since the runner might want to have some additional splits that are not supported by the Auto Splitter used.

Automatic Timer Start

Not every Auto Splitter automatically starts the timer. For some games, the Auto Splitter can’t tell whether the runner just wants to start the game to practice something or actually wants to do a run.

An Auto Splitter can automatically reset the timer. This might be useful for games where going back to the main menu always means that the run is over. This is a bit dangerous though, as the runner might not have wanted to reset there. Think twice before implementing this functionality into your Auto Splitter.

How an Auto Splitter works

Auto Splitters can work in one or multiple of the following ways:

A Pointer Path is a list of Offsets + a Base Address. The Auto Splitter reads the value at the base address and interprets the value as yet another address. It adds the first offset to this address and reads the value of the calculated address. It does this over and over until there are no more offsets. At that point, it has found the value it was searching for. This resembles the way objects are stored in memory. Every object has a clearly defined layout where each variable has a consistent offset within the object, so you basically follow these variables from object to object.

Cheat Engine is a tool that allows you to easily find Addresses and Pointer Paths for those Addresses, so you don’t need to debug the game to figure out the structure of the memory.

The Auto Splitting Language is a small scripting language made specifically for LiveSplit Auto Splitters. It has a few advantages and disadvantages over normal Components.

Advantages:

Disadvantages:

An ASL Script contains a State Descriptor and multiple Actions which contain C# code.

The State Descriptor is the most important part of the script and describes which game process and which state of the game the script is interested in. This is where all of the Pointer Paths, which the Auto Splitter uses to read values from the game, are described. A State Descriptor looks like this:

If the script needs to support multiple versions of the game, you can specify an optional version identifier:

The optional VERSION_IDENTIFIER can be any arbitrary string you wish to use. Note that the script can define multiple State Descriptors for different processes/games. These optional features are extremely useful for emulators.

POINTER_PATH describes a Pointer Path and has two ways to declare:

The variable type VARIABLE_TYPE describes the type of the value found at the pointer path. It can be one of the following:

TypeDescription
sbyteSigned 8-bit integer
byteUnsigned 8-bit integer
shortSigned 16-bit integer
ushortUnsigned 16-bit integer
intSigned 32-bit integer
uintUnsigned 32-bit integer
longSigned 64-bit integer
ulongUnsigned 64-bit integer
float32-bit IEEE floating-point
double64-bit IEEE floating-point
boolBoolean
stringString (e.g. string255)
byteByte array (e.g. byte255)

The variable name VARIABLE_NAME can be any variable name you choose, describing what is found at the pointer path. The naming is up to you, but should be distinct from the other variable names.

The optional base module name BASE_MODULE describes the name of the module the Pointer Path starts at. Every *.exe and *.dll file loaded into the process has its own base address. Instead of specifying the base address of the Pointer Path, you specify the base module and an offset from there. If this is not defined, it will default to the main (.exe) module.

You can use as many offsets OFFSET as you want. They need to be integer literals, either written as decimal or hexadecimal.

After writing a State Descriptor, you can implement multiple actions such as splitting and starting the timer. These actions define the logic of the Auto Splitter based on the information described by the State Descriptor. An action looks like this:

You can think of Actions like functions that are automatically called by the ASL Component. These functions can only interact with each other or LiveSplit via the special variables the environment provides.

Actions are implemented in C#. You can use C#’s documentation for any questions you may have regarding the syntax of C#.

These actions are repeatedly triggered while LiveSplit is connected to the game process.

Automatic Timer Start

Explicitly returning true will prevent the split action from being run. This can be useful in some cases, but may also cause issues for some scripts. See Order of Execution for more information.

NOTE: Make sure the timer is set to «Game Time» in the layout! Failure to do so will cause the timer to keep running, as if isLoading had returned false or isLoading weren’t triggered at all.

Order of Execution

Understanding the order and conditions under which timer control actions are executed can help you avoid issues in your script where variables appear to be set improperly, actions appear to be skipped, and more. Every update iteration follows this process when running actions:

Script Initialization (Game Start)

Actions have a few hidden variables available.

A dynamic object which can be used to store variables. Make sure the variables are defined (for example in startup or init ) before trying to access them. This can be used to exchange data between Actions.

You can also store variables like this in current and the value will be in old on the next update.

The default is the first defined State Descriptor with no version specified, or the first State Descriptor in the file if there is none with no version specified.

The string you set version to will also be displayed in the ASL Settings GUI.

Used to add and access Settings.

These variables depend on being or having been connected to a game process and are not available in the startup or exit actions and only partly available in shutdown (might be null ).

State objects representing the current and previous states.

The currently connected Process object.

The modules of the currently connected process. Please use this instead of game.Modules! Use modules.First() instead of game.MainModule.

Provides a means to read memory from the game without using the State Descriptor.

ASL script settings are stored either with the Layout if you are using the Scriptable Auto Splitter component or with the Splits if you activated the script in the Splits Editor (so make sure to save your Layout or Splits accordingly when exiting LiveSplit if you changed settings).

Actions that are not present in the ASL script or empty will have their checkboxes disabled.

You can define custom boolean settings for your script in the startup action and then access the setting values as configured by the user in the other actions. If you have custom settings defined, they will be shown in the GUI for the user to check/uncheck. They will appear in the same order you added them in the ASL script.

You can define settings in the startup action by using the settings.Add(id, default_value = true, description = null, parent = null) method:

You can access the current value of a setting in all actions other than startup by accessing settings :

If you want to organize the settings in a hierarchy, you can specify the parent parameter. Note that the parent has to be the id of a setting that you already added:

Settings only return true (checked) when their parent setting is true as well. The user can still freely toggle settings that have their parent unchecked, however they will be grayed out to indicate they are disabled.

Any setting can act as a parent setting, so you could for example do the following to go one level deeper (continuing from the last example):

The setting mission1_part1 will only be enabled, when both mission1 and main_missions are enabled.

When the parent parameter is null or omitted, the setting will be added as top-level setting, unless settings.CurrentDefaultParent is set to something other than null :

Using settings.CurrentDefaultParent can be useful when adding several settings with the same parent, without having to specify the parent every time.

You can add a tooltip to settings that appears when hover over the setting in the GUI. This can be useful if you want to add a bit more information. After adding the setting, use settings.SetToolTip(id, tooltip_text) to set a tooltip:

Used for debug printing. Use DbgView to watch the output.

There are some advanced memory utilities not covered here. You can find them here.

Testing your Script

You can test your Script by adding the Scriptable Auto Splitter component to your Layout. Right-click on LiveSplit and choose «Edit Layout. » to open the Layout Editor, then click on the Plus-sign and choose «Scriptable Auto Splitter» from the section «Control». You can set the Path of the Script by going into the component settings of the Scriptable Auto Splitter. To get to the settings of the component you can either double click it in the Layout Editor or go into to the Scriptable Auto Splitter Tab of the Layout Settings. Once you’ve set the Path, the script should automatically load and hopefully work.

Reading debug output is an integral part of developing ASL scripts, both for your own debug messages which you can output with print() and any debug messages or error messages the ASL Component itself provides.

The program DebugView can be used for a live view of debug output from the ASL Component.

For errors, you can also check the Windows Event Logs, which you can find via:

Control Panel ➞ Search for Event Viewer ➞ Open it ➞ Windows Logs ➞ Application ➞ Find the LiveSplit Errors

Some might be unrelated to the Script, but it’ll be fairly obvious which ones are caused by you.

Adding an Auto Splitter

If you implemented an Auto Splitter and want to add it to the Auto Splitters that are automatically being downloaded by LiveSplit, feel free to add it to the Auto Splitters XML. Just click the link, click the icon for modifying the file and GitHub will automatically create a fork, branch and pull request for you, which we can review and then merge in.

Any kind of abuse in an Auto Splitter will result in an immediate ban.

Источник

Как сделать авто сплиты в livesplit

By fireb0rn fireb0rn Last updated 13 Sep 2021

If you are new to speedrunning Hollow Knight, please be sure to read through this guide thoroughly to ensure your setup is correct. If you are not recording your loadless time properly, then your run cannot be considered on any of the leaderboards, so if you’re not sure what to do, follow the steps below.

There is now a program to automatically generate splits files for various speedrunning categories. To use this, visit https://hksplitmaker.com/ and follow the instructions or view the video tutorial! This is recommended for beginners.

(1) Download and extract LiveSplit. Download link.

(2) Open LiveSplit. You should see a timer with «0.00». Right click on it and select Edit Splits.

If you used hksplitmaker, instead click Open Splits > From File and find the split file, then skip to step 5.

(3) In the Splits Editor, fill out your Game Name and Run Category. Create splits by using the Insert buttons on the left. Viewing runs from other players may be helpful in deciding which splits to create. Example.

(4) After typing in Hollow Knight as the Game Name, the auto splitter should automatically be detected. Activate it and click on Settings. In this window, we set up triggers for each split. Every time we reach one of the triggers that we set, LiveSplit will automatically move on to the next split for us. Therefore, for each split you added earlier, you need to add the corresponding trigger. Click «Add Split» in the top left for each split you added earlier, and then find the triggers within the drop down boxes. If your category ends with killing Hollow Knight, you do not need to worry about adding this trigger, as the Autosplitter will automatically split at that point. When finished, hit OK to exit the Autosplitter and then OK to exit the Splits Editor. Example.

(5) Right click on your timer again and select Edit Layout this time.

(6) Feel free to skip this step if you want to design your own layout. In the Layout Editor, hit the + Button and add a Title, a Separator, Splits, a Detailed Timer, Previous Segment, and Sum of Best Segments. When finished, hit OK to exit the Layout Editor. Example. (Note: You no longer need «Hollow Knight Autosplitter» in the layout.)

(7) Right click on LiveSplit and under Compare Against, select Game Time.

(8) Right click on LiveSplit and create save files for both your Splits and Layout.

(9) Right click on Livesplit and select Settings. Take note of the hotkeys and make changes if desired. Ensure that the Global Hotkeys option is checked, as this will allow you to use the hotkeys while your Hollow Knight window is in focus.

(10) It’s time to test it out. With your LiveSplit open, start a new game of Hollow Knight. If your timer automatically begins and briefly pauses a couple of times as the game loads up, you’re good. Have fun on your run!

That’s it. If everything worked out, you may next decide to liven up your LiveSplit by making changes to the Layout Settings in the Layout Editor. Some also prefer to have a second timer to track their realtime speed as well. You can do this by creating a second timer in the Layout Editor, and in its settings, changing the Timing Method to Real Time.

If you have read through this thoroughly and have any problems, please ask us on the discord and you should be helped promptly.

Q. Why is my loadless timer not functioning, my timer lagging, or why has my timer not started up when I select new game?
A. Make sure you open LiveSplit after starting Hollow Knight. Try restarting LiveSplit. If that doesn’t work, try restarting Hollow Knight and then LiveSplit. If that doesn’t work, try restarting your computer.

Q. Why don’t any of my hotkeys work?
A. Make sure you have Global Hotkeys enabled under settings.

Q. Why are there so many empty splits / so much empty space in my layout?
A. In your layout editor, double click splits. Find the total splits setting and reduce it to the amount of splits you want to have displayed at any given time.

Q. Why does my autosplitter not automatically split on certain splits, or why does my autosplitter split randomly?
A. Double check that you are on the correct patch, as these glitches sometimes occur on later patches. If you cannot solve any of these errors with the autosplitter, contact @ DevilSquirrel DevilSquirrel in the discord. Also, ensure that you know what your «Undo Split» hotkey is in the settings in case it is needed.

If you have any other problems, try running LiveSplit as an administrator.

Источник

Voxelse / LiveSplit.AutoSplitters Go PK Goto Github PK

Auto Splitters for LiveSplit

LiveSplit.AutoSplitters’s Introduction

LiveSplit has integrated support for Auto Splitters. An Auto Splitter can be one of the following:

At the moment LiveSplit can automatically download and activate Auto Splitters that are LiveSplit Components or ASL Scripts. Support for applications using the LiveSplit Server is planned, but is not yet available.

Features of an Auto Splitter

An Auto Splitter can provide any of the following features:

Game Time can either be Real Time without Loads or an actual Game Timer found in the game. This depends on the game and the speedrun community of that game. If the game has been run in Real Time for multiple years already, introducing a new timing method might not be worth it.

An Auto Splitter, as the name suggests, can also provide automatic splits to increase the accuracy of the individual segment and split times. An Auto Splitter might not necessarily implement Automatic Splits for every single split available since the runner might want to have some additional splits that are not supported by the Auto Splitter used.

Automatic Timer Start

Not every Auto Splitter automatically starts the timer. For some games, the Auto Splitter can’t tell whether the runner just wants to start the game to practice something or actually wants to do a run.

An Auto Splitter can automatically reset the timer. This might be useful for games where going back to the main menu always means that the run is over. This is a bit dangerous though, as the runner might not have wanted to reset there. Think twice before implementing this functionality into your Auto Splitter.

How an Auto Splitter works

Auto Splitters can work in one or multiple of the following ways:

A Pointer Path is a list of Offsets + a Base Address. The Auto Splitter reads the value at the base address and interprets the value as yet another address. It adds the first offset to this address and reads the value of the calculated address. It does this over and over until there are no more offsets. At that point, it has found the value it was searching for. This resembles the way objects are stored in memory. Every object has a clearly defined layout where each variable has a consistent offset within the object, so you basically follow these variables from object to object.

Cheat Engine is a tool that allows you to easily find Addresses and Pointer Paths for those Addresses, so you don’t need to debug the game to figure out the structure of the memory.

The Auto Splitting Language is a small scripting language made specifically for LiveSplit Auto Splitters. It has a few advantages and disadvantages over normal Components.

Advantages:

Disadvantages:

An ASL Script contains a State Descriptor and multiple Actions which contain C# code.

The State Descriptor is the most important part of the script and describes which game process and which state of the game the script is interested in. This is where all of the Pointer Paths, which the Auto Splitter uses to read values from the game, are described. A State Descriptor looks like this:

If the script needs to support multiple versions of the game, you can specify an optional version identifier:

The optional VERSION_IDENTIFIER can be any arbitrary string you wish to use. Note that the script can define multiple State Descriptors for different processes/games. These optional features are extremely useful for emulators.

POINTER_PATH describes a Pointer Path and has two ways to declare:

The variable type VARIABLE_TYPE describes the type of the value found at the pointer path. It can be one of the following:

TypeDescription
sbyteSigned 8-bit integer
byteUnsigned 8-bit integer
shortSigned 16-bit integer
ushortUnsigned 16-bit integer
intSigned 32-bit integer
uintUnsigned 32-bit integer
longSigned 64-bit integer
ulongUnsigned 64-bit integer
float32-bit IEEE floating-point
double64-bit IEEE floating-point
boolBoolean
stringString (e.g. string255)
byteByte array (e.g. byte255)

The variable name VARIABLE_NAME can be any variable name you choose, describing what is found at the pointer path. The naming is up to you, but should be distinct from the other variable names.

The optional base module name BASE_MODULE describes the name of the module the Pointer Path starts at. Every *.exe and *.dll file loaded into the process has its own base address. Instead of specifying the base address of the Pointer Path, you specify the base module and an offset from there. If this is not defined, it will default to the main (.exe) module.

You can use as many offsets OFFSET as you want. They need to be integer literals, either written as decimal or hexadecimal.

After writing a State Descriptor, you can implement multiple actions such as splitting and starting the timer. These actions define the logic of the Auto Splitter based on the information described by the State Descriptor. An action looks like this:

You can think of Actions like functions that are automatically called by the ASL Component. These functions can only interact with each other or LiveSplit via the special variables the environment provides.

Actions are implemented in C#. You can use C#’s documentation for any questions you may have regarding the syntax of C#.

These actions are repeatedly triggered while LiveSplit is connected to the game process.

Automatic Timer Start

Explicitly returning true will prevent the split action from being run. This can be useful in some cases, but may also cause issues for some scripts. See Order of Execution for more information.

NOTE: Make sure the timer is set to «Game Time» in the layout! Failure to do so will cause the timer to keep running, as if isLoading had returned false or isLoading weren’t triggered at all.

Order of Execution

Understanding the order and conditions under which timer control actions are executed can help you avoid issues in your script where variables appear to be set improperly, actions appear to be skipped, and more. Every update iteration follows this process when running actions:

Script Initialization (Game Start)

Actions have a few hidden variables available.

A dynamic object which can be used to store variables. Make sure the variables are defined (for example in startup or init ) before trying to access them. This can be used to exchange data between Actions.

You can also store variables like this in current and the value will be in old on the next update.

The default is the first defined State Descriptor with no version specified, or the first State Descriptor in the file if there is none with no version specified.

The string you set version to will also be displayed in the ASL Settings GUI.

Used to add and access Settings.

These variables depend on being or having been connected to a game process and are not available in the startup or exit actions and only partly available in shutdown (might be null ).

State objects representing the current and previous states.

The currently connected Process object.

The modules of the currently connected process. Please use this instead of game.Modules! Use modules.First() instead of game.MainModule.

Provides a means to read memory from the game without using the State Descriptor.

ASL script settings are stored either with the Layout if you are using the Scriptable Auto Splitter component or with the Splits if you activated the script in the Splits Editor (so make sure to save your Layout or Splits accordingly when exiting LiveSplit if you changed settings).

Actions that are not present in the ASL script or empty will have their checkboxes disabled.

You can define custom boolean settings for your script in the startup action and then access the setting values as configured by the user in the other actions. If you have custom settings defined, they will be shown in the GUI for the user to check/uncheck. They will appear in the same order you added them in the ASL script.

You can define settings in the startup action by using the settings.Add(id, default_value = true, description = null, parent = null) method:

You can access the current value of a setting in all actions other than startup by accessing settings :

If you want to organize the settings in a hierarchy, you can specify the parent parameter. Note that the parent has to be the id of a setting that you already added:

Settings only return true (checked) when their parent setting is true as well. The user can still freely toggle settings that have their parent unchecked, however they will be grayed out to indicate they are disabled.

Any setting can act as a parent setting, so you could for example do the following to go one level deeper (continuing from the last example):

The setting mission1_part1 will only be enabled, when both mission1 and main_missions are enabled.

When the parent parameter is null or omitted, the setting will be added as top-level setting, unless settings.CurrentDefaultParent is set to something other than null :

Using settings.CurrentDefaultParent can be useful when adding several settings with the same parent, without having to specify the parent every time.

You can add a tooltip to settings that appears when hover over the setting in the GUI. This can be useful if you want to add a bit more information. After adding the setting, use settings.SetToolTip(id, tooltip_text) to set a tooltip:

Used for debug printing. Use DbgView to watch the output.

There are some advanced memory utilities not covered here. You can find them here.

Testing your Script

You can test your Script by adding the Scriptable Auto Splitter component to your Layout. Right-click on LiveSplit and choose «Edit Layout. » to open the Layout Editor, then click on the Plus-sign and choose «Scriptable Auto Splitter» from the section «Control». You can set the Path of the Script by going into the component settings of the Scriptable Auto Splitter. To get to the settings of the component you can either double click it in the Layout Editor or go into to the Scriptable Auto Splitter Tab of the Layout Settings. Once you’ve set the Path, the script should automatically load and hopefully work.

Reading debug output is an integral part of developing ASL scripts, both for your own debug messages which you can output with print() and any debug messages or error messages the ASL Component itself provides.

The program DebugView can be used for a live view of debug output from the ASL Component.

For errors, you can also check the Windows Event Logs, which you can find via:

Control Panel ➞ Search for Event Viewer ➞ Open it ➞ Windows Logs ➞ Application ➞ Find the LiveSplit Errors

Some might be unrelated to the Script, but it’ll be fairly obvious which ones are caused by you.

Adding an Auto Splitter

If you implemented an Auto Splitter and want to add it to the Auto Splitters that are automatically being downloaded by LiveSplit, feel free to add it to the Auto Splitters XML. Just click the link, click the icon for modifying the file and GitHub will automatically create a fork, branch and pull request for you, which we can review and then merge in.

Any kind of abuse in an Auto Splitter will result in an immediate ban.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *