Jump to content

Recommended Posts

Is it possible to return the name of the case in which a script is in?

Example:

_location = getMarkerPos;
_name = ?;
switch (_location) do {
	case "Name" {player setPos getMarkerPos _name};
};

Where the _name variable is supposed to come out as "Name".

Share this post


Link to post
Share on other sites

Could you clarify?

Do you have a marker? so, just use the string as name. Do you want to know a position of a location (city, village on map) so use locationPosition, or what else?

Share this post


Link to post
Share on other sites
9 minutes ago, pierremgi said:

Could you clarify?

Do you have a marker? so, just use the string as name. Do you want to know a position of a location (city, village on map) so use locationPosition, or what else?

Just simply instead of writing

getMarkerPos "Name"

than doing 

getMarkerPos _markerName

which would then return the name of the case, which in this case would be "Name".

Share this post


Link to post
Share on other sites
On 11/18/2019 at 4:53 PM, KaidenSmith said:

Where the _name variable is supposed to come out as "Name".

Well surely _location, or whatever the string being compared in the switch statement, is the case name "Name" or what ever the corresponding match is.

_location = "Name";
_name = switch (_location) do {
	case "Name" {
		player setPos getMarkerPos _location;
		_location
	};
};

if ( !isNil "_name" && { _name != "" } ) then {
	hint format[ "Marker '%1' was choosen", _name ];
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
34 minutes ago, Larrow said:

Well surely _location, or whatever the string being compared in the switch statement, is the case name "Name" or what ever the corresponding match is.


_location = "Name";
_name = switch (_location) do {
	case "Name" {
		player setPos getMarkerPos _location;
		_location
	};
};

if ( !isNil "_name" && { _name != "" } ) then {
	hint format[ "Marker '%1' was choosen", _name ];
};

 

Feel like a complete moron when you explain it like that 🤦‍♂️

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×