mIRC Home    About    Download    Register    News    Help

Topic Options
#72641 - 24/02/04 11:42 AM set many variables
hatten Offline
Pikka bird

Registered: 20/02/04
Posts: 14
ok i have asked quite a few question the last few days smile but hopefully someone else also can make use of the top notch replies ive been getting. i have a part in a script which looks like this ;

set %variable10 %variable9
set %variable9 %variable8
set %variable8 %variable7
set %variable7 %variable6
set %variable6 %variable5
set %variable5 %variable4
set %variable4 %variable3
set %variable3 %variable2
set %variable2 %variable1

i wonder if this is the most efficient and fastest way to set these 10 variables ?

Top
#72642 - 24/02/04 11:49 AM Re: set many variables
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
alias setvars {
var %i 10
while $calc(%i - 1) {
set %variable [ $+ [ %i ] ] %variable [ $+ [ $calc(%i -1) ] ]
dec %i
}
}
_________________________
New username: hixxy

Top
#72643 - 24/02/04 12:55 PM Re: set many variables
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
you should have started at 9 and added one, then u could just test while %i

Top
#72644 - 24/02/04 01:14 PM Re: set many variables
Man Offline
Ameglian cow

Registered: 11/12/03
Posts: 33
What are you trying to do, I have a small idea of why you might be setting all those variables (you have some que or something). If this is the case a hidden list window will do the job alot better, and if you need to its easy to visualise the que.

If not, why else are you setting all these variables like this?

Top
#72645 - 24/02/04 01:15 PM Re: set many variables
hatten Offline
Pikka bird

Registered: 20/02/04
Posts: 14
not sure if i get that (dave c) smile


Edited by hatten (24/02/04 01:17 PM)

Top
#72646 - 24/02/04 09:11 PM Re: set many variables
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Code:
alias set.vars {
  var %i = 9
  while %i {
    set %variable $+ $calc(%i +1)  $($+(%,variable,%i),2)
    dec %i
  }
}

Top
#72647 - 24/02/04 10:23 PM Re: set many variables
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
hidden windows wont last through a mirc shutdown/crash varaibles well

Top
#72648 - 25/02/04 07:02 AM Re: set many variables
Man Offline
Ameglian cow

Registered: 11/12/03
Posts: 33
But for most ques that doesnt matter. Thats why I asked what the variables were being used for.

Top