Jump to content
Sign in to follow this  
1para{god-father}

Case statement Advise

Recommended Posts

Trying to get a case statement to work.

So depending on the color of mymarkercolour I should get the Correct Hint but i do not get anything ?

where am i going wrong ?

mymarkercolour = ["ColorRed","Coloryellow","ColorGreen","ColorBlue","ColorOrange","ColorRedAlpha","ColorKhaki","ColorBrown","ColorPink"] call BIS_fnc_selectRandom;

switch (mymarkercolour) do
{
   case "ColorRed":
   {
       hint "Red marker";
   };
   case "Coloryellow":
   {
       hint "yellow";
   };

   case "ColorGreen":
   {
       hint "green";
   };
   case "Colororange":
   {
       hint Orange";
   };
   case "ColorRedAlpha":
   {
       hint "ColorRedAlpha";
   };
   case "ColorKhaki":
   {
       hint "ColorKhaki";
   };
   case "Colorbrown":
   {
       hint "brown";
   };
   case "Colorpink":
   {
       hint "Pink";
   };

};



Share this post


Link to post
Share on other sites

Di you place the functions module on your map?

To get around using the BI function try and use this:

private["mymarkercolour "];
_tempvariable = ["ColorRed","Coloryellow","ColorGreen","ColorBlue","ColorOrange","ColorRedAlpha","ColorKhaki","ColorBrown","ColorPink"];
_cv = (count tempvariable) - 1;
mymarkercolour =  tempvariable select (ceil (random _cv));
switch (mymarkercolour) do
{
   case "ColorRed":
   {
       hint "Red marker";
   };
   case "Coloryellow":
   {
       hint "yellow";
   };

   case "ColorGreen":
   {
       hint "green";
   };
   case "Colororange":
   {
       hint Orange";
   };
   case "ColorRedAlpha":
   {
       hint "ColorRedAlpha";
   };
   case "ColorKhaki":
   {
       hint "ColorKhaki";
   };
   case "Colorbrown":
   {
       hint "brown";
   };
   case "Colorpink":
   {
       hint "Pink";
   };
};

Share this post


Link to post
Share on other sites

Ah cheers Cruel :D

Fixed it! There was a " missing infront of Orange.

private["mymarkercolour "];
_tempvariable = ["ColorRed","Coloryellow","ColorGreen","ColorBlue","ColorOrange","ColorRedAlpha","ColorKhaki","ColorBrown","ColorPink"];
_cv = (count tempvariable) - 1;
mymarkercolour =  tempvariable select (ceil (random _cv));
switch (mymarkercolour) do
{
   case "ColorRed":
   {
       hint "Red marker";
   };
   case "Coloryellow":
   {
       hint "yellow";
   };

   case "ColorGreen":
   {
       hint "green";
   };
   case "Colororange":
   {
       hint "Orange";
   };
   case "ColorRedAlpha":
   {
       hint "ColorRedAlpha";
   };
   case "ColorKhaki":
   {
       hint "ColorKhaki";
   };
   case "Colorbrown":
   {
       hint "brown";
   };
   case "Colorpink":
   {
       hint "Pink";
   };
};

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
Sign in to follow this  

×