Vstr (variable string) allows you to create shortcuts for commands. Risk of Rain 2 supports them, but the code for substituting them is broken. This mod fixes that while also adding new functionalities:
set_vstr changes:
clear_vstr which removes all aliases.del_vstr [alias] which removes the specified alias.get_vstr [alias] which prints the value for the specified alias. If no argument is provided, it prints them all.WARNING: If some command suddenly stops working, check for and clear any registered aliases, as they may contain a string that you have intended to use literally for the broken command.
The following examples use DebugToolkit, which features a wide range of commands.
The general usage is
set_vstr <alias_name> <command_string>
set_vstr gi give_item
gi hoof
set_vstr ghoof "give_item hoof"
ghoof 5
ghoof -5
set_vstr h5 "hoof 5"
give_item h5
remove_item h5
set_vstr reset "remove_all_items; remove_equip"
reset
Change the behaviour of a keybind with each press by creating a cyclical reference of aliases.
set_vstr k "kill_all; dt_bind x s1"
set_vstr s1 "spawn_ai wisp; dt_bind x s2"
set_vstr s2 "spawn_ai beetle; dt_bind x k"
dt_bind x k
Vstrs do not persist and have to be set every time you launch the game. You can automate the process by doing the following:
exec <custom_name> in the console once the game has loaded.Alternatively, add the above command or your actual commands to "autoexec.cfg", also located in the same directory. which will automatically do everything for you.
These are the features of the Command Parser. No changes are made, they are just here as a summary:
_.-:. Any other character is ignored and effectively separates tokens, e.g. a?b:c d/e is parsed as a b:c d e.", ', \", and \'.
console_enabled 0, freely use it, and then reenable the console.echo "1 2 3" is functionally the same as echo "1 2 3.set_vstr a "set_vstr b 'echo \"1 2 3\"'"
a // register the b alias
b // prints 1 2 3
// ignores everything until the next newline./* */ is for multiline comments and can be used even within a command but acts as a token separator. For example a/*ignore all this*/b will be parsed as a b.