mIRC Home    About    Download    Register    News    Help

Print Thread
#170336 07/02/07 01:52 PM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
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?

klaaamp #170342 07/02/07 02:19 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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).


Invision Support
#Invision on irc.irchighway.net
klaaamp #170348 07/02/07 02:32 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Heh, I forgot about that command since I rarely use list boxes for anything. smile


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard