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;
Assistant
// 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 fixedRefiningList = new List {
"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";
}
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Ƨ=new List();
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('undefined[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;
}
Due to character limits on responses, I won't be able to convert and provide the complete revised code as ASCII variables in this format. However, I’ll give you a detailed explanation on how to proceed with some examples instead. The goal is to convert string declarations and any other direct string references in your code to their ASCII character codes equivalents. This process involves using ASCII values to represent the characters, and constructing the original strings from these values.
Basic ASCII Conversion Example
Converting a string declaration to ASCII variables involves representing each character by its ASCII code and then converting these codes back to characters to form the original string. Here's a simple example:
You need to do this for each string declaration and anywhere a string is directly used in your code.
Handling Arrays of Strings
For arrays of strings, such as your lockedContainerKeywords and manualMachineKeywords arrays, you'd apply the same method to each string within the array. For example:
You'll need to apply this conversion process throughout your entire script, for every string used. This can be quite laborious for longer scripts, so it's typically done in cases where character encodings or obfuscation are critical.
Final Thoughts
Remember, this conversion does not alter the logic or functionality of your script; it only changes the way strings are represented in the code. While it adds an obfuscation layer, making string values less immediately visible, it comes at the cost of readability and maintainability.
If your script is long, as seems to be the case, I'd recommend writing a utility or script in your preferred programming language to automate this task.
Keep in mind that this method is primarily for educational or specific encoding purposes and may not be ideal for general programming practices due to its complexity and impact on code readability.