greybel-vsToolkit for GreyScript which is a scripting language used in Grey Hack. This extension includes highlighting, code execution, bundling and minifying among other features. Links
UsageAutomatically detects Commands available (
You can also access most of the commands via the context menu: Do not forget to set up Greybel to your needs. Settings
Features
TransformTranspiles your code into a certain format. Remember to select your desired output in the settings. The build type "Default" is selected from the start. Output modesThere are three different modes "Default", "Uglify" and "Beautify". Depending on which you select the output will be different. As the name already says "Default" will not have any special behavior such as optimization or formatting. If in doubt this format is probably the best allrounder. "Uglify" will not only minify your code but also do literals and namespace optimization. Both of the features can be turned off as well since certain code may require namespace optimization to be turned off since namespaces may need to remain exactly named as they are since the code depends on it. Alternatively, you can also exclude namespaces from optimization. "Beautify" is the complete opposite of "Uglify" and will instead try to format your code in a way to improve readability. As of right now, there is currently no customizability available which may restrict its use case. Imports (Transform)Important: Unlike building transforms will ignore any #include, #import or import_code line. Use the build functionality instead. Environment (Transform)Greybel enables you to inject environment variables when transforming. These environment variables can be configured in the extension settings. BuildBuilding will transform and bundle your scripts in a way that makes it easy to import into the Grey Hack. Just as mentioned in the transform section building provides three different output modes as well. These output modes are "Default", "Uglify" and "Beautify". If you want to know more about them please take a look at the output-modes section. Auto create files in-gameIt is possible to automatically create transpiled files in the game. This can be activated by enabling the create-ingame option. Additionally, you can choose between two agents. Depending on the agent there are certain prerequisites to fulfill or behaviors to watch out for. HeadlessWhen you are using headless you are essentially connecting to the game without using the actual native game client. Depending on which mode you selected, either By default A minor caveat is that a Steam account and password need to be provided. The refresh token will be cached so no continued providing of credentials is required. You can delete the refresh token at any time by using the "Clear secrets" command. Note: This agent will potentially log you out of Grey Hack since Grey Hack only allows one active game session. Message HookThe message-hook agent will essentially send messages to the game server through the game client. For that to work you'll have to install BepInEx first and then the plugin second. Here are the prerequisites:
With all that done you can now start the game and start either a single-player or multiplayer session. You'll be now able to sync files with the game without getting disconnected. Additionally, you won't need to provide any Steam credentials nor do you need to select a mode. Note: For this agent to work you have to have Grey Hack running. Imports on buildingScripting in Grey Hack can be hell. Especially when you have files that import each other or any kind of bigger project where you have to copy-paste each file by hand into the game every time. Greybel tries to aid you so you spend less time copy-pasting and more time coding and playing. Dependency Management (Transpiler)Greybel enables you to split your code into different files which is useful to keep readability and also to make reusable code. It is recommended to use include and import for small or medium-sized projects. For big projects, import_code should be used instead since the transpiler will bundle your files in a way that makes full use of the import_code capabilities in the game to avoid exceeding the maximum character limit of 160.000. Cyclic dependencies will be detected as well. In case there is one an error will be thrown indicating which file is causing it. A step by step guide is available here as well. ImportUsed to import exported namespaces from a file. Features of this import functionality:
You can take a look at the example code to get a better idea of how to use this feature. IncludeUsed to import the content of a file. Features of this import functionality:
To get a better idea you can take a look at the following example code. import_codeUsed to import code from a file. Features of this import functionality:
Here is some example code. By having the installer option active Greybel will create one or more installer files depending on the size of your project. These installer files will essentially contain all different code files and logic to create all files in the game. So basically you just need to copy and paste the code of the installer files into the game and then compile + execute them. By using the By setting up the in-game directory in the settings you can also define to which in-game space you want to import the files. By default Additionally, it is important to mention that nested UploadIn case you are not interested at all in the build functionality or require to upload a lot of files into the game you can also use the "Import files into game" command. It will pretty much have the same behavior as the create-ingame build feature just without building. This feature will also use the transpiler "Ingame directory" setting as the in-game destination. InterpreterGreybel comes with its own GreyScript interpreter. Which enables you to test and debug your code outside of the game. This is partly also due to the test environment which gets generated on the fly trying to emulate the games API. Dependency Management (Interpreter)Dependencies will be dynamically loaded into the execution without any limitations. Cyclic dependencies are supported as well. Environment Variables (Interpreter)Greybel supports the injection of environment variables for the interpreter as well. These environment variables can be configured in the extension settings. Local environmentGreybel GreyHack Intrinsics will automatically generate a local environment. It will also generate other computers, networks, filesystems etc on the fly. Generating is by default based on a seed called The local computer setup is hard coded. The admin credentials are Examples:
Greyscript API supportThe intrinsics to support the Greyscript API are provided by Greybel Intrinsics and Greybel GreyHack Intrinsics. Keep in mind that not all of these functions are completely mocked. Also, only API that is available in the stable build will be implemented. Not yet supported:
TextMesh Pro Rich Text supportTextMesh Pro Rich Text is partially supported. Note: For the pseudo-terminal Greybel will try to transform TextMesh Pro Rich-Text tags into ANSI-Codes. Due to the nature of TextMesh Pro Rich-Text tags some formatting will get lost. If you are looking for a proper preview of your output in Grey Hack please check out the preview output feature. DebuggerEnables you to set breakpoints, run code in a breakpoint context, jump to the next line of execution etc. Generally helpful if you want to debug your code. Keep in mind to set the breakpoint on a none empty line. Otherwise, it will just skip that breakpoint. A REPL is also available while executing the script or having an active breakpoint. Preview outputWill create a web view that will render actual TextMesh Pro Rich-Text tags in your VSCode. Main purpose of this feature is to emulate the actual output of the game. So in case you want to draw images or do fancy prompts this might be useful. API BrowserAPI Browser for GreyScript. Basically a version of the GreyScript API Documentation page within Visual Studio Code. ShareShares your code via editor.greyscript.org. The related link will be written into the clipboard. RefreshWill refresh the AST Cache which is used for diagnostics, hover tooltips and autocompletion. SnippetsWill return a list of available GreyHack snippets. Such as Goto ErrorJumps to the next existing syntax error. Supporting providersAutocompletion ProviderFigures out the current context and provides suggestions accordingly. Hover Tooltips ProviderReturns information about functions/types. Diagnostics ProviderReturns information about syntax errors in your code. Symbol ProviderReturns list of all available symbols in the active file. Definition ProviderShows definitions in the currently active file and its dependencies. Colorpicker ProviderShows the color picker if you got color or mark tags. CopyrightSloth icons created by Freepik - Flaticon Todo
ContactIf you have any questions, feature requests or need help feel free to join the dedicated Greybel Discord. |