Replacing Popups

Contributed by Nodren
popups.dll Tutorial - Nodren

Introduction...

Before starting, you should look through the documentation on DragonZap’s popups.dll
I write this tutorial with an expectation you are familiar with popups.dll, as I will not go into any big detail as to the use of popups.dll

Starting out...

First, before we start, we will want our own popup alias.

alias _bleh {
;$1 is filled by $submenu
;checks if it’s the begining

if ($1 ==
begin) {
;commands to fill in popups.
popups New bleh 16 16
popups SetStyle bleh bordericon
popups LoadImg bleh icon small $_icons(17)
popups LoadImg bleh icon small $_icons(132)
popups LoadImg bleh icon small $_icons(65)
popups LoadImg bleh icon small $_icons(92)
popups AddItem bleh end + 1 Connection Dialog $cr _medit OpenMenu 104
popups AddItem bleh end +
popups AddItem bleh end + 2 irc.secsup.org $cr server irc.secsup.org 666
popups AddItem bleh end + 2 irc.rt.ru $cr server irc.rt.ru 6662
popups AddItem bleh end + 2 irc.prison.net $cr server irc.prison.net 6667
popups AddItem bleh end +
popups AddItem bleh end + 2 Webchat $cr server -m efnet2
popups AddItem bleh end +
popups AddItem bleh end + 4 disconnect $cr _medit OpenMenu 101
pop bleh $mouse.dx $mouse.dy
}
;checks for the next popup after Begin
if ($1 ==
1) { return }
;checks for the last popup
if ($1 ==
end) { return }
}
;command used to return icons
alias _icons { return $1 $+ , $+ d:\mirc\shell.dll }
;command used to return path for popups.dll
alias pdll return $mircdirpopups.dll
;command used to open the popup after all items were filled
alias pop tokenize 32 $dll($pdll,Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)
;command to fill the popup before opening it
alias popups return $dll($pdll,$1,$2-)

Notice a few key things in here: the three if statements. Allow me to explain why those are important. When using $submenu your identifer is sent parameters about the popups, begin is the first parameter sent, 1 is sent next, if nothing happens when it sends 2, it will send end. This is important because if you do not have those if statements your popups will be called 3 times when you right click once(basicly any click after the right click calls them again and again)

Please make this the only line in your Popups section.(with the exception of the menubar for a menubar title)

$submenu($_bleh($1))

That is what is required to call your alias, when writing your own script the only difference at all in that part should be the alias name(whatever you name it in stead of $_bleh) please note, you must use a identifer style alias in there or else it will not function properly)

Other notes

The $submenu command is a very powerful and effective tool for creating any sort of customized popups or commands not related to a popups dll. Several others have written there own versions of DragonZap’s popups.dll which will all work exactly the same provided you follow the pattern laid out above.

Final Thoughts

This tutorial seems very simple, and the reason I wrote it is to show you all the dynamics of $submenu. Since $submenu itself is a fairly easy command to learn, I felt that having a tutorial about a new way to use $submenu would be beneficial to everyone. So now go out and make those nice looking scripts with customized popups!

Thanks:
DragonZap
: popups.dll

Contact Information:
E-mail: [email protected]
Irc: #polaris @ GameSurge
Irc: #lobby @ Christian-IRC

All content is copyright by mircscripts.org and cannot be used without permission. For more details, click here.