Forum rules - please read before posting.

Actionlist - Switch Case Action

Hi Chris,

We have the following scenario and would love to get your ideas of how it can be done.

Prelude: Actionlist is created in editor and serialized and then loaded into game at runtime.

Situation: Actionlist has X number of actions. We have variable of type String and with name CMD.
If CMD = "commandString01" then play the first action, if CMD="commandString02" then play the second action, etc.

Requirement:
1. The number of CMD - command strings are dynamic
2. The number of actions are dynamic

Comments

  • This is possible with PopUp variables and the use of the Variable: Pop Up switch Action, as the number of possible outputs is determined by the number of possbible values the PopUp variable can take.

    A custom similar Action for strings could feasibly be written, but the data you'd enter into it (# of values, and each possible value) would effectively be the same as that entered into the PopUp variable's properties in the Variables Manager.

  • edited March 2023

    Can you provide some scripting examples because I'm a newbie to both ideas. Greatly appreciate it.

  • A tutorial on custom Actions can be found here, but give the non-scripting approach a try first - PopUps and the Popup switch Action are designed for this purpose.

    Create a new Global Variable of the type PopUp, and assign a number of values that it can take ("Command01", "Command02", etc).

    Then use the Variable: Pop Up switch Action to reference this Variable. You should find that it then has outputs for each value you added in the Variables Manager. Is that the behaviour you're looking for?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.