GitHub-TC / EmpyrionScripting

Displays various informations directly and live on LCD screens and will support conveyor and construction control
GNU General Public License v3.0
33 stars 4 forks source link

What is the c# equivalent of @root.Ids.WeaponHV? #36

Closed GamingDaveUk closed 10 months ago

GamingDaveUk commented 11 months ago

Looking at the section on predefined IDs, I can see that the IDs in the configuration file are all uptodate etc but I dont know how to reference these lists?

It shows an example that uses LUA? @root.Ids.WeaponHV but what is that in C#?

Ultimately i want to change: int[] Armour = { 4698, 4699, 4700, 4701, 7219, 7220 }; var sItems = CsRoot.Items(E.S, "A1SortingBox"); string temp = ""; foreach (var item in sItems) { if (Armour.Contains(item.Id)) { foreach (ILcd lcd in infoOutLcds) { temp = lcd.GetText(); lcd.SetText($"{item.Name} (ID: {item.Id}) x {item.Count}{Environment.NewLine} {temp} "); } var Armourlist = CsRoot.Move(item, E.S, "*Armour*"); continue; } }

(example is an extract from my script and unlikely to work on its own, just done to show how I am doing things now)

To matching the items name ( item.Name ) to a name in the list so:

if (HowEverWeGetConfigurationList.Ids.Armour.contains(item.Name)

But I need to know how to get that list lol

GitHub-TC commented 10 months ago

@root.Ids.WeaponHV is handlebars syntax CsRoot.Ids["WeaponHV"] is C# you can found the usage in the Demo CV