mIRC Home    About    Download    Register    News    Help

Print Thread
#170336 07/02/07 01:52 PM
K
klaaamp
klaaamp
K
If I got a variable that contains a random amount of words seperated with space and I want to make a whileloop that write every word from it line by line in a list in a dialog, whats the code for the loop?

#170342 07/02/07 02:19 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Code:
var %cnt = 1
var %total = $gettok(%variable,0,32)
while (%cnt <= %total) {
  did -a DNAME ID $gettok(%variable,%cnt,32)
  inc %cnt
}


Replace the DNAME ID part and it should be fine. If you want to insert the lines somehow other than just adding them, try -i instead (or check for other methods of using /did).

#170348 07/02/07 02:32 PM
Joined: Feb 2006
Posts: 523
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 523
duno if you realize, but you don't really need a while loop to add them onto the end of the list, you can also use //didtok dname id 32 %var


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #170376 07/02/07 09:10 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Heh, I forgot about that command since I rarely use list boxes for anything. smile


Link Copied to Clipboard