Jump to content
Sign in to follow this  
iceman77

Switch Do Rank

Recommended Posts

I'm making a SP mission. Why doesn't switch do work for this? I've tried without using strings & got invalid number in expression.

If (Rank Player == "Private") Then {Hint "Private"}; //-----Works-----//

Switch (Rank Player) Do //-----Does Not Work------//

{

   Case "Private":{Hint "Private"};
   Case "Corporal":{Hint "Corporal"};
   Case "Sergeant":{Hint "Sergeant"};
   Case "Lieutenant":{Hint "Lieutenant"};
   Case "Captain":{Hint "Captain"};
   Case "Major":{Hint "Major"};
   Case "Colonel":{Hint "Colonel"};

};

Edited by Iceman77

Share this post


Link to post
Share on other sites

try making the cases all caps, on This page it shows them in all caps, and

Im pretty sure switch is case sensitive with strings.

Share this post


Link to post
Share on other sites

Thanks, I'm sure that will do the trick. Appreciated.

One more thing. How can I realize the terrainGrid? Using hint format ["%1", TerrainGrid] returned any. Anyhow, I basically need know what the terraingrid is when a dialog pops, so I can set a combo dropdowns shown index.

Switch (TerrainGrid) Do 

        {

                  Case 50:{_Grasscontrol lbSetCurSel 0};
                  Case 48:{_Grasscontrol lbSetCurSel 1};
                  Case 25:{_Grasscontrol lbSetCurSel 2};
                  Case 12.5:{_Grasscontrol lbSetCurSel 3};

        };

Edited by Iceman77

Share this post


Link to post
Share on other sites

I don't think there's any way to find that out. You could just set it in init.sqf so you know its start value and base the rest on 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
Sign in to follow this  

×