Organizing your workshop code

TLDR;
Because i like to have a neat and organized workshop, my OCD gets the better of me at time and I change/move around variable names so i can group them together. Originally, i would go into EVERY action of EVERY rule that had a specific variable(s), and change it to the new variable(s). What a PINA… Then I realized you can use the Control + H function in a text editor to change the variable. (just gotta make sure you call it something unique enough to Not change anything else) That’s all and good but:

How would i go about moving a variable UP in the list?
This list being the list of all your Global & Player Variable names. How they are ordered (A-Z, 0-25) + the variables you can add.

TLDR #2:
For example, lets say I have a Variable called Brig in Variable slot 26. (this variable does something specific for Brigitte only) And as my game grows, I add more variables for various reasons… Now let’s say I need another Variable for Brigitte (We’ll call it Brig_2) However, variable slot 27 is already in use. So the only way to have the two Brig variables grouped together in the Variable List is to either;
A, move the variable in slot 27 to the bottom of the list, so then i can change #27 to Brig_2
OR
B, Move Brig to the bottom of the list and have a hole in my variable list (and since all my variables After Brig where Other variables specific to Other heros, IN ALPHABETICAL order) so now Brig & Brig_2 are out of place…

OCD’s a B**CH…

Let’s say you’ve taken a few too many turns to achieve you goal, replacing is only important if you want to rename a variable.
If you want to change the order all you need to do is:

Turn

variables
{
	global:
		3: CurrentNode
		4: MapIsEichenwalde
		5: HealthpackLocations
		9: Waypoints
}

into this

variables
{
	global:
		2: CurrentNode
		1: MapIsEichenwalde
		3: HealthpackLocations
		0: Waypoints
}

and you’ll have the order changed.
It doesn’t matter that they’re out of order, the game will still apply all variable names while applying the Script.

It doesn’t matter either if you in your hassle to change the order skip a number, that variable will revert to it’s default name / state.
0-25 will be matched with the according letter in the alphabet and numbers after that will be removed from the Script. (You’ll still have that number jump though)

1 Like