mIRC Homepage
Posted By: bwr30060 want to create an input box for notices - 13/10/05 04:33 AM
Hey,

I've decided it would be good to write a script that pops up an input box and sends the text as a notice to the person I selected. I can figure out how to do that much, but ideally what I want is for the box to stay open so I can have a conversation in notices with the person. both of our notices will still show up in the chat window, but I'm trying to eliminate the problem of forgetting the first / and sending the text to the channel. I'd like to have this as a popup, so I'd right click the person's name on the nicklist and select my notice popup and it would open an input box. Thanks for any help.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 01:20 PM
This should do it for you. You can have notice windows for multiple nicks at once. Feel free to change the size of the dialog box and the edit box to suit your needs.

Code:
dialog Notice {
  title "Notice"
  size -1 -1 200 40
  option dbu

  text "",1,5 5 100 8
  edit "",2,5 14 190 10,autohs

  button "Hidden",3,210 50 1 1
  button "Close",4,90 27 20 8,ok
}

on *:dialog:Notice:init:*: {
  did -a $dname 1 Notice %nnick $+ :
  did -ht $dname 3
}

on *:dialog:Notice:sclick:*: {
  if ($did == 3 && $did(2) != $null) {
    .notice $left($gettok($did(1),2,32),-1) $did(2)
    did -r $dname 2
  }
}

menu nick {
  -
  Notice: set %nnick $snick | dialog -m Notice Notice
}
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 02:23 PM
Hey,

Thanks for that code. It's not working though, and I don't know why. I have this in remotes:

dialog Notice {
title "Notice"
size -1 -1 200 40
option dbu
text "",1,5 5 100 8
edit "",2,5 14 190 10,autohs
button "Hidden",3,210 50 1 1
button "Close",4,90 27 20 8,ok
}
on *:dialog:Notice:init:*: {
did -a $dname 1 Notice %nnick $+ :
; did -ht $dname 3
}
on *:dialog:Notice:sclick:*: {
if ($did == 3 && $did(2) != $null) {
.notice $left($gettok($did(1),2,32),-1) $did(2)
did -r $dname 2
}
}

And I have this in my nicklist popups:

menu nick {
Notice: set %nnick $snick | dialog -m Notice Notice
}

I'm getting this in my status window: NOTICE: Unknown command. Also, what do I hit to send the notice? I'm assuming it's enter. I only have a close button. Thanks.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 02:31 PM
When do you get the error, and does it give a line number?

And, yes, you hit enter to send. It uses a hidden button that trigger when hitting enter to send the data. I thought that would be easier than clicking a button all the time.
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 02:35 PM
Hey,

Yes, actually I get another error too. I was working with someone and they had me comment out a line. When I have it exactly your way, I also get * /notice: insufficient parameters (line 148, script1.ini). Line 148 is:

.notice $left($gettok($did(1),2,32),-1) $did(2)

Thanks.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 03:36 PM
Sorry for the delay getting back to you. The problem was a mistake I made with how to use $snick. I forgot that you need to have $snick($chan,1) instead of just $snick. Here...
Code:
dialog Notice {
  title "Notice"
  size -1 -1 200 40
  option dbu

  text "",1,5 5 100 8
  edit "",2,5 14 190 10,autohs

  button "Hidden",3,210 50 1 1
  button "Close",4,90 27 20 8,ok
}

on *:dialog:Notice:init:*: {
  did -a $dname 1 Notice %nnick $+ :
  did -ht $dname 3
}

on *:dialog:Notice:sclick:*: {
  if ($did == 3 && $did(2) != $null) {
    .notice $left($gettok($did(1),2,32),-1) $did(2)
    did -r $dname 2
  }
}

menu nick {
  -
  Notice: set %nnick $snick($chan,1) | dialog -m Notice Notice
}


You should now see "Notice nick:" in the notice box instead of just "Notice :" ... and that will mean that the .notice part will work properly.

Let me know if it works.
Posted By: MikeChat Re: want to create an input box for notices - 13/10/05 03:43 PM
mostly because I was bored, I played with this and made a few changes so it worked on my copy of mIRC
Code:

dialog Notice {
  title "Notice"
  size -1 -1 200 40
  option dbu
  text "",1,5 5 100 8
  edit "",2,5 14 190 10,autohs
  button "Hidden",3,210 50 1 1
  button "Close",4, 90 27 20 8, cancel
}
on *:dialog:Notice:init:*: {
  did -a $dname 1 MultiNotice $replace(%nnick,$chr(44),$chr(32)) $+ :
  did -ht $dname 3
}
on *:dialog:Notice:sclick:3: {
  if ($did(2) != $null) {
    notice %nnick $did(notice,2).text To: $replace(%nnick,$chr(44),$chr(32))
    did -r $dname 2
  }
}
on *:dialog:Notice:sclick:4: {
  unset %nnick
}
menu nicklist {
  Notice Box: set %nnick $snicks | dialog -m Notice Notice
}
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 03:49 PM
Riamus,

I still got NOTICE: Unknown command in my status window. I'll try Mike's version of this too. Do I put all of that into remotes, or does the nicklist part of the code have to be in popups? Thanks.
Posted By: MikeChat Re: want to create an input box for notices - 13/10/05 03:53 PM
the whole thing I posted goes in remotes, preferably in its own file, but can be added in another remote file if you prefer.
In either case make sure the original code is replaced/removed when adding in my post.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:00 PM
It almost sounds like you have a bracket mismatch in your script. Click the bracket checker button and see.

Also, try putting it like this:

echo -a $left($gettok($did(1),2,32),-1) $did(2)
.notice $left($gettok($did(1),2,32),-1) $did(2)

See if it echoes the nick and the text. If not, let me know. Also, let me know if your heading on the notice box says "Notice nick:" or if it says "Notice :"
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 04:00 PM
LOL,

When I put the whole thing in remotes, including this:
menu nicklist {
Notice Box: set %nnick $snicks | dialog -m Notice Notice
}

