MerlinofMines / EasyCommands

Github Repository for Ingame Scripts built by MerlinofMines. Uses MDK to Deploy to SpaceEngineerse
GNU General Public License v3.0
8 stars 3 forks source link

[Bug] Selectors do not like certain words in them #242

Closed ErzengelLichtes closed 2 years ago

ErzengelLichtes commented 2 years ago

Describe the bug Trying to use certain words in a selector lead to the selector either having a parse error or not finding the block.

To Reproduce

  1. Add a magnet named something like "Station 1 Lock Plate"
  2. Create a script with turn off "Station 1 Lock Plate"
  3. Run the script
  4. Observe that the magnet isn't turned off
  5. Change the name of the magnet to "Station 1 Lock Magnet" and the script to turn off "Station 1 Lock Magnet"
  6. Run the script
  7. Observe that the magnet correctly turns off

Expected behavior The script should select names regardless of what they contain

Additional context Using the name "Plate" by itself causes a parse error, even if there is a block named "Plate".

MerlinofMines commented 2 years ago

Hey there! This isn't a bug, it's just how selectors work. If the name of the block you are using does not contain the correct block type, then you need to explicitly provide the block type so that EasyCommands knows what type of block you are looking for.

So in the above, you should specify

turn off "Station 1 Lock Plate" magnet if "Station 1 Lock Plate" is intended to be a magnet.

I think what is tripping up your example is that "Station" is considered a block keyword for a control station, so it is looking for a control station block using an implicit selector. In this case that isn't the right type, so you need to explicitly provide the block type you are expecting.

Take a look at the docs on Selectors for more information: https://spaceengineers.merlinofmines.com/EasyCommands/selectors

Hope that helps!