• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

wait for condition = do until? (random numbers)

Status
Not open for further replies.
Level 3
Joined
Feb 8, 2010
Messages
34
I'm in a rather weird situation. I'm looking for a do...until function. Here's what the trigger looks like:

for each integer x for 1 to 15

y = random number from 1 to 21
z (integer) = my_array[y]

my array has values which are >= 1 and the rest, 0. In order to continue the trigger, z must be >= 1. How would I use wait for condition in order to ensure this? Or there could be another way to do this?
 
Level 3
Joined
Feb 8, 2010
Messages
34
That's not quite what I meant. I'll make it a bit clearer.

1 Do this for each player x.
2 Get a random number y.
3 Is my_array[y] > 0?
4 If so, new_array[x] = y.
5 Else randomize y until my_array[y] >0.

By the end of this, I would have a number for each player eg. new_array[1] = 13 since my_array[13] = 1.

What I'm asking is how would I do step 5?
 
erm, why didn't you just:
  • Trigger
    • Variable - Set IntegerY = (Random integer between 1 and 13)
thou, if you have some reason. Then use this:
  • Trigger
    • General - Repeat (Actions) forever
      • Actions
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • IntegerY >= 0
          • Then
            • General - Break
          • Else
            • Variable - Set IntegerY = (Random integer between 0 and 100)
 
Level 3
Joined
Feb 8, 2010
Messages
34
JASS:
wtf()
{
       if(conditionx=true, w/e)
      {
        while(X<16)
               {
                x++;
                crapgoeshere
               }
       }
}
That's how i would do it.
You could propably use the action "If/then/else"

(that's C)

I don't either. It's irrelevant with my question. Anyway, I worked around the problem with Break so thanks, Ribena ;P
 
Status
Not open for further replies.
Top