Compare a String to an Array?

rule("Player Joined")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	actions
	{
		Event Player.A = Custom String("{0};", Event Player);
	}
}

rule("String Contains Name")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Button(Interact)) == True;
		String Contains(Custom String("Killroy; Air;"), Event Player.A) == True;
	}

	actions
	{
		Small Message(Event Player, Custom String("Ping Name"));
	}
}

rule("String Contains Hero")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Button(Interact)) == True;
		String Contains(Custom String("McCree; D.Va; Mercy; Zenyatta"), Custom String("{0}", Hero Of(Event Player))) == True;
	}

	actions
	{
		Small Message(Event Player, Custom String("Ping Hero"));
	}
}

You’d need to remove your name from the String in the “String Contains name” Rule, unless the K in your name isnt capitalized, but I dunno and am lazy to check.


You don’t compare a String Value to a Hero Value, the Hero of the Event Player gets turned into a String Value before comparison


As to why I add a semicolon to the end of the names,
that’s to prevent the String Contains action from triggering when there’s simply someone with a name that is part of someone others name

i.e
If someone were to be called “Tea” and the String Contains action has “Teawy” in it it would be True;
where as “Tea;” isnt in the String “Teawy;”.

As to why it isn’t working for you with bots,
the Bots name isn’t being called in the “Event Player” Event.
If you check the inspector, the Bots ‘name’ is “Entity #”


So if it’s a bot you’re checking for you can simply use

conditions
	{
		String Contains(Event Player.A, Custom String("Entity ")) == True;
	}

Players are unable to use a space in their names so it also contains a “Is Dummy Bot(Event Player)” condition