Комментарии:
This series is really cool (as are the Space and Medieval Engineers ones)! Building the script as you go in the video like this can highlight problems people might run into while coding similar things on their own. If you have everything done before hand, then it becomes more of just an explanation. Both are fine, but i think the first way may have a bit more learning value for viewers.
ОтветитьI had the same problem when doing a script for energy left. The Wiki says uranium contains 0.0191 MWh, but that doesn't make sense when looking at the terminals time left. So i just changed the formula around (EnergyPerKg = (TimeLeft * CurrentOutput) / Total Ingots) and got around 1 MWh per kg, Love the series by the way, done a bit of programming in school, but not c# or with an api, so this series is really helpful.
ОтветитьIf you wouldn't mind sharing,, which "LCD Panel" mod are you using in this vid?
ОтветитьI don't know if you did, but I think you also have to factor in the timestep of the calculations ingame.
For example, the power consumption and distribution ingame maybe happens only once every seond.
But this isn't really necessary, as this should be just another fixed value and your ingame script also runs at a fixed value and should be synchronized.
the formula would be:
Time(h) = Uranium(kg)/Consumption(MW) * Ratio
you just need to figure out the "Ratio" part, which is basically, the effectivity of uranium or how much electricity it produces.
I highly doubt that the devs made it too complicated. In the real world you would have to factor in the quality of uranium and the efficiency of the reactor etc. In the game, it should just be a fixed value.
So if you have 1kg of uranium and a power consumption of 2MW and it would last you for 10 hours then "Ratio" would be 20.
You can calculate other values, or realtime values and see if it actually matches.
This would only apply if "Ratio" is linear, but I would be suprised if it wasn't.
I am trying to make a script where I change the name of few connectors and containers and make a dispenser system where player choose a connector from which X amount of selected component will be dropped.
making name change script was easy but I have hard time accessing the inventory of the containers.
I have programming background with VB6 and java but C# is hard for me... it would be nice to have some help :)
I keep getting the "Object reference not set to an instance of an object" problem. And i checked my name of the LCD and everything.
It creates the instance fine though, it only shows this problem when i want to change something in it.
This is really getting annoying :/
How must name the LCD panels?
ОтветитьThis video is one of the best tutorials that I have seen. Great job
ОтветитьI made a script , but when I try to upload fails
Ответить"caught during execution of script: Object reference not set to instance of an object " what do I do
ОтветитьSo I copied it to the best of my abilities and everything looks the same to me but for some reason it doesn't update the screen how can I fix this?
ОтветитьIts kind of annoying how Keen puts this coding stuff into the game but then doesn't give us a proper tutorial on how to use it I've never done a shred of coding to me its all double Dutch. It's Double Dutch that I really really want to understand.
Ответитьexplain plz what does display.UpdateVisuals?
ОтветитьCan you help me with a problem in programmable block: After Run button there is a message " Assembly not found"
ОтветитьI have been having trouble with a script for the LCD to display how much of what is being mined on my mining platform.
echo
InvlistX T:* +ingot/iron,nickel,silicon -ore
Inventorylist {G:MMR Cargo Containers} +ore -scrap -iron -nickel -silicon +stone
echo
CargoAll {G:MMR Cargo Containers}
thats what i currently have.. but it never updates, despite whats being mined and held in the onboard containers.. please help
Realy helped. I have a great problem in survival when i make a drill to gather lotts of stone it fills upp all my cargo and just diggs untill the pistons are done. so i do need a scripts that sees if the cargo of stone is full the drill systems turns off.
Ответитьvoid Main()
{
// Variables
IMyTextPanel display;
List<IMyTerminalBlock> crates = new List <IMyTerminalBlock>();
// Instantiation
display = (IMyTextPanel)GridTerminalSystem.GetBlockWithName("LCD Inventory Display");
GridTerminalSystem.GetBlocksOfType<IMyCargoContainer>(crates);
// Display Data
display.WritePublicText(GetAllInv(crates), false);
// Update Visuals
display.ShowPublicTextOnScreen();
display.UpdateVisual();
}
string GetAllInv(List<IMyTerminalBlock> crates)
{
// Variables
string finalInvStr = "";
List<IMyInventoryItem> allItems = new List<IMyInventoryItem>();
// Get Inventories
for(int i = 0; i < crates.Count; i++)
{
var owner = (IMyInventoryOwner)crates[i];
var inventory = (IMyInventory)owner.GetInventory(0);
var items = inventory.GetItems();
allItems.AddRange(items);
}
for(int i = 0; i < allItems.Count; i++)
{
finalInvStr += allItems[i].Content.SubtypeName + " = " + allItems[i].Amount + " (RAW): " + allItems[i].Amount.RawValue + "\n";
}
return finalInvStr;
}
I do get 3 errors. 1st. is Line 33. There is no argument given that corresponds the required formal parameter
2nd error. Cannot assign void to an implicity-typed variable.
3rd error, The type or member ´string MyObjectBuilder_Base.SubtypeName` is prohibited.
Coming back to this. It is awesome, thank you so much.
You'll be included in my self biography if I survive the brain hemorrhage I get from programming in space engineers 😂
8 yeats later, this video still helps as I strugled to find out which part of API manage inventory, thank you
Ответить