tomagucci Posted September 25, 2008 Share Posted September 25, 2008 (edited) hi, I am totally learning autoit from absolutely no computer programing background so please bear with me. Im trying to do something but I dont know to say it. here goes$array[$i] = Random Value not zeroFor $i=0 to $i=4 step + 1 Do Generalcommand(); makes $array[$i] = 0 until $array[0] = 0 and $array[1] = 0 and $array[2] = 0 and $array[3] = 0 and $array[4] = 0nextits the "$array[0] = 0 and $array[1] = 0 and $array[2] = 0 and $array[3] = 0 and $array[4] = 0" that I dont know how to shorten, if i just say $array[$i] = 0 it will stop whenever one of them turns to zero and it happens to be looping there, How do i say for all of them in one line without being so repetitive. I dont know how to address all of the array values at the same time.Thanks for all the help, its greatly appreciated, been wracking my brain for hoursChris Edited September 25, 2008 by tomagucci Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 you just need this. For $i = 0 To 4 GeneralCommand() Next I don't see how you would need the do until statement unless your generalcommand() function changes the values of the array. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
tomagucci Posted September 25, 2008 Author Share Posted September 25, 2008 (edited) it does, it changes them to zero, but i dont want it to stop doing it until all the values in the array have become zero. Does that make sense?, sorry I saw where that was weird, does that help clairfy it? Edited September 25, 2008 by tomagucci Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 Then you still don't need the do until if it changes the element currently used. you could just mod the function to accept the current element/array as a parameter then pass it through the for/next loop. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
tomagucci Posted September 25, 2008 Author Share Posted September 25, 2008 (edited) okay, the do is only the first part, here is the whole thing: $array[$i] = Random Value not zero For $i=0 to $i=4 step + 1 Do Generalcommand(); makes $array[$i] = 0 until $array[0] = 0 and $array[1] = 0 and $array[2] = 0 and $array[3] = 0 and $array[4] = 0 If $array[0] = 0 and $array[1] = 0 and $array[2] = 0 and $array[3] = 0 and $array[4] = 0 then exit next its more of the second part that isnt working, well technically it is, but the range of $i changes sometimes and if i need to edit i need to go back in and change everyone. the actual range of $i in my code is 12 and sometimes it will change to anywhere from 1-12 Edited September 25, 2008 by tomagucci Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 why not just check the last value? also in your for you don't need the step, a Step 1 is implied. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
tomagucci Posted September 25, 2008 Author Share Posted September 25, 2008 because it doesnt stay constant like that, the values of $array are constantly changing, generalcommand() might change it to 0 once but it will change again, i need generalcommand() to keep working until every value is zero in one full loop Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 You could try something like this to make it a bit easier (assuming you mod the generalcommand() to accept parameters). For $i = 0 To UBound($array) Generalcommand($array[$i]) $sum += $array[$i] Next If $sum = 0 Then Exit Endif Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
tomagucci Posted September 25, 2008 Author Share Posted September 25, 2008 generalcommand() modifies several things and $array[$i] cannot fit within the parameters. I really appreciate the help though Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 what do you mean it can't fit within the parameters? a custom function can have infinite parameters so i don't see what you mean. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
tomagucci Posted September 25, 2008 Author Share Posted September 25, 2008 (edited) hmm well i tried it, I dont know how to modify the parameters to get that method to work. is there another method? isnt there something that can directly address the array? does += mean add them all together? if it does then thats all i need. Edited September 25, 2008 by tomagucci Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 25, 2008 Share Posted September 25, 2008 yeah += means add the value of whatever is after the = to the variable on the left of the +, so -= would be minus, &= would append the data, etc. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now