In-Game C# Scripting and Compilation 2

.Net Developers


Description


In-Game C# Scripting and Compilation

This script, packaged with a demo mod menu template, will allow the GTA V RAGE engine to assist you in writing and compiling, yes even compiling, a c# script while you are playing the game. This has never been done before.

Major Enhancement Version 2 - Compilation done in GTA V

You no longer need Visual Studio to be open! For those using Visual Studio, the Code Creator Script now will automatically compile your target script which in this demo is the Menu mod script.

Can you imagine no longer going back and forth from Visual Studio to game? No editing and recompiling and alt tabbing dozens of times. The edits and the compilation (build or rebuild) are done in GTA V, in the game itself at run time. You don't even need to have Visual Studio open while editing and adding new code.

IMPORTANT: make sure all the paths are your own including any post build paths you might have, if not this will drive you nuts. IMPORTANT: if you're creating a mod menu, based on this code, remember that the index must start at 0. If not this will also drive you crazy. If in doubt, just delete the Counter.txt file in the Menu folder.

By default, F5 is for location name, capture, and append. F6 is for compilation. After compilation, restart SHDVN. This part will not be automated as it should be on demand.

Introduction

I had a dream. What if you could actually write a script while in GTA V, I mean while you're in the game. I don't mean alt tabbing or ctrl escaping back and forth, I meant the game would record player stats like positions, or record car colors and extras, or what a ped was wearing and which hairstyle with the game generating the code - RTC - ready to compile code! They said it couldn't be done. Well that's what I was told when I started modding and didn't know any better. Who was I to question the experts? Fast forward to today and I come to realize this is actually much simpler than it seems and is entirely doable. In fact it's done and now uploaded.

The Tools

The download contains two customizable tools in the form of C# source code:

  1. A simple LemonUI Menu Script with pre-defined standard functions but non-functional as is.
  2. The second tool is the Creator Script which ofc creates the script.

In our demo this is a simple LemonUI Mod for teleports, but it is created while in game. Yes, while in game. The Creator script captures input by the dev (or user) and appends it to the Menu Script. Of course you will need to recompile the Menu script as code is appended directly to it, in the background while you are in game. The code is appended by the Creator Script. After the recompile you will need to refresh SHDVN.

Installation

None required. Source codes needs to be compiled with VS or other compiler. File paths need to be updated to reflect user's directories/folders rather than mine. Requirements are the usual: SH5 and latest build of SHVDN and LemonUI. You might need nightly build of SHVDN.

Configuration

You can change whatever you want since you have the source code. Keep in mind the comments that start with \\ INSERT are used by the Creator code so caution if you play with these. Also, a Counter.txt file is also saved to keep track of how many locations (in this demo) you have created as the items are incremented. Also note that the items in the LemonUI menu must start at 0, so start with a clean counter text file. If necessary, delete the file. It will be recreated. Also good practice to close the Menu Script while in game.

N.B. The Counter.txt allows you to create locations, shutdown, restart, and have the counter properly reflect where you are.


First Upload: November 11, 2024 Last Updated: November 11, 2024


0 Comments