stackexchange Posted September 16, 2014 Report Share Posted September 16, 2014 I'm trying to do a basic conditional if statement. I want to compare X to an array variable I have set. I basically have a preset array of strings I want to match a given variable to. I currently have this: http://prntscr.com/4n8ll0 if %name% = %name_ban[]% I left out the number inside the bracket to match the entire array. can this be done or is there another method to match a variable to a set of strings within an array? Quote Link to comment Share on other sites More sharing options...
acantor Posted September 16, 2014 Report Share Posted September 16, 2014 You may need to use a repeat to loop through all each value of the array. The code isn't complicated -- start repeat, test, iterate, end repeat -- but I don't think there are any major shortcuts. Quote Link to comment Share on other sites More sharing options...
Samrae Posted September 16, 2014 Report Share Posted September 16, 2014 Something like this may work as a starting point: Variable Set Integer %Idx% to 0 Get Array Length (%name_ban%) => %Max% Repeat Until %Idx% Is Greater Than or Equal To "%Max%" Variable Modify Integer %Idx%: Increment If Variable %name% Equals "%name_ban[%Idx%]%" // Do something special here End If End Repeat Quote Link to comment Share on other sites More sharing options...
Cory Posted September 16, 2014 Report Share Posted September 16, 2014 MEP doesn't have any array manipulation commands. I have a collection of macro subroutines to do various things like finding the index of a member, count, sort, and so forth. Also I find it valuable to create a values when I induct the data. Say for instance I loop through some text to propagate an array. I'll also count the number of members at that time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.