AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

array iteration?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
dakun
Guest





PostPosted: Wed Jul 09, 2008 8:25 pm    Post subject: array iteration? Reply with quote

im attempting to reduce the size of one of my programs but i cant get arrays to work. but when i try to run the reduced code, it doesnt store anything to the variables.

im trying to reduce this
Code:
varReset:
total=0
20s=0
19s=0
18s=0
17s=0
16s=0
15s=0
14s=0
13s=0
12s=0
11s=0
10s=0
9s=0
8s=0
7s=0
6s=0
5s=0
4s=0
3s=0
2s=0
1s=0
GuiControl,, output,
gui,submit,noHide
return


to this
Code:
varReset2:
it=1
total=0
loop 20{
%it%s:=0
%it%++
}
GuiControl,, output,
gui,submit,noHide
return
Back to top
tonne



Joined: 06 Jun 2006
Posts: 1160
Location: Denmark

PostPosted: Wed Jul 09, 2008 8:47 pm    Post subject: Reply with quote

Code:
loop, 20
{
%a_index%s := 0
}

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
dakun
Guest





PostPosted: Wed Jul 09, 2008 9:33 pm    Post subject: Reply with quote

thx, why is it that we cant use our own variables?
Back to top
tonne



Joined: 06 Jun 2006
Posts: 1160
Location: Denmark

PostPosted: Wed Jul 09, 2008 9:46 pm    Post subject: Reply with quote

You can (but you had a typo:
Code:
it=1
total=0
loop 20{
%it%s:=0
it++ ; no % here
}
)
_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
dakun
Guest





PostPosted: Wed Jul 09, 2008 10:26 pm    Post subject: Reply with quote

i had that there before and it didnt work, i think
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group