crosscode-map-editor icon indicating copy to clipboard operation
crosscode-map-editor copied to clipboard

`SELECT_RANDOM` support

Open lexisother opened this issue 1 year ago • 3 comments

This event/action step is currently not supported properly. Can this be added?

lexisother avatar Aug 10 '24 00:08 lexisother

I've also used SELECT_FIRST recently but it's quite a hassle with manual json. Can this be supported as well?

XenonA7 avatar Aug 10 '24 06:08 XenonA7

Can you show an example of how it should look?

Vegita2 avatar Aug 10 '24 08:08 Vegita2

Here is an example of the SELECT_FIRST event step. Although note that there is an identical action step version of it too.

It has a list of conditions, and an event for each condition. It will execute the event corresponding to the first true condition in the "options" array. In the example, if tmp.test ==3, then the result is "This is the 3rd option.".

{
  "0": [
    {
      "message": {
        "en_US": "This is the 1st option."
      },
      "type": "SHOW_SIDE_MSG",
      "person": {
        "person": "main.lea",
        "expression": "DEFAULT"
      }
    }
  ],
  "1": [
    {
      "message": {
        "en_US": "This is the 2nd option."
      },
      "type": "SHOW_SIDE_MSG",
      "person": {
        "person": "main.lea",
        "expression": "DEFAULT"
      }
    }
  ],
  "2": [
    {
      "message": {
        "en_US": "This is the 3rd option."
      },
      "type": "SHOW_SIDE_MSG",
      "person": {
        "person": "main.lea",
        "expression": "DEFAULT"
      }
    }
  ],
  "3": [
    {
      "message": {
        "en_US": "This is the 4th option."
      },
      "type": "SHOW_SIDE_MSG",
      "person": {
        "person": "main.lea",
        "expression": "DEFAULT"
      }
    }
  ],
  "type": "SELECT_FIRST",
  "options": [
    "tmp.test == 1",
    "tmp.test == 2",
    "tmp.test == 3",
    "tmp.test == 4"
  ]
}

XenonA7 avatar Aug 10 '24 09:08 XenonA7