Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 11.92 KB | None | 0 0
  1. ;Shows a link to the script when you right click a status, query or channel window
  2. menu status,query,channel {
  3.   Auto Connect/Join/Identify v3:/showacji
  4. }
  5.  
  6. ;Calls the dialog window initialisation and loads the first server
  7. alias showacji dialog -m acji acji
  8.  
  9. ;Initialises the dialog window
  10. dialog acji {
  11.   title "Auto Connect/Join/Identify v3"
  12.   size -1 -1 355 425
  13.  
  14.   ; type | text                                | id |  x   y   w   h  | style
  15.  
  16.   text     "Change settings for:",                1,   5   8  100  20
  17.   combo                                           2,  110  5  240  20,  drop
  18.  
  19.   text     "Servers address",                     3,   15  30 160  12
  20.   edit     "",                                    4,   15  45 132  20,  autohs
  21.   text     "Server network",                      5,  153  30 160  12
  22.   edit     "",                                    6,  153  45 132  20,  autohs
  23.   check    "Enabled",                            29,  290  40  55  20
  24.  
  25.   text     "Add nickname",                        7,   22  85  70  20
  26.   edit     "",                                    8,   20  99  72  21,  autohs
  27.   text     "Group password",                      9,   99  85  78  20
  28.   edit     "",                                   10,   99  99  76  21,  autohs pass
  29.   button   "Add nickname",                       11,   20 125 155  25
  30.   text     "View/delete existing nicknames",     12,  182  85 150  20
  31.   combo                                          13,  180  99 155  20,  drop
  32.   button   "Delete nickname",                    14,  180 125 155  25
  33.  
  34.   text     "Add channel to this server",         15,   22 180 140  20
  35.   edit     "",                                   16,   20 194 155  21,  autohs
  36.   button   "Add channel",                        17,   20 220 155  25
  37.   text     "View/delete existing channels",      18,  182 180 150  20
  38.   combo                                          19,  180 194 155  20,  drop
  39.   button   "Delete channel",                     20,  180 220 155  25
  40.  
  41.   button   "Add/Save server",                    21,   20 275 100  25
  42.   button   "Delete server",                      22,  125 275 100  25
  43.   button   "Close manager",                      23,  230 275 100  25,  cancel
  44.  
  45.   box      "",                                   24,   5   22 345 245
  46.   box      "Grouped nicknames",                  25,   15  70 325  90
  47.   box      "Channels",                           26,   15 165 325  90
  48.   box      "Hover over buttons/boxes for help.", 27,   5  305 345 110
  49.   text     "",                                   28,   10 318 325  92,  multi
  50.   ; type | text                                | id |  x   y   w   h  | style
  51. }
  52.  
  53. ;On initialisation, display default help text and load first tab
  54. on 1:dialog:acji:init:*: acji.loadgui $iif($gettok($rs(0, Order), 1, 46) != $null, $ifmatch, 1)
  55.  
  56. ;loads the gui with the information for the requested server (called with $1 being server number in acjiSettings.ini)
  57. alias -l acji.loadgui {
  58.   acji.resetgui
  59.  
  60.   set %n 1
  61.   while (%n <= $rs(0,Servers)) {
  62.     did -a acji 2 $+(%n, :) $rs($gettok($rs(0, Order), %n, 46), Server)
  63.     inc %n
  64.   }
  65.   did -a acji 2 Add a new server
  66.   did -c acji 2 $iif($findtok($rs(0, Order), $1, 46) != $null, $ifmatch, $did(2).lines)
  67.  
  68.  
  69.   ;If no servers are set up, or if "Add a new server" is selected, disable some entry fields and rename buttons.
  70.   if $did(2).sel == $did(2).lines {
  71.     did -b acji 8,10,11,13,14,16,17,19,20,22,29
  72.     did -ra acji 21 Add Server
  73.   }
  74.   ;Enable them otherwise
  75.   else {
  76.     did -e acji 8,10,11,13,14,16,17,19,20,22,29
  77.     did -ra acji 21 Save Server
  78.   }
  79.  
  80.  
  81.   did -a acji 4 $rs($1, Server)
  82.   did -a acji 6 $rs($1, Network)
  83.   did $iif($rs($1, Enabled) == 1, -c, -u) acji 29
  84.  
  85.   set %n 1
  86.   while (%n <= $rs($1,Nicks)) {
  87.     did -a acji 13 $rs($1, Nick $+ %n)
  88.     inc %n
  89.   }
  90.   did -a acji 10 $rs($1, Password)
  91.  
  92.   set %n 1
  93.   while (%n <= $rs($1,Channels)) {
  94.     did -a acji 19 $rs($1, Channel $+ %n)
  95.     inc %n
  96.   }
  97.  
  98.   unset %n
  99. }
  100.  
  101. alias -l acji.resetgui {
  102.   did -r acji 2,4,6,8,10,13,16,19
  103.   did -u acji 29
  104. }
  105.  
  106. ;Listens for clicks on the gui
  107. on 1:dialog:acji:sclick:*: {
  108.   if ($did(2).sel != $did(2).lines) {
  109.     set %sID $gettok($rs(0, Order), $did(2).sel, 46)
  110.   }
  111.   else set %sID $did(2).lines
  112.  
  113.   ;If combo box changed, update gui with details of the correct server
  114.   if ($did == 2) {
  115.     acji.loadgui %sID
  116.   }
  117.  
  118.   ;If the save button is clicked, save all information into the acjiSettings.ini file
  119.   if ($did == 21) {
  120.     ;If the last line of combo box is selected, add a new server
  121.     if ($did(2).sel == $did(2).lines) {
  122.       set %servers $calc($rs(0,Servers) + 1)
  123.       $wsdata(0, Servers, %servers)
  124.  
  125.       ;Determine next free token, then save the settings into the correct server position
  126.       set %n 1
  127.       while (%n <= %servers) {
  128.         if (!$istok($rs(0,Order,46), %n, 46)) {
  129.           $wsdata(0, Order, $addtok($rs(0,Order,46), %n, 46)))
  130.         }
  131.         inc %n
  132.       }
  133.       unset %n
  134.       $ws(%sID, Server, 4)
  135.       $ws(%sID, Network, 6)
  136.     }
  137.  
  138.     if ($did(10).text != $null) { $ws(%sID, Password, 10) }
  139.     else { $rms(%sID, Password) }
  140.     $wsdata(%sID, Enabled, $did(29).state)
  141.     acji.loadgui %sID
  142.   }
  143.  
  144.   ;If the add nick button is pressed, add a nick to the current server (and save password if entered)
  145.   if ($did == 11) {
  146.     if ($did($dname, 8).text != $null) {
  147.       $wsdata(%sID, Nicks, $calc($rs(%sID, Nicks) + 1))
  148.       $ws(%sID, Nick $+ $rs(%sID, Nicks), 8)
  149.       did -r acji 8
  150.       if ($did(10).text != $null) { $ws(%sID, Password, 10) }
  151.       else { $rms(%sID, Password) }
  152.       acji.loadgui %sID
  153.     }
  154.   }
  155.  
  156.   ;If the add channel button is pressed, add a channel to the current server
  157.   if ($did == 17) {
  158.     if ($did($dname, 16).text != $null) {
  159.       $wsdata(%sID, Channels, $calc($rs(%sID, Channels) + 1))
  160.       $ws(%sID, Channel $+ $rs(%sID, Channels), 16)
  161.       did -r acji 16
  162.       acji.loadgui %sID
  163.     }
  164.   }
  165.  
  166.   ;If the delete nickname button is pressed, delete the current nickname and move all those after it up a spot
  167.   if ($did == 14) {
  168.     if ($did(13).sel != $null) {
  169.       set %nicks $rs(%sID, Nicks)
  170.       set %n $did(13).sel
  171.       $rms(%sID, Nick $+ %n)
  172.       dec %nicks
  173.       set %s %n
  174.       while (%n <= %nicks) {
  175.         inc %s
  176.         $wsdata(%sID, Nick $+ %n, $rs(%sID, Nick $+ %s))
  177.         inc %n
  178.       }
  179.       $rms(%sID, Nick $+ %n)
  180.       $wsdata(%sID, Nicks, %nicks)
  181.       unset %s | unset %n | unset %nicks
  182.     }
  183.     acji.loadgui %sID
  184.   }
  185.  
  186.   ;If the delete channel button is pressed, delete the current channel and move all those after it up a spot
  187.   if ($did == 20) {
  188.     if ($did(19).sel != $null) {
  189.       set %channels $rs(%sID, Channels)
  190.       set %n $did(19).sel
  191.       $rms(%sID, Channel $+ %n)
  192.       dec %channels
  193.       set %s %n
  194.       while (%n <= %channels) {
  195.         inc %s
  196.         $wsdata(%sID, Channel $+ %n, $rs(%sID, Channel $+ %s))
  197.         inc %n
  198.       }
  199.       $rms(%sID, Channel $+ %n)
  200.       $wsdata(%sID, Channels, %channels)
  201.       unset %s | unset %n | unset %channels
  202.  
  203.     }
  204.     acji.loadgui %sID
  205.   }
  206.  
  207.   ;If the delete server button is pressed, delete the current server's token from the "Order" field
  208.   if ($did == 22) {
  209.     ;Remove the entire section
  210.     $rms(%sID,)
  211.     ;Remove the servers token from the Order field
  212.     $iif($deltok($rs(0, Order), $did(2).sel, 46) != $null, $wsdata(0, Order, $ifmatch), $rms(0,Order))
  213.     $wsdata(0, Servers, $calc($rs(0, Servers) - 1))
  214.     acji.loadgui $gettok($rs(0, Order), 1, 46)
  215.   }
  216.   unset %sID
  217. }
  218.  
  219. ;When mIRC starts, connect to each of the servers in the Settings.ini file with the primary nick supplied, if there is one.
  220. on *:Start: {
  221.   set %n 1
  222.   while (%n <= $rs(0, Servers)) {
  223.     if ($rs($gettok($rs(0, Order),%n,46), Enabled) == 1) {
  224.       server $iif(%n == 1,,-m) $rs($gettok($rs(0, Order),%n,46), Server) -i $rs(%n, Nick1),)
  225.       inc %n
  226.     }
  227.     else inc %n
  228.   }
  229.   unset %n
  230. }
  231.  
  232. ;When you connect to a server, check that it's one in the Settings.ini file and then connect to the supplied channels
  233. on *:Connect: {
  234.   set %n 1
  235.   while (%n <= $rs(0, Servers)) {
  236.     if ($rs(%n, Network) == $network) {
  237.       set %c 1
  238.       while (%c <= $rs(%n, Channels)) {
  239.         join $rs(%n, Channel $+ %c)
  240.         inc %c
  241.       }
  242.       unset %c
  243.       if ($rs(%n, Password) != $null) nickserv identify $rs(%n, Password)
  244.     }
  245.     inc %n
  246.   }
  247.   unset %n
  248. }
  249.  
  250. ;When nickserv asks to identify, do so with the supplied password from the acjiSettings.ini file
  251. on *:notice:*nickname is regsitered and protected*:?: {
  252.   if ($nick == nickserv) {
  253.     set %n 1
  254.     while (%n <= $rs(0, Servers)) {
  255.       if ($rs(%n, Network) == $network) {
  256.         nickserv identify $rs(%n, Password)
  257.       }
  258.       inc %n
  259.     }
  260.     unset %n
  261.   }
  262. }
  263.  
  264. ;If the nickname is currently being used, attempt to connect with the first free nickname saved for the server
  265. ;-- $2 is the current nickname, find it in tokens and try the next one.
  266. raw 433:*:{
  267.   set %n 1
  268.   while (%n <= $rs(0, Servers)) {
  269.     if ($rs(%n, Server) == $server) {
  270.       set %c 1
  271.       while (%c <= $rs(%n, Nicks)) {
  272.         $iif($rs(%n, Nick $+ %c) != $2, nick $ifmatch,)
  273.         inc %c
  274.       }
  275.     }
  276.     inc %n
  277.   }
  278.   unset %c
  279.   unset %n
  280. }
  281.  
  282. ;When hovering over any of the edit boxes or buttons, the help label will display help information for that element
  283. on 1:dialog:acji:mouse:*: {
  284.   if     ($did == 2)  { did -ra $dname 28 Select the server you wish to change details for. If empty, proceed to add a server by filling out the form below. }
  285.   elseif ($did == 4)  { did -ra $dname 28 Enter the server address here. e.g. irc.gamesurge.net If you wish to connect to a server with a non-default port, simply add a colon and a port number after the server. e.g. irc.gamesurge.net:6667 }
  286.   elseif ($did == 6)  { did -ra $dname 28 Enter the servers network here. $crlf $+ Find this out by typing '//echo -a $+($,network') whilst connected the the server. e.g. GameSurge }
  287.   elseif ($did == 8)  || ($did == 11) { did -ra $dname 28 Enter a nickname and then click the Add button to add that nickname to this servers autoidentify list. }
  288.   elseif ($did == 10) { did -ra $dname 28 Enter the password to the group of nicknames set for this server. You Will automatically identify when nickserv asks for the password. }
  289.   elseif ($did == 13) || ($did == 14) { did -ra $dname 28 Use the dropdown menu to view the nicknames set to automatically attempt to connect with. If you wish to delete one, pick it from the list then click the Delete button. }
  290.   elseif ($did == 16) || ($did == 17) { did -ra $dname 28 Enter a channel name and then click the Add button to add that channel to this servers autojoin list. If the channel has a password, enter it after the channel. $crlf e.g. #channel password }
  291.   elseif ($did == 19) || ($did == 20) { did -ra $dname 28 Use the dropdown menu to view the channels set to automatically join when this server starts. If you wish to delete one, pick it from the list then click the Delete button. }
  292.   elseif ($did == 21) { did -ra $dname 28 By clicking this button all the info in the edit boxes will be saved for this server. }
  293.   elseif ($did == 22) { did -ra $dname 28 By clicking this button all changes will be lost. Be sure to click the Set button is you want to save this configuration. }
  294. }
  295.  
  296. ;called by $rs(server number, item) - if server number is 0, then general settings are stored.
  297. alias -l rs return $readini(acjiSettings.ini, Server $+ $1, $2)
  298.  
  299. ;called by $wsdata(server number, data name, data)
  300. alias -l wsdata writeini acjiSettings.ini Server $+ $1 $2 $3
  301.  
  302. ;called by $ws(server number, data name, dialog item id to read from)
  303. alias -l ws writeini acjiSettings.ini Server $+ $1 $2 $did($3).text
  304.  
  305. ;called by $rms(server number, item)
  306. alias -l rms remini acjiSettings.ini Server $+ $1 $2
  307.  
  308. or Download
  309. Pasted
  310. 2 hours ago
  311.  
  312. Embed
  313.  
  314.  
  315. paste again
  316.  
  317. Sponsored and hosted by:
  318.  
  319. Advertising from RubyRow:
  320. RPM: Harness the power of RPM Lite. Always free. Get started today!
  321.  
  322. Ads from Ruby Row
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement