This is part 1 of 2 for my code that I wnat to have changed to ASCII-varibles.
Please wait for Part 2
// Define cargo container keywords to be used by Autosort.
const string oreContainerKeyword = "Ores";
const string ingotContainerKeyword = "Ingots";
const string componentContainerKeyword = "Components";
const string toolContainerKeyword = "Tools";
const string ammoContainerKeyword = "Ammo";
const string bottleContainerKeyword = "Bottles";
const string iceContainerKeyword = "Eis";

// Keyword a block name has to contain to be excluded from sorting (does mostly apply for cargo containers).
// This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed.
// Default: string[] lockedContainerKeywords = { "Locked", "Control Station", "Control Seat", "Safe Zone" };
string[] lockedContainerKeywords = { "Locked", "Control Station", "Control Seat", "Safe Zone" };

// Keyword a block name has to contain to be excluded from item counting (used by autocrafting and inventory panels)
// This list is expandable - just separate the entries with a ",". But it's also language specific, so adjust it if needed.
// Default: string[] hiddenContainerKeywords = { "Hidden" };
string[] hiddenContainerKeywords = { "Hidden" };

// Treat inventories that are hidden via disabling the terminal option "Show block in Inventory Screen" as hidden containers
// just like adding the 'Hidden' keyword (see above)? (Note: It's not recommended to hide your main type containers!)
bool treatNotShownAsHidden = false;

// Keyword for connectors to disable sorting of a grid, that is docked to that connector.
// This will prevent IIM from pulling any items from that connected grid.
// Special containers, reactors and O2/H2 generators will still be filled.
string noSortingKeyword = "[No Sorting]";

// Keyword for connectors to disable IIM completely for another grid, that is docked to that connector.
string noIIMKeyword = "[No Autosort]";

// Balance items between containers of the same type? This will result in an equal amount of all items in all containers of that type.
bool balanceTypeContainers = true;

// Show a fill level in the container's name?
bool showFillLevel = true;

// Fill bottles before storing them in the bottle container?
bool fillBottles = true;


// ====== Automated container assignment 

// Master switch. If this is set to false, automated container un-/assignment is disabled entirely.
bool autoContainerAssignment = true;

// Assign switch. Assign new containers if a type is full or not present?
bool assignNewContainers = false;

// Which type should be assigned automatically? (only relevant if master and assign switch are true)
bool assignOres = true;
bool assignIngots = true;
bool assignComponents = true;
bool assignTools = true;
bool assignAmmo = true;
bool assignBottles = true;

// Unassign switch. Unassign empty type containers that aren't needed anymore (at least one of each type always remains).
// This doesn't touch containers with manual priority tokens, like [P1].
bool unassignEmptyContainers = false;

// Which type should be unassigned automatically? (only relevant if master and unassign switch are true)
bool unassignOres = true;
bool unassignIngots = true;
bool unassignComponents = true;
bool unassignTools = true;
bool unassignAmmo = true;
bool unassignBottles = true;

// Assign ores and ingots containers as one? (complies with type switches)
bool oresIngotsInOne = false;

// Assign tool, ammo and bottle containers as one? (complies with type switches)
bool toolsAmmoBottlesInOne = true;


// ====== Autocrafting 

// Enable autocrafting or autodisassembling (disassembling will disassemble everything above the wanted amounts)
// All assemblers will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
bool enableAutocrafting = true;
bool enableAutodisassembling = false;

// A LCD with the keyword "Autocrafting" is required where you can set the wanted amount!
// This has multi LCD support. Just append numbers after the keyword, like: "LCD Autocrafting 1", "LCD Autocrafting 2", ..
string autocraftingKeyword = "Autocrafting";

// If you want an assembler to only assemble or only disassemble, use the following keywords in its name.
// A assembler without a keyword will do both tasks
string assembleKeyword = "!assemble-only";
string disassembleKeyword = "!disassemble-only";

// You can teach the script new crafting recipes, by adding one of the following tags to an assembler's name.
// There are two tag options to teach new blueprints:
// !learn will learn one item and then remove the tag so that the assembler is part of the autocrafting again.
// !learnMany will learn everything you queue in it and will never be part of the autorafting again until you remove the tag.
// To learn an item, queue it up about 100 times (Shift+Click) and wait until the script removes it from the queue.
string learnKeyword = "!learn";
string learnManyKeyword = "!learnMany";

// Default modifier that gets applied, when a new item is found. Modifiers can be one or more of these:
// 'A' (Assemble only), 'D' (Disassemble only), 'P' (Always queue first (priority)), 'H' (Hide and manage in background), 'I' (Hide and ignore)
string defaultModifier = "";

// Margins for assembling or disassembling items in percent based on the wanted amount (default: 0 = exact value).
// Examples:
// assembleMargin = 5 with a wanted amount of 100 items will only produce new items, if less than 95 are available.
// disassembleMargin = 10 with a wanted amount of 1000 items will only disassemble items if more than 1100 are available.
double assembleMargin = 20;
double disassembleMargin = 0;

// Show unlearned (mostly modded) items on the autocrafting screen? This adds the [NoBP] tag (no blueprint) like in the old days of IIM.
bool showUnlearnedItems = false;

// Use assemblers on docked grids?
bool useDockedAssemblers = false;

// Add the header to every screen when using multiple autocrafting LCDs?
bool headerOnEveryScreen = false;

// Show available modifiers help on the last screen?
bool showAutocraftingModifiers = true;

// Split assembler tasks (this is like cooperative mode but splits the whole queue between all assemblers equally)
bool splitAssemblerTasks = true;

// Sort the assembler queue based on the most needed components?
bool sortAssemblerQueue = true;

// Autocraft ingots from stone in survival kits until you have proper refineries?
bool enableBasicIngotCrafting = true;

// Disable autocrafting in survival kits when you have regular assemblers?
bool disableBasicAutocrafting = true;


// ====== Special Loadout Containers

// Keyword an inventory has to contain to be filled with a special loadout (see in it's custom data after you renamed it!)
// Special containers will be filled with your wanted amount of items and never be drained by the auto sorting!
const string specialContainerKeyword = "Special";

// Are special containers allowed to 'steal' items from other special containers with a lower priority?
bool allowSpecialSteal = true;


// ====== Refinery handling

// By enabling ore balancing, the script will balance the ores between all refinieres so that every refinery has the same amount of ore in it.
// To still use a refinery manually, add the manualMachineKeyword to it (by default: "!manual")
bool enableOreBalancing = true;

// Enable script assisted refinery filling? This will move in the most needed ore and will make room, if the refinery is already full
// Also, the script puts as many ores into the refinery as possible and will pull ores even from other refineries if needed.
bool enableScriptRefineryFilling = true;

// Sort the refinery queue based on the most needed ingots?
bool sortRefiningQueue = true;

// Use refineries on docked grids?
bool useDockedRefineries = false;

// If you want an ore to always be refined first, simply remove the two // in front of the ore name to enable it.
// Enabled ores are refined in order from top to bottom so if you removed several // you can change the order by
// copying and pasting them inside the list. Just be careful to keep the syntax correct: "OreName",
// By default stone is enabled and will always be refined first.
List<String> fixedRefiningList = new List<string> {
	"Stone",
	"Scrap",
	//"Iron",
	//"Nickel",
	//"Cobalt",
	//"Silicon",
	//"Uranium",
	//"Silver",
	//"Gold",
	//"Platinum",
	//"Magnesium",
};


// ====== O2/H2 generator handling

// Enable balancing of ice in O2/H2 generators?
// All O2/H2 generators will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
bool enableIceBalancing = true;

// Put ice into O2/H2 generators that are turned off? (default: false)
bool fillOfflineGenerators = false;

// How much space should be left to fill bottles (aka how many bottles should fit in after it's filled with ice)?
// WARNING! O2/H2 generators automatically pull ice and bottles if their inventory volume drops below 30%.
// To avoid this, turn off "Use Conveyor" in the generator's terminal settings.
int spaceForBottles = 1;


// ====== Reactor handling 

// Enable balancing of uranium in reactors? (Note: conveyors of reactors are turned off to stop them from pulling more)
// All reactors will be used. To use one manually, add the manualMachineKeyword to it (by default: "!manual")
bool enableUraniumBalancing = true;

// Put uranium into reactors that are turned off? (default: false)
bool fillOfflineReactors = false;

// Amount of uranium in each reactor? (default: 100 for large grid reactors, 25 for small grid reactors)
double uraniumAmountLargeGrid = 100;
double uraniumAmountSmallGrid = 25;


// ====== Assembler Cleanup 

// This cleans up assemblers, if they have no queue and puts the contents back into a cargo container.
bool enableAssemblerCleanup = true;


// ====== Internal item sorting 

// Sort the items inside all containers?
// Note, that this could cause inventory desync issues in multiplayer, so that items are invisible
// or can't be taken out. Use at your own risk!
bool enableInternalSorting = false;

// Internal sorting pattern. Always combine one of each category, e.g.: 'Ad' for descending item amount (from highest to lowest)
// 1. Quantifier:
// A = amount
// N = name
// T = type (alphabetical)
// X = type (number of items)

// 2. Direction:
// a = ascending
// d = descending

string sortingPattern = "Na";

// Internal sorting can also be set per inventory. Just use '(sort:PATTERN)' in the block's name.
// Example: Small Cargo Container 3 (sort:Ad)
// Note: Using this method, internal sorting will always be activated for this container, even if the main switch is turned off!


// ====== LCD panels 

// To display the main script informations, add the following keyword to any LCD name (default: Autosort-main).
// You can enable or disable specific informations on the LCD by editing its custom data.
string mainLCDKeyword = "Autosort-main";

// To display current item amounts of different types, add the following keyword to any LCD name
// and follow the on screen instructions.
string inventoryLCDKeyword = "Autosort-inventory";

// To display all current warnings and problems, add the following keyword to any LCD name (default: Autosort-warnings).
string warningsLCDKeyword = "Autosort-warnings";
bool showOwnerWarnings = true;

// To display all actions, the script did lately, add the following keyword to any LCD name (default: Autosort-actions).
string actionsLCDKeyword = "Autosort-actions";
bool showTimeStamp = true;
int maxEntries = 30;

// To display the script performance (PB terminal output), add the following keyword to any LCD name (default: Autosort-performance).
string performanceLCDKeyword = "Autosort-performance";

// Default screen font, fontsize and padding, when a screen is first initialized. Fonts: "Debug" or "Monospace"
string defaultFont = "Debug";
float defaultFontSize = 0.6f;
float defaultPadding = 2f;


// ====== Settings for enthusiasts 

// Extra breaks between script methods in ticks (1 tick = 16.6ms).
double extraScriptTicks = 0;

// Use dynamic script speed? The script will slow down automatically if the current runtime exceeds a set value (default: 0.5ms)
bool useDynamicScriptSpeed = true;
double maxCurrentMs = 0.5;

// If you want to use a machine manually, append the keyword to it.
// This works for assemblers, refineries, reactors and O2/H2 generators
string[] manualMachineKeywords = { "!manual" };

// List of always excluded block types (not NAMES!). Mostly because they don't have conveyors or Autosort shouldn't tinker with them.
string[] excludedBlocks = { "Parachute", "VendingMachine" };

// Exclude welders, grinders or drills from sorting? Set this to true, if you have huge welder or grinder walls!
bool excludeWelders = false;
bool excludeGrinders = false;
bool excludeDrills = false;

// Enable connection check for inventories (needed for [No Conveyor] info)?
bool connectionCheck = false;

// Tag inventories, that have no access to the main type containers with [No Conveyor]?
// This only works if the above setting connectionCheck is set to true!
bool showNoConveyorTag = false;

// Use connected grids as temporary storage for temporary storage?
// This only affects balancing methods or Special container unloading if no storage is available on your main grid.
bool useConnectedGridsTemporarily = true;

// Script mode: "ship", "station" or blank for autodetect
string scriptMode = "";

// Protect type containers when docking to another grid running the script?
bool protectTypeContainers = true;

// Enable name correction? This option will automtically correct capitalization.
bool enableNameCorrection = false;

// Autosort considers an inventory with 98% fill level as full. For very large containers, this value would waste a lot of space.
// Large containers use the following static value as space left in liters (default: 500L).
// Calculation: IF maxVolume - maxVolume * 0.98 > inventoryFullBuffer USE inventoryFullBuffer (by default if max volume > 25000L).
double inventoryFullBuffer = 500;

// Format of the actionsLCD timestamp.
string timeFormat = "HH:mm:ss";


List<IMyTerminalBlock>ʪ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʩ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʫ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʬ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʵ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʿ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʽ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʼ=new List<IMyTerminalBlock>();
List<IMyShipConnector>Connectors=new List<IMyShipConnector>();
List<IMyRefinery>Refineries=new List<IMyRefinery>();
List<IMyRefinery>ʹ=new List<IMyRefinery>();
List<IMyRefinery>ʸ=new List<IMyRefinery>();
List<IMyRefinery>ʷ=new List<IMyRefinery>();
List<IMyAssembler>ʾ=new List<IMyAssembler>();
List<IMyAssembler>ʶ=new List<IMyAssembler>();
List<IMyAssembler>ʴ=new  List<IMyAssembler>();
List<IMyAssembler>ʳ=new List<IMyAssembler>();
List<IMyAssembler>ʲ=new List<IMyAssembler>();
List<IMyGasGenerator>ʱ=new List<IMyGasGenerator>();
List<IMyGasTank>Reactors=new List<IMyGasTank>();
List<IMyReactor>ʯ=new List<IMyReactor>();
List<IMyTextPanel>ʮ=new List<IMyTextPanel>();
List<string>ʭ=new List<string>();
HashSet<IMyCubeGrid>ʨ=new HashSet<IMyCubeGrid>();
HashSet<IMyCubeGrid>ʓ=new HashSet<IMyCubeGrid>();
List<IMyTerminalBlock>ʝ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʑ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʐ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʏ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʎ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʍ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʌ=new List<IMyTerminalBlock>();
HashSet<string>ʋ=new HashSet<string>();
IMyTerminalBlock ʊ;
IMyInventory ʉ;
IMyTerminalBlock ʈ;
IMyTerminalBlock ʇ,ʆ;
bool ʅ=false;
int ʄ=0;
int ʃ=0;
int ʒ=0;
int ʂ=0;
int ʔ=0;
int ʧ=0;
int ʥ=0;
int ʤ=0;
int ʣ=0;
int ʢ=0;
int ʡ=0;
int ʠ=0;
int ʟ=0;
int ʦ=0;
string[]ʞ={"/","-","\\","|"};
int ʜ=0;
List<String>ʛ=new List<string>();
string ʚ="";
List<IMyTerminalBlock>ʙ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʘ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʗ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʖ=new List<IMyTerminalBlock>();
List<IMyTerminalBlock>ʕ=new List<IMyTerminalBlock>();
StringBuilder ʁ=new StringBuilder();
string[]Ƶ={"showHeading=true","showWarnings=true","showContainerStats=true","showManagedBlocks=true","showLastAction=true","scrollTextIfNeeded=true"};
string[]Ș={"showHeading=true","scrollTextIfNeeded=true"};
string[]ȹ={"showHeading=true","scrollTextIfNeeded=false"};
string ŕ;
int ȸ=0;
bool ȷ=false;
string ȶ="";
bool ȵ=false;
bool ȴ=false;
bool Ⱥ=false;
HashSet<string>ȳ=new HashSet<string>();
HashSet<string>ȱ=new HashSet<string>();
int Ȱ=0;
int ȯ=0;
int Ȯ=0;
bool ȭ=false;
bool Ȭ=true;
bool ȫ=false;
int Ȳ=0;
string ȼ="itemID;blueprintID";
Dictionary<string,string>Ʌ=new Dictionary<string,string>(){
	{"oreContainer",oreContainerKeyword},
	{"ingotContainer",ingotContainerKeyword},
	{"componentContainer",componentContainerKeyword},
	{"toolContainer",toolContainerKeyword},
	{"ammoContainer",ammoContainerKeyword},
	{"bottleContainer",bottleContainerKeyword},
	{"specialContainer",specialContainerKeyword},
	{"oreBalancing","true"},
	{"iceBalancing","true"},
	{"uraniumBalancing","true"}
};
string ɏ="Autocrafting";
string ɍ="Remove a line to show this item on the LCD again!\nAdd an amount to manage the item without being on the LCD.\nExample: '-SteelPlate=1000'";
char[]Ɍ={'=','>','<'};
IMyAssembler ɋ;
string Ɋ="";
MyDefinitionId ɉ;
int Ɉ=0;
HashSet<string>ɇ=new HashSet<string>{"Uranium","Silicon","Silver","Gold","Platinum","Magnesium","Iron","Nickel","Cobalt","Stone","Scrap"};
List<MyItemType>Ɏ=new List<MyItemType>();
List<MyItemType>Ɇ=new List<MyItemType>();
Dictionary<string,double>Ʉ=new Dictionary<string,double>(){{"Cobalt",0.3},{"Gold",0.01},{"Iron",0.7},{"Magnesium",0.007},{"Nickel",0.4},{"Platinum",0.005},{"Silicon",0.7},{"Silver",0.1},{"Stone",0.014},{"Uranium",0.01}};
const string Ƀ="MyObjectBuilder_";
const string ɂ="Ore";
const string Ɂ="Ingot";
const string ɀ="Component";
const string ȿ="AmmoMagazine";
const string Ⱦ="OxygenContainerObject";
const string Ƚ="GasContainerObject";
const string Ȫ="PhysicalGunObject";
const string Ȗ="PhysicalObject";
const string ȟ="ConsumableItem";
const string Ȕ="Datapad";
const string ȓ=Ƀ+"BlueprintDefinition/";
SortedSet<MyDefinitionId>Ȓ=new SortedSet<MyDefinitionId>(new ų());
SortedSet<string>ȑ=new SortedSet<string>();
SortedSet<string>Ȑ=new SortedSet<string>();
SortedSet<string>ȏ=new SortedSet<string>();
SortedSet<string>Ȏ=new SortedSet<string>();
SortedSet<string>ȍ=new SortedSet<string>();
SortedSet<string>Ȍ=new SortedSet<string>();
SortedSet<string>ȋ=new SortedSet<string>();
SortedSet<string>Ȋ=new SortedSet<string>();
SortedSet<string>ȉ=new SortedSet<string>();
SortedSet<string>Ȉ=new SortedSet<string>();
Dictionary<MyDefinitionId,double>ȇ=new Dictionary<MyDefinitionId,double>();
Dictionary<MyDefinitionId,double>Ȇ=new Dictionary<MyDefinitionId,double>();
Dictionary<MyDefinitionId,double>ȕ=new Dictionary<MyDefinitionId,double>();
Dictionary<MyDefinitionId,int>ȅ=new Dictionary<MyDefinitionId,int>();
Dictionary<MyDefinitionId,MyDefinitionId>ȗ=new Dictionary<MyDefinitionId,MyDefinitionId>();
Dictionary<MyDefinitionId,MyDefinitionId>ȩ=new Dictionary<MyDefinitionId,MyDefinitionId>();
Dictionary<string,MyDefinitionId>ȧ=new Dictionary<string,MyDefinitionId>();
Dictionary<string,string>Ȧ=new Dictionary<string,string>();
Dictionary<string,IMyTerminalBlock>ȥ=new Dictionary<string,IMyTerminalBlock>();
bool Ȥ=false;
string ȣ="station_mode;\n";
string Ȣ="ship_mode;\n";
string ȡ="[PROTECTED] ";
string Ȩ="";
string Ƞ="";
string Ȟ="";
DateTime ȝ;
int Ȝ=0;
string ț="Startup";
string[]Ț={"Get inventory blocks","Find new items","Create item lists","Name correction","Assign containers",
"Fill special containers","Sort cargo","Container balancing","Internal sorting","Add fill level to names","Get global item amount",
"Get assembler queue","Autocrafting","Sort assembler queue","Clean up assemblers","Learn unknown blueprints","Fill refineries",
"Ore balancing","Ice balancing","Uranium balancing"};
string[]ș={"Initializing script","","Getting inventory blocks","Loading saved items","Clearing assembler queues","Checking type containers","Setting script mode","Starting script",""};
Program(){
	inventoryFullBuffer/=1000;
	assembleMargin/=100;
	disassembleMargin/=100;
	Runtime.UpdateFrequency=UpdateFrequency.Update10;
	}
void Main(string ɐ){
	if(ȸ>=10){
		throw new Exception("Too many errors in script step "+Ȯ+":\n"+ț+"\n\nPlease recompile or try the reset argument!\nScript stoppped!\n\nLast error:\n"+ȶ+"\n");
	}
	try{
		if(Ȭ){
			ț=ș[Ȯ];
			ɲ();
			return;
		}
		if(ɐ!=""){
			Ȟ=ɐ;
			Ȯ=1
			Ƞ="";
			ȝ=DateTime.Now;
			Ȝ=ȗ.Count;
		}
		if(useDynamicScriptSpeed){
			if(Ȱ>0){
				Ǧ("Dynamic script speed control");
				Í("..");
				Ȱ--;
				return;
			}
		}
		if(ȯ<extraScriptTicks){
			Runtime.UpdateFrequency=UpdateFrequency.Update1;
			ȯ++;
			return;
		}
		else{
			Runtime.UpdateFrequency=UpdateFrequency.Update10;
		}
		if(ȫ){
			if(Ȳ==0)ő();
			if(Ȳ==1)Ŏ();
			if(Ȳ==2)ŗ();
			if(Ȳ==3)Ŀ();
			if(Ȳ==4)ļ();
			if(Ȳ>4)Ȳ=0;
			ȫ=false;
			return;
		}
		if(Ȯ==0||ȴ||ʅ){
			if(!Ⱥ)ɞ();
			if(ʅ)return;
			ȴ=false;
			Ⱥ=false;
			if(!Ǥ()){
				ʘ=ǣ(mainLCDKeyword,Ƶ,defaultFont,defaultFontSize,defaultPadding);
				ʗ=ǣ(warningsLCDKeyword,Ș,defaultFont,defaultFontSize,defaultPadding);
				ʙ=ǣ(actionsLCDKeyword,ȹ,defaultFont,defaultFontSize,defaultPadding);
				ʖ=ǣ(performanceLCDKeyword,Ș,defaultFont,defaultFontSize,defaultPadding);
				ʕ=ǣ(inventoryLCDKeyword,null,defaultFont,defaultFontSize,defaultPadding);
			}
			else{
				ȴ=true;
				Ⱥ=true;
				return;
			}
		}
		if(!Ȥ)ɫ();
		if(ɰ(Ȟ))return;
		ȯ=0;
		ȫ=true;
		if(showTimeStamp){
			ʚ=DateTime.Now.ToString(timeFormat)+":\n";
		}
		if(Ȯ==1){
			Ú();
		}
		if(Ȯ==2){
			ß();
		}
		if(Ȯ==3){
			if(enableNameCorrection)ό();
		}
		if(Ȯ==4){
			if(autoContainerAssignment){
				if(unassignEmptyContainers)ϑ();
				if(assignNewContainers)ɛ();
			}
		}
		if(Ȯ==5){
			if(ʌ.Count!=0)Ϯ();
		}
		if(Ȯ==6){
			if(!Ϛ())ȭ=true;
		}
		if(Ȯ==7){
			if(balanceTypeContainers)Β();
		}
		if(Ȯ==8){
			θ();
		}
		if(Ȯ==9){
			ϴ(ʿ);
			ϴ(ʌ);
		}
		if(Ȯ==10){
			ƺ();
		}
		if(Ȯ==11){
			if(enableAutocrafting||enableAutodisassembling)ǃ();
		}
		if(Ȯ==12){
			ː();
		}
		if(Ȯ==13){
			if(splitAssemblerTasks)Ο();
			if(sortAssemblerQueue)β();
		}
		if(Ȯ==14){
			if(enableAssemblerCleanup)γ();
			if(enableBasicIngotCrafting){
				if(Refineries.Count>0){
					enableBasicIngotCrafting=false;
				}
				else{
					Ε();
				}
			}
		}
		if(Ȯ==15){
			Û();
		}
		if(Ȯ==16){
			ˆ();
		}
		if(Ȯ==17){
			if(enableOreBalancing)ˁ();
			if(sortRefiningQueue){
				ˏ(ʸ,Ɏ);
				ˏ(ʷ,Ɇ);
			}
		}
		if(Ȯ==18){
			if(enableIceBalancing)Ĩ();
		}
		if(Ȯ==19){
			if(enableUraniumBalancing){
				ç("uraniumBalancing","true");
				Ċ();
			}
			else if(!enableUraniumBalancing&&é("uraniumBalancing")=="true"){
				ç("uraniumBalancing","false");
				foreach(IMyReactor ą in ʯ){
					ą.UseConveyorSystem=true;
				}
			}
		}
		Ǧ(ț);
		Í();
		Ȱ=(int)Math.Floor((ǭ>20?20:ǭ)/maxCurrentMs);
		if(ȭ){
			ȭ=false;
		}
		else if(Ȯ>=19){
			Ȯ=0;
			ț=Ț[0];
			ȳ=new HashSet<string>(ȱ);
			ȱ.Clear();
			if(ȸ>0)ȸ--;
			if(ȳ.Count==0)ŕ=null;
		}
		else{
			Ȯ++;
			ț=Ț[Ȯ];
		}
	}
	catch(Exception e){
		ɵ(e);
		Ƽ("Critical error in script step:\n"+ț+" (ID: "+Ȯ+")\n\n"+e);
	}
}
void ɵ(Exception ɳ){
	ȸ++;
	ȴ=true;
	ȫ=false;
	ʅ=false;
	ȶ=ɳ.ToString();
}
void ɲ(){
	string ɱ="..";
	if(Ȯ>=0)Echo(ș[0]+ɱ+" ("+(Ȯ+1)+"/10)\n");
	if(Ȯ>=2){
		Echo(ș[2]+ɱ);
		if(Ȯ==2)ɞ();
		if(ʅ)return;
	}
	if(Ȯ>=3){
		Echo(ș[3]+ɱ);
		if(Ȯ==3){
			if(!ä()){
				ȵ=true;
				enableAutocrafting=false;
				enableAutodisassembling=false;
			}
		}
		Echo("-> Loaded "+Ȓ.Count+" items.");
		if(ȵ){
			Echo("-> No assemblers found!");
			Echo("-> Autocrafting deactivated!");
		}
	}
	if(Ȯ>=4){
		if(enableAutocrafting||enableAutodisassembling){
			Echo(ș[4]+ɱ);
			if(Ȯ==4){
				GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(ʮ,È=>È.IsSameConstructAs(Me)&&È.CustomName.Contains(autocraftingKeyword));
				if(ʮ.Count>0){
					foreach(var ǂ in ʾ){
						ǂ.Mode=MyAssemblerMode.Disassembly;
						ǂ.ClearQueue();ǂ.Mode=MyAssemblerMode.Assembly;
						ǂ.ClearQueue();
					}
				}
			}
		}
		else{
			Echo("Skipped: Assembler queue clearing");
		}
	}
	if(Ȯ>=5){
		Echo(ș[5]+ɱ);
		if(Ȯ==5)ɤ();
		if(Ȯ==5)ɥ();
	}
	if(Ȯ>=6){
		if(scriptMode=="station"){
			Ȥ=true;
		}
		else if(Me.CubeGrid.IsStatic&&scriptMode!="ship"){
			Ȥ=true;
		}
		Echo(ș[6]+" to: "+(Ȥ?"station..":"ship.."));
		if(Ȯ==6)Me.CustomData=(Ȥ?ȣ:Ȣ)+Me.CustomData.Replace(ȣ,"").Replace(Ȣ,"");
	}
	if(Ȯ>=7){
		Echo("\n"+ș[7]);
	}
	if(Ȯ>=8){
		Ȯ=1;
		ț=Ț[8];
		Ȭ=false;
		return;
	}
	Ȯ++;
	return;
}
bool ɰ(string ɐ){
	if(ɐ.Contains("pauseThisPB")){
		Echo("Script execution paused!\n");
		var ɴ=ɐ.Split(';');
		if(ɴ.Length==3){
			Echo("Found:");
			Echo("'"+ɴ[1]+"'");
			Echo("on grid:");
			Echo("'"+ɴ[2]+"'");
			Echo("also running the script.\n");
			Echo("Type container protection: "+(protectTypeContainers?"ON":"OFF")+"\n");
			Echo("Everything else is managed by the other script.");
		}
		return true;
	}
	bool ɯ=true;
	bool ɮ=true;
	bool ɭ=true;
	if(ɐ.EndsWith(" true")){
		ɭ=false;
	}
	else if(ɐ.EndsWith(" false")){
		ɮ=false;
		ɭ=false;
	}
	if(ɐ=="reset"){
		ƻ();
		return true;
	}
	else if(ɐ=="findBlueprints"){
		if(!ǈ()){
			Echo("Checked "+Ɉ+" / "+Ȓ.Count+" saved items.");
			return true;
		}
		else{
			Ƞ="Checked all "+Ȓ.Count+" saved items! Found "+(ȗ.Count-Ȝ)+" new autocrafting blueprints!";
		}
	}
	else if(ɐ=="showCountdown"){

	}else if(ɐ.StartsWith("balanceTypeContainers")){
		Ȩ="Balance type containers";
		if(ɭ)ɮ=!balanceTypeContainers;balanceTypeContainers=ɮ;
	}
	else if(ɐ.StartsWith("showFillLevel")){
		Ȩ="Show fill level";
		if(ɭ)ɮ=!showFillLevel;
		showFillLevel=ɮ;
	}
	else if(ɐ.StartsWith("autoContainerAssignment")){
		Ȩ="Auto assign containers";
		if(ɭ)ɮ=!autoContainerAssignment;
		autoContainerAssignment=ɮ;
	}
	else if(ɐ.StartsWith("assignNewContainers")){
		Ȩ="Assign new containers";
		if(ɭ)ɮ=!assignNewContainers;
		assignNewContainers=ɮ;
	}
	else if(ɐ.StartsWith("unassignEmptyContainers")){
		Ȩ="Unassign empty containers";
		if(ɭ)ɮ=!unassignEmptyContainers;
		unassignEmptyContainers=ɮ;
	}
	else if(ɐ.StartsWith("oresIngotsInOne")){
		Ȩ="Assign ores and ingots as one";
		if(ɭ)ɮ=!oresIngotsInOne;
		oresIngotsInOne=ɮ;
		}
	else if(ɐ.StartsWith("toolsAmmoBottlesInOne")){
		Ȩ="Assign tools, ammo and bottles as one";
		if(ɭ)ɮ=!toolsAmmoBottlesInOne;
		toolsAmmoBottlesInOne=ɮ;
	}
	else if(ɐ.StartsWith("fillBottles")){
		Ȩ="Fill bottles";
		if(ɭ)ɮ=!fillBottles;
		fillBottles=ɮ;
	}
	else if(ɐ.StartsWith("enableAutocrafting")){
		Ȩ="Autocrafting";
		if(ɭ)ɮ=!enableAutocrafting;
		enableAutocrafting=ɮ;
	}
	else if(ɐ.StartsWith("enableAutodisassembling")){
		Ȩ="Autodisassembling";
		if(ɭ)ɮ=!enableAutodisassembling;
		enableAutodisassembling=ɮ;
	}
	else if(ɐ.StartsWith("showUnlearnedItems")){
		Ȩ="Show unlearned items";
		if(ɭ)ɮ=!showUnlearnedItems;
		showUnlearnedItems=ɮ;
	}
	else if(ɐ.StartsWith("useDockedAssemblers")){
		Ȩ="Use docked assemblers";
		if(ɭ)ɮ=!useDockedAssemblers;
		useDockedAssemblers=ɮ;
	}
	else if(ɐ.StartsWith("headerOnEveryScreen")){
		Ȩ="Show header on every autocrafting screen";
		if(ɭ)ɮ=!headerOnEveryScreen;
		headerOnEveryScreen=ɮ;
	}
	else if(ɐ.StartsWith("sortAssemblerQueue")){
		Ȩ="Sort assembler queue";
		if(ɭ)ɮ=!sortAssemblerQueue;
		sortAssemblerQueue=ɮ;
	}
	else if(ɐ.StartsWith("enableBasicIngotCrafting")){
		Ȩ="Basic ingot crafting";
		if(ɭ)ɮ=!enableBasicIngotCrafting;
		enableBasicIngotCrafting=ɮ;
	}
	else if(ɐ.StartsWith("disableBasicAutocrafting")){
		Ȩ="Disable autocrafting in survival kits";
		if(ɭ)ɮ=!disableBasicAutocrafting;
		disableBasicAutocrafting=ɮ;
	}
	else if(ɐ.StartsWith("allowSpecialSteal")){
		Ȩ="Allow special container steal";
		if(ɭ)ɮ=!allowSpecialSteal;
		allowSpecialSteal=ɮ;
	}
	else if(ɐ.StartsWith("enableOreBalancing")){
		Ȩ="Ore balancing";
		if(ɭ)ɮ=!enableOreBalancing;
		enableOreBalancing=ɮ;
	}
	else if(ɐ.StartsWith("enableScriptRefineryFilling")){
		Ȩ="Script assisted refinery filling";
		if(ɭ)ɮ=!enableScriptRefineryFilling;
		enableScriptRefineryFilling=ɮ;
	}
	else if(ɐ.StartsWith("sortRefiningQueue")){
		Ȩ="Sort refinery queue";
		if(ɭ)ɮ=!sortRefiningQueue;
		sortRefiningQueue=ɮ;
	}
	else if(ɐ.StartsWith("useDockedRefineries")){
		Ȩ="Use docked refineries";
		if(ɭ)ɮ=!useDockedRefineries;
		useDockedRefineries=ɮ;
	}
	else if(ɐ.StartsWith("enableIceBalancing")){
		Ȩ="Ice balancing";
		if(ɭ)ɮ=!enableIceBalancing;
		enableIceBalancing=ɮ;
	}
	else if(ɐ.StartsWith("fillOfflineGenerators")){
		Ȩ="Fill offline O2/H2 generators";
		if(ɭ)ɮ=!fillOfflineGenerators;
		fillOfflineGenerators=ɮ;
	}
	else if(ɐ.StartsWith("enableUraniumBalancing")){
		Ȩ="Uranium balancing";
		if(ɭ)ɮ=!enableUraniumBalancing;
		enableUraniumBalancing=ɮ;
	}
	else if(ɐ.StartsWith("fillOfflineReactors")){
		Ȩ="Fill offline reactors";
		if(ɭ)ɮ=!fillOfflineReactors;
		fillOfflineReactors=ɮ;
	}
	else if(ɐ.StartsWith("enableAssemblerCleanup")){
		Ȩ="Assembler cleanup";
		if(ɭ)ɮ=!enableAssemblerCleanup;
		enableAssemblerCleanup=ɮ;
	}
	else if(ɐ.StartsWith("enableInternalSorting")){
		Ȩ="Internal sorting";
		if(ɭ)ɮ=!enableInternalSorting;
		enableInternalSorting=ɮ;
	}
	else if(ɐ.StartsWith("useDynamicScriptSpeed")){
		Ȩ="Dynamic script speed";
		if(ɭ)ɮ=!useDynamicScriptSpeed;
		useDynamicScriptSpeed=ɮ;
	}
	else if(ɐ.StartsWith("excludeWelders")){
		Ȩ="Exclude welders";
		if(ɭ)ɮ=!excludeWelders;
		excludeWelders=ɮ;
	}
	else if(ɐ.StartsWith("excludeGrinders")){
		Ȩ="Exclude grinders";
		if(ɭ)ɮ=!excludeGrinders;
		excludeGrinders=ɮ;
	}
	else if(ɐ.StartsWith("excludeDrills")){
		Ȩ="Exclude drills";
		if(ɭ)ɮ=!excludeDrills;
		excludeDrills=ɮ;
	}
	else if(ɐ.StartsWith("connectionCheck")){
		Ȩ="Connection check";
		if(ɭ)ɮ=!connectionCheck;
		connectionCheck=ɮ;
		ɥ();
	}
	else if(ɐ.StartsWith("showNoConveyorTag")){
		Ȩ="Show no conveyor access";
		if(ɭ)ɮ=!showNoConveyorTag;
		showNoConveyorTag=ɮ;
		ɥ();
	}
	else if(ɐ.StartsWith("protectTypeContainers")){
		Ȩ="Protect type containers";
		if(ɭ)ɮ=!protectTypeContainers;
		protectTypeContainers=ɮ;
	}
	else if(ɐ.StartsWith("enableNameCorrection")){
		Ȩ="Name correction";
		if(ɭ)ɮ=!enableNameCorrection;
		enableNameCorrection=ɮ;
	}
	else{
		ɯ=false;
	}
	if(ɯ){
		TimeSpan ɬ=DateTime.Now-ȝ;
		if(Ƞ=="")Ƞ=Ȩ+" temporarily "+(ɮ?"enabled":"disabled")+"!\n";
		Echo(Ƞ);
		Echo("Continuing in "+Math.Ceiling(3-ɬ.TotalSeconds)+" seconds..");
		Ȟ="showCountdown";
		if(ɬ.TotalSeconds>=3){
			Ǎ(Ƞ);Ȟ="";
		}
	}
	return ɯ;
}
void ɫ(){
	List<IMyProgrammableBlock>ɪ=new List<IMyProgrammableBlock>();
	GridTerminalSystem.GetBlocksOfType(ɪ,ɩ=>ɩ!=Me);
	if(Ȟ.StartsWith("pauseThisPB")||Ȟ==""){
		Ȟ="";
		oreach(var ɨ in ɪ){
			if(ɨ.CustomData.Contains(ȣ)||(ɨ.CustomData.Contains(Ȣ)&&í(ɨ)<í(Me))){
				Ȟ="pauseThisPB;"+ɨ.CustomName+";"+ɨ.CubeGrid.CustomName;
				foreach(var W in ʿ){
					if(protectTypeContainers&&!W.CustomName.Contains(ȡ)&&W.IsSameConstructAs(Me))W.CustomName=ȡ+W.CustomName;
				}return;
			}
		}
		if(Ȟ==""){
			foreach(var W in ʽ){
				W.CustomName=W.CustomName.Replace(ȡ,"");
			}
		}
	}
}
void ɼ(){
	ʨ.Clear();
	ʓ.Clear();
	GridTerminalSystem.GetBlocksOfType(Connectors);
	foreach(var ʀ in Connectors){
		if(ʀ.Status!=MyShipConnectorStatus.Connected)continue;
		try{
			if(ʀ.OtherConnector.CubeGrid.IsSameConstructAs(Me.CubeGrid)){
				if(ʀ.CustomName.Contains(noSortingKeyword))ʨ.Add(ʀ.CubeGrid);
				if(ʀ.CustomName.Contains(noIIMKeyword))ʓ.Add(ʀ.CubeGrid);
			}
			else{
				if(ʀ.CustomName.Contains(noSortingKeyword))ʨ.Add(ʀ.OtherConnector.CubeGrid);
				if(ʀ.CustomName.Contains(noIIMKeyword))ʓ.Add(ʀ.OtherConnector.CubeGrid);
			}
		}
		catch(Exception){
			Ƽ("Error while checking connection status of:\n"+ʀ.Name);
		}
	}ʨ.Remove(Me.CubeGrid);
	ʓ.Remove(Me.CubeGrid);
}
void ɿ(){
	if(ʉ!=null){
		try{
		ʉ=ʊ.GetInventory(0);
		}
		catch{
			ʉ=null;
		}
	}
	if(ʉ==null){
		try{
			foreach(var W in ʿ){
				foreach(var d in ʩ){
					if(W==d)continue;
					if(W.GetInventory(0).IsConnectedTo(d.GetInventory(0))){
						ʊ=ʿ[0];
						ʉ=ʊ.GetInventory(0);
						return;
					}
				}
			}
		}
		catch{
			ʉ=null;
			}
		}
	}
void ɾ(IMyTerminalBlock d){
	foreach(var u in ʓ){
		if(u.IsSameConstructAs(Me.CubeGrid)){
			if(d.CubeGrid==u)return;
		}
		else{
			if(d.CubeGrid.IsSameConstructAs(u))return;
		}
	}
	foreach(var C in excludedBlocks){
		if(d.BlockDefinition.SubtypeId.Contains(C))return;
	}
	if(!ι(d))return;
	if(d is IMyShipWelder&&excludeWelders)return;
	if(d is IMyShipGrinder&&excludeGrinders)return;
	if(d is IMyShipDrill&&excludeDrills)return;
	string Î=d.CustomName;
	if(Î.Contains(ȡ)){
		ʽ.Add(d);return;
	}
	bool ɽ=Î.Contains(specialContainerKeyword),ɻ=false,ɺ=false,ɹ=false,ɸ=Î.Contains(learnKeyword)||Î.Contains(learnManyKeyword),ɷ=true,ɶ=false;
	foreach(var ð in lockedContainerKeywords){
		if(Î.Contains(ð)){
			ɻ=true;break;
		}
	}
	foreach(var ð in manualMachineKeywords){
		if(Î.Contains(ð)){
			ɺ=true;
			break;
		}
	}
	if(!d.ShowInInventory&&treatNotShownAsHidden){
		ɹ=true;
	}
	else{
		foreach(var ð inhiddenContainerKeywords){
			if(Î.Contains(ð)){
				ɹ=true;
				break;
			}
		}
	}
	foreach(var u in ʨ){
		if(u.IsSameConstructAs(Me.CubeGrid)){
			if(d.CubeGrid==u)return;
		}
		else{
			if(!ɽ&&!(d is IMyReactor)&&!(d is IMyGasGenerator)){
				if(d.CubeGrid.IsSameConstructAs(u))return;
			}
		}
	}
	if(!ɹ)ʩ.Add(d);
	if(connectionCheck){
		if(ʉ!=null){
			if(!d.GetInventory(0).IsConnectedTo(ʉ)){
				ɷ=false;
			}
		}
		if(!ɷ){
			if(showNoConveyorTag)ɖ(d,"[No Conveyor]");
			return;
		}
		else{
			ɖ(d,"[No Conveyor]",false);
		}
	}
	if(Î.Contains(oreContainerKeyword)){
		ʝ.Add(d);
		ɶ=true;
	}
	if(Î.Contains(ingotContainerKeyword)){
		ʑ.Add(d);ɶ=true;
	}
	if(Î.Contains(componentContainerKeyword)){
		ʐ.Add(d);
		ɶ=true;
	}
	if(Î.Contains(toolContainerKeyword)){
		ʏ.Add(d);
		ɶ=true;
	}
	if(Î.Contains(ammoContainerKeyword)){
		ʎ.Add(d);
		ɶ=true;
	}
	if(Î.Contains(bottleContainerKeyword)){
		ʍ.Add(d);
		ɶ=true;
	}
	if(ɽ){
		ʌ.Add(d);
		if(d.CustomData.Length<200)ù(d);
	}
	if(ɶ)ʿ.Add(d);
	if(d.GetType().ToString().Contains("Weapon")&&!(d isIMyShipDrill))return;
	if(d is IMyRefinery){
		if((useDockedRefineries||d.IsSameConstructAs(Me))&&!ɽ&&!ɺ&&d.IsWorking){
			(d as IMyRefinery).UseConveyorSystem=true;
			Refineries.Add(d as IMyRefinery);
			if(d.BlockDefinition.SubtypeId=="Blast Furnace"){
				ʷ.Add(d as IMyRefinery);
			}
			else{
				ʸ.Add(d as IMyRefinery);
			}
		}
		if(!ɻ&&d.GetInventory(1).ItemCount>0)ʹ.Add(d as IMyRefinery);
	}
	else if(d is IMyAssembler){
		if((useDockedAssemblers||d.IsSameConstructAs(Me))&&!ɺ&&!ɸ&&d.IsWorking){
			ʾ.Add(d as IMyAssembler);
			if(d.BlockDefinition.SubtypeId.Contains("Survival"))ʲ.Add(d as IMyAssembler);
		}
		if(!ɻ&&!ɸ&&d.GetInventory(1).ItemCount>0)ʶ.Add(d as IMyAssembler);
		if(ɸ)ʴ.Add(d as IMyAssembler);
	}
	else if(d is IMyGasGenerator){
		if(!ɽ&&!ɺ&&d.IsFunctional){
			if(fillOfflineGenerators&&!(d asIMyGasGenerator).Enabled){
				ʱ.Add(d as IMyGasGenerator);
			}
			else if((d as IMyGasGenerator).Enabled){
				ʱ.Add(d as IMyGasGenerator);
			}
		}
	}
	else if(dis IMyGasTank){
		if(!ɽ&&!ɺ&&!ɻ&&d.IsWorking&&d.IsSameConstructAs(Me)){
			Reactors.Add(d as IMyGasTank);
		}
	}
	else if(d is IMyReactor){
		if(!ɽ&&!ɺ&&d.IsFunctional){
			if(fillOfflineReactors&&!(d as IMyReactor).Enabled){
				ʯ.Add(d as IMyReactor);
			}
			else if((d asIMyReactor).Enabled){
				ʯ.Add(d as IMyReactor);
			}
		}
	}else if(d is IMyCargoContainer){
		if(d.IsSameConstructAs(Me)&&!ɶ&&!ɻ&&!ɽ)ʼ.Add(d);
	}
	if(d.InventoryCount==1&&!ɽ&&!ɻ&&!(d is IMyReactor)){
		if(d.GetInventory(0).ItemCount>0)ʬ.Add(d);
		if(!d.BlockDefinition.TypeIdString.Contains("Oxygen")&&!(d is IMyConveyorSorter)){
			if(d.IsSameConstructAs(Me)){
				ʵ.Insert(0,d);
			}
			else{
				if(useConnectedGridsTemporarily)ʵ.Add(d);
			}
		}
	}
}
void ɞ(){
	if(!ʅ){
		ɼ();
		if(connectionCheck)ɿ();
		try{
			for(int S=0;S<ʌ.Count;S++){
				if(!ʌ[S].CustomName.Contains(specialContainerKeyword))ʌ[S].CustomData="";
			}
		}
		catch{

		}
		ʿ.Clear();
		ʝ.Clear();
		ʑ.Clear();
		ʐ.Clear();
		ʏ.Clear();
		ʎ.Clear();
		ʍ.Clear();
		ʌ.Clear();
		ʼ.Clear();
		ʽ.Clear();
		ʩ.Clear();
		ʬ.Clear();
		ʵ.Clear();
		Refineries.Clear();
		ʸ.Clear();
		ʷ.Clear();
		ʹ.Clear();
		ʾ.Clear();
		ʲ.Clear();
		ʶ.Clear();
		ʴ.Clear();
		ʱ.Clear();
		Reactors.Clear();
		ʯ.Clear();
		ʈ=null;
		ʄ=0;
		GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(ʪ,Ÿ=>Ÿ.HasInventory&&Ÿ.OwnerId!=0);
	}
	Runtime.UpdateFrequency=UpdateFrequency.Update1;
	for(int S=ʄ;S<ʪ.Count;S++){
		if(ʪ[S].CubeGrid.CustomName.Contains(noSortingKeyword))ʨ.Add(ʪ[S].CubeGrid);
		if(ʪ[S].CubeGrid.CustomName.Contains(noIIMKeyword))ʓ.Add(ʪ[S].CubeGrid);
		try{
			ɾ(ʪ[S]);
		}
		catch(NullReferenceException){
			Ƽ("Error while indexing inventory blocks:\n"+ʪ[S].Name+"\nis no longer available..");
		}
		ʄ++;
		if(S%200==0){
			ʅ=true;
			return;
		}
	}
	if(ʃ==0)ɓ(ʝ);
	if(ʃ==1)ɓ(ʑ);
	if(ʃ==2)ɓ(ʐ);
	if(ʃ==3)ɓ(ʏ);
	if(ʃ==4)ɓ(ʎ);
	if(ʃ==5)ɓ(ʌ);
	if(ʃ==6)ɓ(ʍ);
	if(ʃ==7)ʼ.Sort((ɑ,Ÿ)=>Ÿ.GetInventory().MaxVolume.ToIntSafe().CompareTo(ɑ.GetInventory().MaxVolume.ToIntSafe()));
	ʃ++;
	if(ʃ>7){
		ʃ=0;
	}
	else{
		ʅ=true;
		return;
	}
	if(disableBasicAutocrafting&&ʾ.Count!=ʲ.Count)ʾ.RemoveAll(ŉ=>ŉ.BlockDefinition.SubtypeId.Contains("Survival"));
	if(fillBottles){
		ʬ.Sort((ɑ,Ÿ)=>Ÿ.BlockDefinition.TypeIdString.Contains("Oxygen").CompareTo(ɑ.BlockDefinition.TypeIdString.Contains("Oxygen")));
	}
	ʳ.Clear();
	bool ɕ;
	foreach(var ǂ in ʾ){
		if(ʳ.Count==0){
			ʳ.Add(ǂ);
			continue;
		}
		ɕ=false;
		foreach(var ɔ in ʳ){
			if(ɔ.BlockDefinition.ToString()==ǂ.BlockDefinition.ToString()){
				ɕ=true;
			}
		}
		if(!ɕ){
			ʳ.Add(ǂ);
		}
	}
	ʅ=false;
	Runtime.UpdateFrequency=UpdateFrequency.Update10;
}
void ɓ(List<IMyTerminalBlock>ɒ){
	if(ɒ.Count>=2&&ɒ.Count<=500)ɒ.Sort((ɑ,Ÿ)=>í(ɑ).CompareTo(í(Ÿ)));
	if(!Ǥ())ʃ++;
}
void ɖ(IMyTerminalBlock d,string ɗ,boolɧ=true){
	if(ɧ){
		if(d.CustomName.Contains(ɗ))return;
		d.CustomName+=" "+ɗ;
	}
	else{
		if(!d.CustomName.Contains(ɗ))return;
		d.CustomName=d.CustomName.Replace(" "+ɗ,"").Replace(ɗ,"").TrimEnd(' ');
	}
}
void ɥ(){
	for(int S=0;S<ʩ.Count;S++){
		ɖ(ʩ[S],"[No Conveyor]",false);
	}
}
void ɤ(){
	bool ɣ=false;
	string ɢ=é("oreContainer");
	string ɡ=é("ingotContainer");
	string ɠ=é("componentContainer");
	string ɦ=é("toolContainer");
	string ɟ=é("ammoContainer");
	string ɝ=é("bottleContainer");
	string ɜ=é("specialContainer");
	if(oreContainerKeyword!=ɢ){
		ɣ=true;
	}
	else if(ingotContainerKeyword!=ɡ){
		ɣ=true;
	}
	else if(componentContainerKeyword!=ɠ){
		ɣ=true;
	}
	else if(toolContainerKeyword!=ɦ){
		ɣ=true;
	}
	else if(ammoContainerKeyword!=ɟ){
		ɣ=true;
	}
	else if(bottleContainerKeyword!=ɝ){
		ɣ=true;
	}
	else if(specialContainerKeyword!=ɜ){
		ɣ=true;
	}
	if(ɣ){
		for(int S=0;S<ʩ.Count;S++){
			if(ʩ[S].CustomName.Contains(ɢ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɢ,oreContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɡ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɡ,ingotContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɠ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɠ,componentContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɦ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɦ,toolContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɟ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɟ,ammoContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɝ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɝ,bottleContainerKeyword);
			}
			if(ʩ[S].CustomName.Contains(ɜ)){
				ʩ[S].CustomName=ʩ[S].CustomName.Replace(ɜ,specialContainerKeyword);
			}
		}
		ç("oreContainer",oreContainerKeyword);
		ç("ingotContainer",ingotContainerKeyword);
		ç("componentContainer",componentContainerKeyword);
		ç("toolContainer",toolContainerKeyword);
		ç("ammoContainer",ammoContainerKeyword);
		ç("bottleContainer",bottleContainerKeyword);
		ç("specialContainer",specialContainerKeyword);
	}
}
void ɛ(){
	string ɚ="";
	foreach(var ə in ʋ){
		if(assignOres&&ə==ɂ){ɚ=ɂ;
		}
		else if(assignIngots&&ə==Ɂ){
			ɚ=Ɂ;
		}
		else if(assignComponents&&ə==ɀ){
			ɚ=ɀ;
		}else if(assignTools&&(ə==Ȫ||ə==Ȗ||ə==ȟ||ə==Ȕ)){
			ɚ=Ȫ;
		}
		else if(assignAmmo&&ə==ȿ){
			ɚ=ȿ;
		}
		else if(assignBottles&&(ə==Ⱦ||ə==Ƚ)){
			ɚ=Ⱦ;
		}
		if(ɚ!="")break;
	}
	for(int S=0;S<ʼ.Count;S++){
		bool Ȼ=false;
		bool ɘ=false;
		string ˀ=ʼ[S].CustomName;
		string ϕ="";
		string ϓ=" and ";
		bool ϒ=false;
		if(assignOres&&(ʝ.Count==0||ɚ==ɂ)){
			if(oresIngotsInOne){
				ɘ=true;
			}
			else{
				ʼ[S].CustomName+=" "+oreContainerKeyword;
				ʝ.Add(ʼ[S]);
				ϕ="Ores";
			}
		}
		else if(assignIngots&&(ʑ.Count==0||ɚ==Ɂ)){
			if(oresIngotsInOne){
				ɘ=true;
			}
			else{
				ʼ[S].CustomName+=" "+ingotContainerKeyword;
				ʑ.Add(ʼ[S]);
				ϕ="Ingots";
			}
		}
		else if(assignComponents&&(ʐ.Count==0||ɚ==ɀ)){
			ʼ[S].CustomName+=" "+componentContainerKeyword;
			ʐ.Add(ʼ[S]);
			ϕ="Components";
		}
		else if(assignTools&&(ʏ.Count==0||ɚ==Ȫ)){
			if(toolsAmmoBottlesInOne){
				Ȼ=true;
			}
			else{
				ʼ[S].CustomName+=" "+toolContainerKeyword;
				ʏ.Add(ʼ[S]);ϕ="Tools";
			}
		}
		else if(assignAmmo&&(ʎ.Count==0||ɚ==ȿ)){
			if(toolsAmmoBottlesInOne){
				Ȼ=true;
			}
			else{ʼ[S].CustomName+=" "+ammoContainerKeyword;
				ʎ.Add(ʼ[S]);
				ϕ="Ammo";
			}
		}
		else if(assignBottles&&(ʍ.Count==0||ɚ==Ⱦ)){
			if(toolsAmmoBottlesInOne){
				Ȼ=true;
			}
			else{
				ʼ[S].CustomName+=" "+bottleContainerKeyword;
				ʍ.Add(ʼ[S]);ϕ="Bottles";
			}
		}
		if(ɘ){
			if(assignOres){
				ʼ[S].CustomName+=" "+oreContainerKeyword;
				ʝ.Add(ʼ[S]);
				ϕ="Ores";
				ϒ=true;
			}
			if(assignIngots){
				ʼ[S].CustomName+=" "+ingotContainerKeyword;
				ʑ.Add(ʼ[S]);
				ϕ+=(ϒ?ϓ:"")+"Ingots";
			}
		}
		if(Ȼ){
			if(assignTools){
				ʼ[S].CustomName+=" "+toolContainerKeyword;
				ʏ.Add(ʼ[S]);
				ϕ="Tools";
				ϒ=true;
			}
			if(assignAmmo){
				ʼ[S].CustomName+=" "+ammoContainerKeyword;
				ʎ.Add(ʼ[S]);
				ϕ+=(ϒ?ϓ:"")+"Ammo";
				ϒ=true;
			}
			if(assignBottles){
				ʼ[S].CustomName+=" "+bottleContainerKeyword;
				ʍ.Add(ʼ[S]);
				ϕ+=(ϒ?ϓ:"")+"Bottles";
			}
		}
		if(ϕ!=""){
			ɚ="";
			Ǎ("Assigned '"+ˀ+"' as a new container for type '"+ϕ+"'.");
		}
	}
	ʋ.Clear();
}
void ϑ(){
	if(unassignOres)ϐ(ʝ,oreContainerKeyword);
	if(unassignIngots)ϐ(ʑ,ingotContainerKeyword);
	if(unassignComponents)ϐ(ʐ,componentContainerKeyword);
	if(unassignTools)ϐ(ʏ,toolContainerKeyword);
	if(unassignAmmo)ϐ(ʎ,ammoContainerKeyword);
	if(unassignBottles)ϐ(ʍ,bottleContainerKeyword);
}
void ϐ(List<IMyTerminalBlock>ď,string Ϗ){
	IMyTerminalBlock ώ=null;
	if(ȥ.TryGetValue(Ϗ,out ώ)){
		ȥ.Remove(Ϗ);
		if(ώ==null)return;
		if(ώ.GetInventory(0).ItemCount==0){
			string ϔ=System.Text.RegularExpressions.Regex.Replace(ώ.CustomName,@"("+Ϗ+@")","");
			ϔ=System.Text.RegularExpressions.Regex.Replace(ϔ,@"\(\d+\.?\d*\%\)","");
			ϔ=ϔ.Replace("  "," ");
			ώ.CustomName=ϔ.TrimEnd(' ');
			ʿ.Remove(ώ);
			Ǎ("Unassigned '"+ϔ+"' from being a container for type '"+Ϗ+"'.");
		}
		return;
	}
	if(ď.Count>1){
		int ύ=0;
		foreach(var W in ď){
			if(W.CustomName.Contains("[P"))continue;
			if(W.GetInventory(0).ItemCount==0){
				ώ=W;
				ύ++;
			}
		}
		if(ύ>1){
			ȥ[Ϗ]=ώ;
		}
	}
}
void ό(){
	string Î,ϋ;
	List<string>ϊ=newList<string>();
	for(int S=0;S<ʩ.Count;S++){
		Î=ʩ[S].CustomName;
		ϋ=Î.ToLower();
		ϊ.Clear();
		if(ϋ.Contains(oreContainerKeyword.ToLower())&&!Î.Contains(oreContainerKeyword))ϊ.Add(oreContainerKeyword);
		if(ϋ.Contains(ingotContainerKeyword.ToLower())&&!Î.Contains(ingotContainerKeyword))ϊ.Add(ingotContainerKeyword);
		if(ϋ.Contains(componentContainerKeyword.ToLower())&&!Î.Contains(componentContainerKeyword))ϊ.Add(componentContainerKeyword);
		if(ϋ.Contains(toolContainerKeyword.ToLower())&&!Î.Contains(toolContainerKeyword))ϊ.Add(toolContainerKeyword);
		if(ϋ.Contains(ammoContainerKeyword.ToLower())&&!Î.Contains(ammoContainerKeyword))ϊ.Add(ammoContainerKeyword);
		if(ϋ.Contains(bottleContainerKeyword.ToLower())&&!Î.Contains(bottleContainerKeyword))ϊ.Add(bottleContainerKeyword);
		foreach(var ð in lockedContainerKeywords){
			if(ϋ.Contains(ð.ToLower())&&!Î.Contains(ð)){
				ϊ.Add(ð);break;
			}
		}
		foreach(var ð inhiddenContainerKeywords){
			if(ϋ.Contains(ð.ToLower())&&!Î.Contains(ð)){
				ϊ.Add(ð);break;
			}
		}
		foreach(var ð in manualMachineKeywords){
			if(ϋ.Contains(ð.ToLower())&&!Î.Contains(ð)){
				ϊ.Add(ð);
				break;
			}
		}
		if(ϋ.Contains(specialContainerKeyword.ToLower())&&!Î.Contains(specialContainerKeyword))ϊ.Add(specialContainerKeyword);
		if(ϋ.Contains(noSortingKeyword.ToLower())&&!Î.Contains(noSortingKeyword))ϊ.Add(noSortingKeyword);
		if(ϋ.Contains(noIIMKeyword.ToLower())&&!Î.Contains(noIIMKeyword))ϊ.Add(noIIMKeyword);
		if(ϋ.Contains(autocraftingKeyword.ToLower())&&!Î.Contains(autocraftingKeyword))ϊ.Add(autocraftingKeyword);
		if(ϋ.Contains(assembleKeyword.ToLower())&&!Î.Contains(assembleKeyword))ϊ.Add(assembleKeyword);
		if(ϋ.Contains(disassembleKeyword.ToLower())&&!Î.Contains(disassembleKeyword))ϊ.Add(disassembleKeyword);
		if(ϋ.Contains(learnKeyword.ToLower())&&!Î.Contains(learnKeyword))ϊ.Add(learnKeyword);
		if(ϋ.Contains(learnManyKeyword.ToLower())&&!Î.Contains(learnManyKeyword))ϊ.Add(learnManyKeyword);
		if(ϋ.Contains("[p")&&!Î.Contains("[P"))ϊ.Add("[P");
		if(ϋ.Contains("[pmax]")&&!Î.Contains("[PMax]"))ϊ.Add("[PMax]");
		if(ϋ.Contains("[pmin]")&&!Î.Contains("[PMin]"))ϊ.Add("[PMin]");
		foreach(var Ð in ϊ){
			ʩ[S].CustomName=ʩ[S].CustomName.ƍ(Ð,Ð);
			Ǎ("Corrected name\nof: '"+Î+"'\nto: '"+ʩ[S].CustomName+"'");
		}
	}
	var ź=new List<IMyTerminalBlock>();
	GridTerminalSystem.GetBlocksOfType<IMyTextSurfaceProvider>(ź,Ÿ=>Ÿ.IsSameConstructAs(Me));
	for(int S=0;S<ź.Count;S++){
		Î=ź[S].CustomName;ϋ=Î.ToLower();
		ϊ.Clear();
		if(ϋ.Contains(mainLCDKeyword.ToLower())&&!Î.Contains(mainLCDKeyword))ϊ.Add(mainLCDKeyword);
		if(ϋ.Contains(warningsLCDKeyword.ToLower())&&!Î.Contains(warningsLCDKeyword))ϊ.Add(warningsLCDKeyword);
		if(ϋ.Contains(actionsLCDKeyword.ToLower())&&!Î.Contains(actionsLCDKeyword))ϊ.Add(actionsLCDKeyword);
		if(ϋ.Contains(performanceLCDKeyword.ToLower())&&!Î.Contains(performanceLCDKeyword))ϊ.Add(performanceLCDKeyword);
		if(ϋ.Contains(inventoryLCDKeyword.ToLower())&&!Î.Contains(inventoryLCDKeyword))ϊ.Add(inventoryLCDKeyword);
		foreach(var Ð in ϊ){
			ź[S].CustomName=ź[S].CustomName.ƍ(Ð,Ð);
			Ǎ("Corrected name\nof: '"+Î+"'\nto: '"+ź[S].CustomName+"'");
		}
	}
}
bool Ϛ(){
	ț=Ț[6]+" stage "+(ʒ+1)+"/10";
	if(ʒ==0)ϙ(ɂ,ʝ,oreContainerKeyword);
	if(ʒ==1)ϙ(Ɂ,ʑ,ingotContainerKeyword);
	if(ʒ==2)ϙ(ɀ,ʐ,componentContainerKeyword);
	if(ʒ==3)ϙ(Ȫ,ʏ,toolContainerKeyword);
	if(ʒ==4)ϙ(ȿ,ʎ,ammoContainerKeyword);
	if(ʒ==5)ϙ(Ⱦ,ʍ,bottleContainerKeyword);
	if(ʒ==6)ϙ(Ƚ,ʍ,bottleContainerKeyword);
	if(ʒ==7)ϙ(Ȗ,ʏ,toolContainerKeyword);
	if(ʒ==8)ϙ(ȟ,ʏ,toolContainerKeyword);
	if(ʒ==9)ϙ(Ȕ,ʏ,toolContainerKeyword);
	ʒ++;if(ʒ>9){
		ʒ=0;
		return true;
	}
	else{
		return false;
	}
}
void ϙ(string κ,List<IMyTerminalBlock>Ϙ,string ϛ){
	if(Ϙ.Count==0){
		Ƽ("There are no containers for type '"+ϛ+"'!\nBuild new ones or add the tag to existing ones!");
		ʋ.Add(κ);return;
	}
	IMyTerminalBlock N=null;
	int ϗ=int.MaxValue;
	for(int S=0;S<Ϙ.Count;S++){
		if(κ==Ⱦ&&Ϙ[S].BlockDefinition.TypeIdString.Contains("OxygenTank")&&Ϙ[S].BlockDefinition.SubtypeId.Contains("Hydrogen")){
			continue;
		}
		else if(κ==Ƚ&&Ϙ[S].BlockDefinition.TypeIdString.Contains("OxygenTank")&&!Ϙ[S].BlockDefinition.SubtypeId.Contains("Hydrogen")){
			continue;
		}
		var Ø=Ϙ[S].GetInventory(0);
		if(Ø.ư(inventoryFullBuffer)){
			N=Ϙ[S];
			ϗ=í(Ϙ[S]);
			break;
		}
	}
	if(N==null){
		Ƽ("All containers for type '"+ϛ+"' are full!\nYou should build or tag new cargo containers!");
		ʋ.Add(κ);
		return;
	}
	IMyTerminalBlock σ=null;
	if(fillBottles&&(κ==Ⱦ||κ==Ƚ)){
		σ=ϖ(κ);
	}
	for(int S=0;S<ʬ.Count;S++){
		if(ʬ[S]==N||(ʬ[S].CustomName.Contains(ϛ)&&í(ʬ[S])<=ϗ)||(κ=="Ore"&&ʬ[S].GetType().ToString().Contains("MyGasGenerator"))){
			continue;
		}
		if(ʬ[S].CustomName.Contains(ϛ)&&balanceTypeContainers&&!ʬ[S].BlockDefinition.TypeIdString.Contains("OxygenGenerator")&&!ʬ[S].BlockDefinition.TypeIdString.Contains("OxygenTank"))continue;
		if(σ!=null){
			if(ʬ[S]!=σ){
				R(κ,ʬ[S],0,σ,0);
				continue;
			}
		}
		R(κ,ʬ[S],0,N,0);
	}
	for(int S=0;S<ʹ.Count;S++){
		if(ʹ[S]==N||(ʹ[S].CustomName.Contains(ϛ)&&í(ʹ[S])<=ϗ)){
			continue;
		}
		R(κ,ʹ[S],1,N,0);
	}
	for(int S=0;S<ʶ.Count;S++){
		if((ʶ[S].Mode==MyAssemblerMode.Disassembly&&ʶ[S].IsProducing)||ʶ[S]==N||(ʶ[S].CustomName.Contains(ϛ)&&í(ʶ[S])<=ϗ)){
			continue;
		}
		if(σ!=null){
			R(κ,ʶ[S],1,σ,0);
			continue;
		}
		R(κ,ʶ[S],1,N,0);
	}
}
IMyTerminalBlock ϖ(string κ){
	IMyTerminalBlock σ;
	if(ʇ!=null&&κ==Ⱦ){
		σ=ʇ;ʇ=null;
		return σ;
	}
	if(ʆ!=null&&κ==Ƚ){
		σ=ʆ;
		ʆ=null;
		return σ;
	}
	List<IMyGasTank>υ=new List<IMyGasTank>(Reactors);
	if(κ==Ⱦ)υ.RemoveAll(ρ=>ρ.BlockDefinition.SubtypeId.Contains("Hydrogen"));
	if(κ==Ƚ)υ.RemoveAll(ρ=>!ρ.BlockDefinition.SubtypeId.Contains("Hydrogen"));
	foreach(var π in υ){
		if(π.FilledRatio>0){
			var ο=π.GetInventory();
			if((float)(ο.MaxVolume-ο.CurrentVolume)<0.120)continue;
			π.AutoRefillBottles=true;
			λ(π,κ);
			return π;
		}
	}
	List<IMyGasGenerator>ξ=ʱ.Where(ν=>ν.IsSameConstructAs(Me)&&ν.Enabled==true).ToList();
	MyDefinitionId Ġ=MyItemType.MakeOre("Ice");
	foreach(var μ in ξ){
		if(f(Ġ,μ)>100){
			μ.AutoRefill=true;
			λ(μ,κ);
			return μ;
		}
	}
	return null;
}
void λ(IMyTerminalBlock W,string κ){
	if(κ==Ⱦ){
		ʇ=W;
	}
	else{
		ʆ=W;
	}
}
bool ι(IMyTerminalBlock d){
	if(d.GetOwnerFactionTag()!=Me.GetOwnerFactionTag()){if(showOwnerWarnings)Ƽ("'"+d.CustomName+"'\nhas a different owner/faction!\nIt won't be managed by the script!");
	return false;
	}
	return true;
}
void θ(){
	char η='0';
	char ς='0';
	char[]ζ={'A','N','T','X'};
	char[]τ={'a','d'};
	if(sortingPattern.Length==2){
		η=sortingPattern[0];
		ς=sortingPattern[1];
	}
	ʫ=new List<IMyTerminalBlock>(ʬ)
	ʫ.AddRange(ʌ);
	if(enableInternalSorting){
		if(η.ToString().IndexOfAny(ζ)<0||ς.ToString().IndexOfAny(τ)<0){
			Ƽ("You provided the invalid sorting pattern '"+sortingPattern+"'!\nCan't sort the inventories!");
			return;
		}
	}
	else{
		ʫ=ʫ.FindAll(S=>S.CustomName.ToLower().Contains("(sort:"));
	}
	for(var ƭ=ʂ;ƭ<ʫ.Count;ƭ++){
		if(Ǥ())return;
		if(ʂ>=ʫ.Count-1){
			ʂ=0;
		}
		else{
			ʂ++;
		}
		var Ø=ʫ[ƭ].GetInventory(0);
		var H=new List<MyInventoryItem>();
		Ø.GetItems(H);
		if(H.Count>200)continue;
		char ω=η;
		char ψ=ς;
		string χ=System.Text.RegularExpressions.Regex.Match(ʫ[ƭ].CustomName,@"(\(sort:)(.{2})",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[2].Value;if(χ.Length==2){
			η=χ[0];ς=χ[1];
			if(η.ToString().IndexOfAny(ζ)<0||ς.ToString().IndexOfAny(τ)<0){
				Ƽ("You provided an invalid sorting pattern in\n'"+ʫ[ƭ].CustomName+"'!\nUsing global pattern!");
				η=ω;
				ς=ψ;
			}
		}
		var φ=new List<MyInventoryItem>();
		Ø.GetItems(φ);
		if(η=='A'){
			if(ς=='d'){
				φ.Sort((ɑ,Ÿ)=>Ÿ.Amount.ToIntSafe().CompareTo(ɑ.Amount.ToIntSafe()));
			}
			else{
				φ.Sort((ɑ,Ÿ)=>ɑ.Amount.ToIntSafe().CompareTo(Ÿ.Amount.ToIntSafe()));
			}
		}
		else if(η=='N'){
			if(ς=='d'){
				φ.Sort((ɑ,Ÿ)=>Ÿ.Type.SubtypeId.ToString().CompareTo(ɑ.Type.SubtypeId.ToString()));
			}
			else{
				φ.Sort((ɑ,Ÿ)=>ɑ.Type.SubtypeId.ToString().CompareTo(Ÿ.Type.SubtypeId.ToString()));
			}
		}
		else if(η=='T'){
			if(ς=='d'){
				φ.Sort((ɑ,Ÿ)=>Ÿ.Type.ToString().CompareTo(ɑ.Type.ToString()));
			}
			else{
				φ.Sort((ɑ,Ÿ)=>ɑ.Type.ToString().CompareTo(Ÿ.Type.ToString()));
			}
		}
		else if(η=='X'){
			if(ς=='d'){
				φ.Sort((ɑ,Ÿ)=>(Ÿ.Type.TypeId.ToString()+Ÿ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo((ɑ.Type.TypeId.ToString()+ɑ.Amount.ToIntSafe().ToString(@"000000000"))));
			}
			else{
				φ.Sort((ɑ,Ÿ)=>(ɑ.Type.TypeId.ToString()+ɑ.Amount.ToIntSafe().ToString(@"000000000")).CompareTo((Ÿ.Type.TypeId.ToString()+Ÿ.Amount.ToIntSafe().ToString(@"000000000"))));
			}
		}
		if(φ.SequenceEqual(H,new Ŷ()))continue;
		foreach(var Ð in φ){
			string ϯ=Ð.ToString();
			for(int S=0;S<H.Count;S++){
				if(H[S].ToString()==ϯ){
					Ø.TransferItemTo(Ø,S,H.Count,false);
					H.Clear();
					Ø.GetItems(H);
					break;
				}
			}
		}
		η=ω;
		ς=ψ;
	}
}
void Ϯ(){
	for(int ƭ=ʔ;ƭ<ʌ.Count;ƭ++){
		if(Ǥ())return;
		ʔ++;
		ù(ʌ[ƭ]);
		int q=0;
		if(ʌ[ƭ].BlockDefinition.SubtypeId.Contains("Assembler")){
			IMyAssembler ǂ=ʌ[ƭ]as IMyAssembler;
			if(ǂ.Mode==MyAssemblerMode.Disassembly)q=1;
		}
		List<string>Ϭ=new List<string>();
		double ϫ,Ϫ,ˇ,ϩ;
		MyDefinitionId F;
		string ϭ="",A="";
		foreach(var Ð in Ȧ){
			if(!MyDefinitionId.TryParse(Ƀ+Ð.Key,out F))continue;
			Ϫ=f(F,ʌ[ƭ],q);ϭ=Ð.Value.ToLower();
			double.TryParse(System.Text.RegularExpressions.Regex.Match(ϭ,@"\d+").Value,out ϫ);
			ˇ=0;
			ϩ=0;
			if(ϭ.Contains("all")){
				A="all";
				ϫ=int.MaxValue;
			}
			else if(ϭ.Contains("m")){
				A="m";
			}
			else if(ϭ.Contains("l")||ϭ.Contains("-")){
				A="l";
			}
			ˇ=ϫ-Ϫ;
			if(ˇ>=1&&A!="l"){
				var Ø=ʌ[ƭ].GetInventory(q);
				if(!Ø.ư(inventoryFullBuffer))break;
				IMyTerminalBlock P=null;
				if(allowSpecialSteal){
					P=Z(F,true,ʌ[ƭ]);
				}
				else{
					P=Z(F);
				}
				if(P!=null){
					ϩ=R(F.ToString(),P,0,ʌ[ƭ],q,ˇ,true);
				}
				if(ˇ>ϩ&&A!="all"){
					Ϭ.Add(ˇ-ϩ+" "+F.SubtypeName);
				}
			}
			elseif(ˇ<0&&A!="m"){
				IMyTerminalBlock N=V(ʌ[ƭ],ʼ);
				if(N!=null)R(F.ToString(),ʌ[ƭ],q,N,0,Math.Abs(ˇ),true);
			}
		}
		if(Ϭ.Count>0){
			Ƽ(ʌ[ƭ].CustomName+"\nis missing the following items to match its quota:\n"+String.Join(", ",Ϭ));
		}
	}
	ʔ=0;
}
void ϴ(List<IMyTerminalBlock>ď){
	foreach(var W in ď){
		string ϳ=W.CustomName;
		string ϔ;var ϵ=System.Text.RegularExpressions.Regex.Match(ϳ,@"\(\d+\.?\d*\%\)").Value;if(ϵ!=""){
			ϔ=ϳ.Replace(ϵ,"").TrimEnd(' ');
		}
		else{
			ϔ=ϳ;
		}
		var Ø=W.GetInventory(0);
		string ǳ=((float)Ø.CurrentVolume).ƙ((float)Ø.MaxVolume);
		if(showFillLevel){
			ϔ+=" ("+ǳ+")";
			ϔ=ϔ.Replace("  "," ");
		}
		if(ϔ!=ϳ)W.CustomName=ϔ;
	}
}
StringBuilder ϲ(){
	if(ʮ.Count>1){
		string ϱ=@"("+autocraftingKeyword+@" *)(\d*)";
		ʮ.Sort((ɑ,Ÿ)=>System.Text.RegularExpressions.Regex.Match(ɑ.CustomName,ϱ).Groups[2].Value.CompareTo(System.Text.RegularExpressions.Regex.Match(Ÿ.CustomName,ϱ).Groups[2].Value));
	}
	StringBuilder Ő=new StringBuilder();
	if(!ʮ[0].GetText().Contains(ɏ)){
		ʮ[0].Font=defaultFont;ʮ[0].FontSize=defaultFontSize;
		ʮ[0].TextPadding=defaultPadding;
	}
	foreach(var È in ʮ){
		Ő.Append(È.GetText()+"\n");
		È.WritePublicTitle("Craft item manually once to show up here");
		È.Font=ʮ[0].Font;
		È.FontSize=ʮ[0].FontSize;
		È.TextPadding=ʮ[0].TextPadding;
		È.Alignment=TextAlignment.LEFT;
		È.ContentType=ContentType.TEXT_AND_IMAGE;
	}
	var ϰ=new List<string>(Ő.ToString().Split('\n'));
	var Ά=new List<string>();var Ϩ=new HashSet<string>();
	string Ϝ;
	foreach(var Ê in ϰ){
		if(Ê.IndexOfAny(Ɍ)<=0)continue;
		Ϝ=Ê.Remove(Ê.IndexOf(" "));
		if(!Ϩ.Contains(Ϝ)){
			Ά.Add(Ê);Ϩ.Add(Ϝ);
		}
	}
	List<string>Ü=ʮ[0].CustomData.Split('\n').ToList();
	foreach(var C in ʭ){
		bool ϡ=false;
		if(Ϩ.Contains(C)){
			continue;
		}
		foreach(varÊ in Ü){
			if(!Ê.StartsWith("-"))continue;
			string Ϡ="";
			try{
				if(Ê.Contains("=")){
					Ϡ=Ê.Substring(1,Ê.IndexOf("=")-1);
				}
				else{
					Ϡ=Ê.Substring(1);
				}
			}
			catch{
				continue;
			}
			if(Ϡ==C){
				ϡ=true;
				break;
			}
		}
		if(!ϡ){
			MyDefinitionId F=Ƕ(C);
			bool ͼ;
			MyDefinitionId á=Ǹ(F,out ͼ);
			if(!ͼ&&!showUnlearnedItems)continue;
			double Ȅ=Math.Ceiling(f(F));
			Ά.Add(C+" "+Ȅ+" = "+Ȅ+defaultModifier);
		}
	}
	foreach(var Ê in Ü){
		if(!Ê.StartsWith("-"))continue;
		if(Ê.Contains("=")){
			Ά.Add(Ê);
		}
	}
	StringBuilder Ƨ=new StringBuilder();
	try{
		IOrderedEnumerable<string>ϟ;
		ϟ=Ά.OrderBy(ɑ=>ɑ);
		bool Ϟ;
		string ϝ,C,Ϣ;
		foreach(var Ê in ϟ){
			Ϟ=false;
			if(Ê.StartsWith("-")){
				C=Ê.Remove(Ê.IndexOf("=")).TrimStart('-');
				ϝ="-";
			}
			else{
				C=Ê.Remove(Ê.IndexOf(" "));
				ϝ="";
			}
			Ϣ=Ê.Replace(ϝ+C,"");
			foreach(var Ð in ʭ){
				if(Ð==C){
					Ϟ=true;
					break;
				}
			}
			if(Ϟ)Ƨ.Append(ϝ+C+Ϣ+"\n");
		}
	}
	catch{

	}
	return Ƨ;
}
void ϧ(StringBuilder Ő){
	if(Ő.Length==0){
		Ő.Append("Autocrafting error!\n\nNo items for crafting available!\n\nIf you hid all items, check the custom data of the first autocrafting panel and reenable some of them.\n\nOtherwise, store or build new items manually!");
		Ő=ʮ[0].Ū(Ő,2,false);
		ʮ[0].WriteText(Ő);
		return;
	}
	var ņ=Ő.ToString().TrimEnd('\n').Split('\n');
	int Ņ=ņ.Length;
	int ń=0;
	floatϦ=0;
	foreach(var È in ʮ){
		float Ɖ=È.Ś();
		int Ń=È.Ş();
		int ł=0;
		List<string>Ƨ=new List<string>();
		if(È==ʮ[0]||headerOnEveryScreen){
			string ϥ=ɏ;
			if(headerOnEveryScreen&&ʮ.Count>1){
				ϥ+=" "+(ʮ.IndexOf(È)+1)+"/"+ʮ.Count;
				try{
					ϥ+=" ["+ņ[ń][0]+"-#]";
				}
				catch{
					ϥ+=" [Empty]";
				}
			}
			Ƨ.Add(ϥ);
			Ƨ.Add(È.Ř('=',È.Ţ(ϥ)).ToString()+"\n");
			string Ϥ="Component ";
			string ϣ="Current | Wanted ";
			Ϧ=È.Ţ("Wanted ");
			string ǟ=È.Ř(' ',Ɖ-È.Ţ(Ϥ)-È.Ţ(ϣ)).ToString();
			Ƨ.Add(Ϥ+ǟ+ϣ+"\n");
			ł=5;
		}
		while((ń<Ņ&&ł<Ń)||(È==ʮ[ʮ.Count-1]&&ń<Ņ)){
			var Ê=ņ[ń].Split(' ');
			Ê[0]+=" ";
			Ê[1]=Ê[1].Replace('$',' ');
			string ǟ=È.Ř(' ',Ɖ-È.Ţ(Ê[0])-È.Ţ(Ê[1])-Ϧ).ToString();
			string ε=Ê[0]+ǟ+Ê[1]+Ê[2];
			Ƨ.Add(ε);
			ń++;
			ł++;
		}
		if(headerOnEveryScreen&&ʮ.Count>1){
			Ƨ[0]=Ƨ[0].Replace('#',ņ[ń-1][0]);
		}
		È.WriteText(String.Join("\n",Ƨ));
	}
	if(showAutocraftingModifiers){
		string Ή="\n\n---\n\nModifiers (append after wanted amount):\n"+"'A' - Assemble only\n"+"'D' - Disassemble only\n"+"'P' - Priority (always craft first)\n"+"'H' - Hide (manage in custom data)\n"+"'I' - Ignore (don't manage and hide)\n"+"'Y#' - Yield modifier. Set # to the itemamount, one craft yields";
		ʮ[ʮ.Count-1].WriteText(Ή,true);
	}
}
void ː(){
	ʮ.Clear();
	GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(ʮ,È=>È.IsSameConstructAs(Me)&&È.CustomName.Contains(autocraftingKeyword));
	if(ʮ.Count==0)return;
	if(ʾ.Count==0){
		Ƽ("No usable assemblers found!\nBuild or enable assemblers to enable autocrafting!");
		return;
	}
	if(!enableAutocrafting&&!enableAutodisassembling)return;
	Π();
	List<MyDefinitionId>Έ=new List<MyDefinitionId>();
	var Ά=ϲ().ToString().TrimEnd('\n').Split('\n');StringBuilder Ƨ=new StringBuilder();
	foreach(var Ê in Ά){
		string C="";
		bool ͽ=true;
		if(Ê.StartsWith("-")){
			ͽ=false;
			try{
				C=Ê.Substring(1,Ê.IndexOf("=")-1);
			}
			catch{
				continue;
			}
		}
		else{
			try{
				C=Ê.Substring(0,Ê.IndexOf(" "));
			}
			catch{
				continue;
			}
		}
		MyDefinitionId F=Ƕ(C);
		if(F==null)continue;
		bool ͼ;
		MyDefinitionId á=Ǹ(F,out ͼ);
		if(!ͼ&&!showUnlearnedItems)continue;
		double ͺ=Math.Ceiling(f(F));
		string ͷ=Ê.Substring(Ê.IndexOfAny(Ɍ)+1).ToLower().Replace(" ","");
		double Ͷ=0;
		int ʹ=1;
		double.TryParse(System.Text.RegularExpressions.Regex.Match(ͷ,@"\d+").Value,out Ͷ);
		string ͳ=ͺ.ToString();
		string Ͳ=Ͷ.ToString();
		string ͻ="";
		bool ï=false;
		if(ͷ.Contains("h")&&ͽ){
			if(!ʮ[0].CustomData.StartsWith(ɍ))ʮ[0].CustomData=ɍ;
			ʮ[0].CustomData+="\n-"+C+"="+ͷ.Replace("h","").Replace(" ","").ToUpper();
			continue;
		}
		else if(ͷ.Contains("i")&&ͽ){
			if(!ʮ[0].CustomData.StartsWith(ɍ))ʮ[0].CustomData=ɍ;
			ʮ[0].CustomData+="\n-"+C;
			continue;
		}
		if(ͷ.Contains("a")){
			if(ͺ>Ͷ)Ͷ=ͺ;
			ͻ+="A";
		}
		if(ͷ.Contains("d")){
			if(ͺ<Ͷ)Ͷ=ͺ;
			ͻ+="D";
		}
		if(ͷ.Contains("p")){
			ï=true;
			ͻ+="P";
		}
		if(ͷ.Contains("y")){
			int.TryParse(System.Text.RegularExpressions.Regex.Match(ͷ,@"y\d+").Value.Replace("y",""),out ʹ);
			if(ʹ==0)ʹ=1;
			ͻ+="Y"+ʹ;
		}
		ǀ(F,Ͷ);
		double Α=Math.Abs((Ͷ-ͺ)/ʹ);
		if(ʹ!=1)Α=Math.Floor(Α);
		double Θ=ǁ(á);
		if(ͺ>=Ͷ+Ͷ*assembleMargin&&Θ>0&&ƿ(á)>0){
			Σ(á);
			ƾ(á,0);
			Θ=0;
			Ǎ("Removed '"+F.SubtypeId.ToString()+"' from the assembling queue.");
		}
		if(ͺ<=Ͷ-Ͷ*disassembleMargin&&Θ>0&&ƿ(á)<0){
			Σ(á);
			ƾ(á,0);
			Θ=0;
			Ǎ("Removed '"+F.SubtypeId.ToString()+"' from the disassembling queue.");
		}
		string ĥ="";if(Θ>0||Α>0){
			if((enableAutodisassembling||ͷ.Contains("d"))&&ͺ>Ͷ+Ͷ*disassembleMargin){
				ƾ(á,-1);
				ĥ="$[D:";
			}
			else if(enableAutocrafting&&ͺ<Ͷ-Ͷ*assembleMargin){
				ƾ(á,1);
				ĥ="$[A:";
			}
			if(ĥ!=""){
				if(Θ==0){
					ĥ+="Wait]";
				}
				else{
					ĥ+=Math.Round(Θ)+"]";
				}
			}
		}
		else{
			ƾ(á,0);
		}
		if(showUnlearnedItems&&!ͼ)ĥ="$[NoBP]";
		if(ï){
			Έ.Add(á);
		}
		string Ζ="$=$ ";
		if(ͺ>Ͷ)Ζ="$>$ ";
		if(ͺ<Ͷ)Ζ="$<$ ";
		if(ͽ)Ƨ.Append(C+" "+ͳ+ĥ+Ζ+Ͳ+ͻ+"\n");
		if(ĥ.Contains("[D:Wait]")){
			Ι(á,Α);
		}
		else if(ĥ.Contains("[A:Wait]")){
			Λ(á,Α,ï);
			Ǎ("Queued "+Α+" '"+F.SubtypeId.ToString()+"' in the assemblers.");
		}
	}
	Ρ(Έ);
	ϧ(Ƨ);
}
void Ε(){
	if(Refineries.Count>0)return;
	MyDefinitionId ˠ=MyItemType.MakeOre("Stone");
	MyDefinitionId á=MyDefinitionId.Parse(ȓ+"Position0010_StoneOreToIngotBasic");
	double Δ=f(ˠ);
	if(Δ>0){
		double Γ=Math.Floor(Δ/100/ʲ.Count);
		if(Γ<1)return;
		foreach(var Η in ʲ){
			if(Η.CanUseBlueprint(á)&&Η.IsQueueEmpty){
				Η.AddQueueItem(á,Γ);
				Ǎ("Queued "+Γ+" ingot crafts in "+Η.CustomName+".");
			}
		}
	}
}
void Β(){
	if(ʧ==0)ʧ+=ΐ(ʝ,ɂ,true,true);
	if(ʧ==1)ʧ+=ΐ(ʑ,Ɂ,true,true);
	if(ʧ==2)ʧ+=ΐ(ʐ,ɀ,true,true);
	if(ʧ==3)ʧ+=ΐ(ʏ,Ȫ,true,true);
	if(ʧ==4)ʧ+=ΐ(ʎ,ȿ,true,true);
	if(ʧ==5)ʧ+=ΐ(ʍ,"ContainerObject",true,true);
	ʧ++;
	if(ʧ>5)ʧ=0;
}