|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I came up with this idea to make it easier to send scripts over mIRC. If you paste a script into a channel or query, the person has to remove <Blake> from the beginning of every line, so I'd like to be able to have this dialog for sending scripts. Both people would have to have this script, but what it would do would be to put the sent script into a @window to make it easier to copy. I'm having problems with this though, and I can't figure where all the problems are. In my status window, it's doing a few things. It looks like it's trying to send a notice to someone named Send with the text Script, and I'm also getting "* /ctcp: insufficient parameters (line 19, scriptsend.mrc)". Line 19 is: ctcp $snick(#,%x) endscript Here's what I have so far:
dialog scriptsend {
title "Script Sender"
size -1 -1 428 470
option pixels notheme
edit "", 1, 4 9 419 316,multiline, vsbar
button "Send Script", 2, 4 332 65 25
}
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick(#,0)) {
ctcp $snick(#,%x) script
inc %x
}
var %y = 1
while %y <= $did(scriptsend,1).lines {
msg $snick(#,%x) $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick(#,%x) endscript
}
ctcp ^*:scriptsend: {
haltdef
set %script 1
if ($window(script)) {
aline @script $crlf
}
else {
window @script
}
}
ctcp ^*:endscript: {
haltdef
unset %script
}
on *:text:*:*:{
if (%script) {
aline @script $1-
}
}
Thanks for any help. OK, I fixed the problem with it sending to the wrong nick. I'm still having a problem though. I need to have it remember every selected nick so it can send the script to them, and right now, it's saying: dialog No such nick/channel - title No such nick/channel etc. How would I save the nicks since I have to get out of that loop to send the script?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick(#,0)) {
ctcp $snick(#,%x) script
var %y = 1
while %y <= $did(scriptsend,1).lines {
msg $snick(#,%x) $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick(#,%x) endscript
inc %x
}
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Thanks. That got rid of the errors, but now it just doesn't do anything. It doesn't send any script.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
On *:Dialog:scriptsend:sclick:2: {
var %x = 1
while (%x <= $snick(#,0)) {
ctcp $snick(#,%x) script
inc %x
}
var %y = 1
while %y <= $did(scriptsend,1).lines {
msg Blake $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick(#,%x) endscript
inc %x
}
ctcp *:script: {
set %script 1
}
ctcp ^*:endscript: {
unset %script
}
on *:text:*:*:{
if (%script) {
aline @script $1-
}
}
This script will send me the text I want, but only because I hard coded my name. It seems to have problems with $snick(#,%x). I left the ctcp the way it is and it always errors out on that line. Any ideas?
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
This script works. It sends the script to a window, but there's still a problem. To make this work, I had to hard code the name of the channel. It seems like the dialog event won't recognize which nicks are selected in the nick list. I'd really like to fix this so I don't have to hard code channel names.
dialog scriptsend {
title "Script Sender"
size -1 -1 428 470
option pixels notheme
edit "", 1, 4 9 419 316,multiline, vsbar
button "Send Script", 2, 4 332 65 25
}
On *:Dialog:scriptsend:sclick:2: {
$SendScript($snick(#chat,1))
}
ctcp ^*:script: {
haltdef
set %script 1
}
ctcp ^*:endscript: {
unset %script
}
on *:text:*:*:{
if (%script) {
aline @script $1-
}
}
alias SendScript {
if ($window(script)) {
aline @script $crlf
}
else {
window @script
ctcp $1 script
var %y = 1
while %y <= $did(scriptsend,1).lines {
msg $1 $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick(#,%x) endscript
}
}
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
I believe it should be $active in place of # since # isn't going to have a value in a dialog event.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Thanks, that works. Another small thing, no big deal if I can't do this. This script sends a query with the script text you'd like to send, and also puts it in a window. If I can, I'd like to not have the query window show up at all. I put a haltdef, but the window still opens, there's just no text in it. Can this be done? Thanks.
on ^*:text:*:?:{
if (%script) {
haltdef
if ($window(script)) {
aline @script $1-
}
else {
window @script
aline @script $1-
}
}
}
It's also not halting my CTCPs from showing up.
Last edited by bwr30060; 12/05/06 05:39 PM.
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
I'm not sure if you can prevent the window from opening, but you could hide the window while the script is still sending and close it when finished.
/window -h <window-name> /window -c <window-name>
Also, on this line:
if ($window(script)) {
I believe you meant: if ($window(@script)) {
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Sorry, I meant the query window. I'd like to not have it show up at all if the query I'm getting is a script being sent using this script.
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
You can hide the query window.
/window -h <some-nick>
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Ah, ok. Thanks
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
on ^*:open:?:*:{ possable.script.text $1- }
on ^*:text:*:?:{ possable.script.text $1- }
alias -l possable.script.text {
if (%script) {
haltdef
window @script
aline @script $1-
}
} * code untested * Try out that, It uses the open pm event to get the text if the window doesnt exist, and stops the Pm window opening, if its already open then it cacthes it using text pm event, I think this is better than hiding the window, as if the user already had a pm open to the person, they most likely dont want it hidden. I also simplified the sending the text to the @script window, i just create it everytime, if it exists already who cares, telling mirc to create it when already in existence is ignored (and is slightly faster than checking for it anyway)
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
This works for what I want to do. I might try yours later tonight just to see, but here's what I have.
dialog scriptsend {
title "Script Sender"
size -1 -1 428 470
option pixels notheme
edit "", 1, 4 9 419 316, multi vsbar
button "Send Script", 2, 4 332 65 25
button "Clear", 3, 76 332 65 25
}
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 {
msg $snick($active,%x) $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick($active,%x) endscript
inc %x
}
}
ctcp ^*:script: {
haltdef
set %script 1
}
ctcp ^*:endscript: {
haltdef
unset %script
}
on ^*:text:*:?:{
if (%script) {
window -h $nick
if ($window(@script)) {
aline @script $1-
}
else {
window @script
aline @script $1-
}
}
}
alias SendScript {
if ($window(script)) {
aline @script $crlf
}
else {
window @script
ctcp $1 script
var %y = 1
while %y <= $did(scriptsend,1).lines {
msg $1 $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick($active,%x) endscript
}
}
On *:Dialog:scriptsend:sclick:3: {
did -r scriptsend 1
}
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
dialog scriptsend {
title "Script Sender"
size -1 -1 428 470
option pixels notheme
edit "", 1, 4 9 419 316, multi vsbar
button "Send Script", 2, 4 332 65 25
button "Clear", 3, 76 332 65 25
}
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 {
.msg $snick($active,%x) $did(scriptsend,1,%y).text
inc %y
}
.ctcp $snick($active,%x) endscript
inc %x
}
}
On *:Dialog:scriptsend:sclick:3: {
did -r scriptsend 1
}
ctcp ^*:script: {
haltdef
set -u600 $+(%,script.,$nick) 1
}
ctcp ^*:endscript: {
haltdef
unset $+(%,script.,$nick)
}
on ^*:open:?:*:{ possable.script.text $1- }
on ^*:text:*:?:{ possable.script.text $1- }
alias -l possable.script.text {
if ($($+(%,script.,$nick),2)) {
haltdef
window @script
aline @script $1-
}
} try that out, its untested, but i think it well work. I added . to the ctcp's and the msg's so you dont have to see them all being sent (add or remove at your pleasure) I added dynamicly named %script vars so its turned of and on per user, while its possable two users might dump u a script at the same moment, causing mucking up of the @script window, this way at least, if one person is sending you a script and another pming you in chat, his chat wont end up in the script window. Also added a 10min auto unset to the setting of the $script. $nick var incase the user never sends the turn off code Used my idea for the on texts to not create the pm window, or ignore it if it exists. One last possable alturnative is also this alias -l possable.script.text {
if ($($+(%,script.,$nick),2)) {
haltdef
window $+(@script.,$nick)
aline $+(@script.,$nick) $1-
}
} This would create sepreate @script. $nick windows so u could track who sent what script, and avoid the chance of two same time sent scripts overlapping in the same window. This may however be few and far between, i dont know how active the channel u mentioned is.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Thanks. I'll give that one a try too. The channel I'm talking about is on my own IRC server, which really has not had many people at all on it. so at least I won't have to worry about messages getting put in the window. Anyone is still welcome to check out my IRC server. I'd like to have it be a place where you can discuss scripts, if it ever gets going.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
This seems to be having a problem. This is the final script I ended up with (I haven't tried the other one yet), and the one loop seems to be failing. It's the loop to check how many lines are in the edit box so that it sends them all. For some reason, the loop seems to keep going even after the number of lines is exceeded, and then %script doesn't get unset. This causes a problem, because then other queries get put into the @window. Can anyone figure out why this is failing? I'll just repost the section of code where that loop is.
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 {
msg $snick($active,%x) $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick($active,%x) endscript
inc %x
}
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I know what the issue is, but I'm not sure how to solve it. It only errors out sometimes, and this is because sometimes when I'm sending a script to test, I paste the whole thing and then decide I only need to send a few lines. I then delete all but about three lines, leaving the cursor on a blank line. The line count considers where the cursor is to be a line, but there's no text there, so it can't be set to a variable. How can I handle this so that it would check to make sure that there is something on that line before setting it to a variable? Thanks.
EDIT:
There is another problem. After I send someone a script, they don't get my queries that I send them.
Last edited by bwr30060; 13/05/06 01:47 AM.
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
You need to add a line to skip blank lines. Add this line as the first line inside the second while-loop.
if ($did(scriptsend,1,%y).text == $null) continue
-genius_at_work
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
I'd use if ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) continue to prevent errors with lines that contain only spaces.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I just tried both ways you two mentioned and the script locks up either way. What am I doing wrong. And this might be a stupid question, but did you literally want me to have the word "continue" there? I haven't seen that used. Thanks.
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 ($remove($did(scriptsend,1,%y).text,$chr(32)) == $null) continue
msg $snick($active,%x) $did(scriptsend,1,%y).text
inc %y
}
ctcp $snick($active,%x) endscript
inc %x
}
}
Last edited by bwr30060; 13/05/06 01:56 PM.
|
|
|
|
|