there's no option for it when I right click a name. It was semi working when I put that in popups. What's the syntax to enter in that box when I send a notice? I right clicked my own name and typed "hi" and it appears to be trying to send notices to "Box", and a notice to "hi" with the message "To:". LOL, I hate debugging. I'm sorry I'm new to this. Thanks for all the help though. (PS, this is using Mike's version now)
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:03 PM
It should be menu nick, not menu nicklist.

If it's trying to do "box"... then you definitely do have a bracket problem (in both scripts). It's having the error in the menu section.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:05 PM
MikeChat, the only thing with how you changed it...

If multiple nicks are selected, I'm not sure that /notice works with multiple nicks. Maybe it does. I can't test that right now. If so, great. Though, normally you don't want to keep noticing a bunch of people. smile
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:11 PM
Code:
dialog Notice {
  title "Notice"
  size -1 -1 200 40
  option dbu

  text "",1,5 5 100 8
  edit "",2,5 14 190 10,autohs

  button "Hidden",3,210 50 1 1
  button "Close",4,90 27 20 8,ok
}

on *:dialog:Notice*:init:*: {
  did -a $dname 1 Notice %nnick $+ :
  did -ht $dname 3
}

on *:dialog:Notice*:sclick:*: {
  if ($did == 3 && $did(2) != $null) {
    .notice $left($gettok($did(1),2,32),-1) $did(2)
    did -r $dname 2
  }
}

menu nick {
  -
  Notice: set %nnick $snick($chan,1) | dialog -m $+(Notice.,%nnick) Notice
}


Btw, I made a change to it to allow multiple notice windows at once. I thought I had it set for that originally, but forgot. This will allow you to notice different people different things without conflict. (once you have it working) wink

Anyhow, like i said, check for a bracket problem before the menu section.
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 04:11 PM
/me clubs himself with a large trout in frustration! lol

I did find a bracket mismatch and I fixed it. However, it is still trying to send a notice to "hi" with the text "To:" and a notice to "Box:" with the text "set Blake" (I was trying to send a notice to myself). Any ideas?
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:14 PM
Try my copy again.
Posted By: MikeChat Re: want to create an input box for notices - 13/10/05 04:17 PM
When I change the menu to "menu nick {" it does not work.

ckecking the help file I see it as nicklist there still.
< snip >
You can also specify channel, query, nicklist, and menubar as the menu name, and this will add menuitems to your current popup menus for each of these windows.

menu nicklist {
Slap
.Haddock:/me prods $1 with a haddock
}
< /snip >

Is this a version thing? ( I use 6.16) or maybe an Invision thing? (I don't use a scripted mIRC)
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:20 PM
Ok, maybe it is nicklist. If so, change mine to say nicklist. Though, if he had the menu item with nick and not nicklist, I'm not sure why...

I am not online here, so I can't test with the nick list. And, I'm not using Invision here. smile

Whichever menu way works, use that.
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:24 PM
Oh, and btw... when you fixed your bracket mismatch, I think you put the bracket in the wrong spot. Look at how it's formatted here (the spacing). Compare it to yours and make sure it is exactly the same.

Note that if you're copying/pasting the code and it's going on one line and you're trying to fix it from that, you can instead just click Quote as if you're going to reply to the message with a quote and then just copy everything between the [code[b][/b]] tags and paste that into your remote.
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 04:33 PM
Thanks, Riamus...that way to copy worked. This is looking better except it's echoing the nick and the message in the active window instead of sending a notice. I'm not sure, but I think this is the problem line:

echo -a $left($gettok($did(1),2,32),-1) $did(2)

How do I change that to notice instead of echo. If I send myself a notice saying "hi", it echoes "Blake hi". Thanks.
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 04:39 PM
I fixed it. It was that problem line:

echo -a $left($gettok($did(1),2,32),-1) $did(2)

I tried changing echo -a to notice. I wasn't sure if the fix would be that simple, but it works. Thanks everyone for the help! laugh
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 04:49 PM
lol, I want to get picky and add one more thing, if I can. Can I make the title of the dialog box "Notice PersonsName"? I saw that the script makes a variable called %nnick, so I tried to put that in the title, but it didnt show up. Any ideas?
Posted By: Riamus2 Re: want to create an input box for notices - 13/10/05 04:59 PM
Sorry about that... I was testing it here and forgot to change it back to .notice. I changed it in the post so that anyone else looking at it can use it too.

As for the title:

Stick this into the init section:

dialog -t $dname Notice %nnick

So, the init section will look like:
Code:
on *:dialog:Notice*:init:*: {
  dialog -t $dname Notice %nnick
  did -a $dname 1 Notice %nnick $+ :
  did -ht $dname 3
}
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 05:19 PM
Thanks, that's what I wanted. laugh
Posted By: bwr30060 Re: want to create an input box for notices - 13/10/05 10:00 PM
Hey,

I know I've been posting alot today, lol, but I'd like to add one more thing. I'd like the dialog box to also have the user's $fulladdress beside the nick. I'm not sure how to get a variable to equal the full address of the selected nick and then put it in the title. The line that sets the variable for the selected nick is:

Code:
  Notice: set %nnick $snick($chan,1) | dialog -m $+(Notice.,%nnick) Notice


Thanks for any help.
Posted By: bwr30060 Re: want to create an input box for notices - 14/10/05 01:51 AM
Never mind the question, lol, I figured it out. I used $address instead of $fulladdress. In case anyone wants to see the finished product, here it is.

Code:
dialog Notice {
  title "Notice" 
  size -1 -1 300 40
  option dbu

  text "",1,5 5 100 8
  edit "",2,5 14 190 10,autohs

  button "Hidden",3,210 50 1 1
  button "Close",4,90 27 20 8,ok
}
on *:dialog:Notice*:init:*: {
  dialog -t $dname NOTICE %nnick %adnick
  did -a $dname 1 Notice %nnick $+ :
  did -ht $dname 3
}
on *:dialog:Notice*:sclick:*: {
  if ($did == 3 &amp;&amp; $did(2) != $null) {
    notice $left($gettok($did(1),2,32),-1) $did(2)
    echo -a 4 $left($gettok($did(1),2,32),-1)  $did(2)
    did -r $dname 2
  }
}
menu nicklist {
  -
  Notice: set %nnick $snick($chan,1) | set %adnick $address(%nnick,0) | dialog -m Notice Notice
}
Posted By: Riamus2 Re: want to create an input box for notices - 14/10/05 01:30 PM
Glad you got it working. I wasn't online at the time. smile
© mIRC Discussion Forums