|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I came up with an idea that I thought would work, but it just freezes mIRC, like the other suggestions did too. Why would it do that? Here's what I tried.
while %y <= $did(scriptsend,1).lines {
if ($did(scriptsend,1,%y).len >= 1) || ($did(scriptsend,1,%y) == $chr(32)) {
msg $snick($active,%x) $did(scriptsend,1,%y).text
inc %y
}
}
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
I just noticed that you have the inc %y at the end of the loop. That means, when a blank line is encountered the inc %y never happens. When I'm making loops, I usually put the inc %y part as the first command within the loop so it is guaranteed to work. Try replacing the second loop with this:
var %y = 0, %yy = $did(scriptsend,1).lines
while (%y < %yy) {
inc %y
if ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) continue
msg $snick($active,%x) $did(scriptsend,1,%y).text
}
-genius_at_work
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Just moving the inc %y outside of the if statement would also work: while %y <= $did(scriptsend,1).lines {
if ($did(scriptsend,1,%y).len) || ($did(scriptsend,1,%y) == $chr(32)) {
msg $snick($active,%x) $did(scriptsend,1,%y)
}
inc %y
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
That's still giving me problems. That actually made me disconnect from the server with a "Connection reset by peer". This seems like it should be easy to come up with, but I'm not able to figure it out.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Did you try it more than once?
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I just tried that last suggestion, and it works to send a script to someone, but the problem is that after I send you a script, you won't see queries from me, and I think anyone else. I don't know why. I think the problem has to be somewhere here:
on *:text:*:?:{
if (%script) {
window -h $nick
if ($window(@script)) {
aline @script $1-
}
else {
window @script
aline @script $1-
}
}
}
Last edited by bwr30060; 13/05/06 09:58 PM.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I just made a change, and I have no idea why it won't work. It still blocks queries after you've received a script with this script.
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick($active,0)) {
ctcp $snick($active,%x) script
var %y = 1
while %y <= $did(scriptsend,1).lines {
if ($did(scriptsend,1,%y).len) || ($did(scriptsend,1,%y) == $chr(32)) {
msg $snick($active,%x) $did(scriptsend,1,%y)
}
inc %y
}
ctcp $snick($active,%x) endscript
inc %x
}
}
ctcp ^*:script: {
set %script 1
window @script
}
ctcp ^*:endscript: {
unset %script
}
on *:text:*:?:{
if (%script) {
window -h $nick
aline @script $1-
}
else { .echo -q nothing }
}
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
if ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) continue
replace with
if ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) { inc %y | continue }
/continue means jump execution to the /WHILE loop, it was just a slight oversite in forgetting to increment the loop counter, thus jamming the loop on the same line forever. the inc %y corrects that.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Sorry for the question, but what would that whole section be then? I don't have that $null part you mentioned. My On Dialog event looks like this:
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick($active,0)) {
ctcp $snick($active,%x) script
var %y = 1
while %y <= $did(scriptsend,1).lines {
if ($did(scriptsend,1,%y).len) || ($did(scriptsend,1,%y) == $chr(32)) {
msg $snick($active,%x) $did(scriptsend,1,%y)
}
inc %y
}
ctcp $snick($active,%x) endscript
inc %x
}
}
I think I know what you meant to try. Is this correct? If it is, I tried it just now, and the other person still doesn't get queries after I send a script with this. I don't think it's a problem in the On Dialog event. I think the problem is with the on *:text:?: event. Here's the dialog event.
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick($active,0)) {
ctcp $snick($active,%x) script
var %y = 1
var %y = 0, %yy = $did(scriptsend,1).lines
while (%y < %yy) {
inc %y
if ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) { inc %y | continue }
msg $snick($active,%x) $did(scriptsend,1,%y).text
}
ctcp $snick($active,%x) endscript
inc %x
}
}
And here's the text event.
on *:text:*:?:{
if (%script) {
window -h $nick
aline @script $1-
}
else { .echo -q nothing }
}
Last edited by bwr30060; 14/05/06 01:27 AM.
|
|
|
|
|