Downloads containing jj2.mrc

Downloads
Name Author Game Mode Rating
JJ2 add-on *v3.5*Featured Download CaTaPhRaCt Utility 9.2 Download file

File preview

  1. ;------------------
  2. ;--- JJ2 add-on ---     v3.5 [10-10-03]
  3. ;------------------
  4. ;
  5. ;IMPORTANT NOTE: mIRC 5.91 Script Editor does not support files above 64KB. So,
  6. ;  if you have that version of mIRC and you try to save an alteration to this
  7. ;  script, all the data beyond 64KB will be lost. To avoid damage to the add-on,
  8. ;  press cancel now and choose not to save the changes.
  9.  
  10. ;Author: Cataphract
  11. ;Email:  Cataphract@netcabo.pt
  12.  
  13. alias -l s.version return 3.5
  14. alias -l s.data return 10-10-03
  15.  
  16. on *:load: {
  17.   if ($exists($scriptdirregistry.dll) == $false) || ($exists($scriptdirmdx.dll) == $false) || ($exists($scriptdirviews.mdx) == $false) { echo -a *** Files missing. Please make sure 'registry.dll', 'mdx.dll' and 'views.mdx' are in $scriptdir.  | .timer 1 1 /unload -rs $qte($script) }
  18.   if ($version < 5.91) { echo -a *** This script requires, at least, mIRC 5.91. Download it from www.mirc.co.uk | unload -rs $qte($script) }
  19.   if ($version == 5.91) { echo -a *** Tooltips.dll is not compatible with mIRC 5.91. Therefore, this option has been disabled by default and hidden. If you update your mIRC, you may manually activate this option. | set %jj2.toolt 1 }
  20.   if ($lock(dll)) || ($lock(run)) { echo -a *** /dll and/or /run are locked. Go to 'mIRC Options' (alt+o) > General > Lock to unlock them and then load this script once more | unload -rs $qte($script) }
  21.   echo -a *** JJ2 add-on v $+ $s.version $s.data $+ . Use the Status, Channel or Query Popups to select the jazz2.exe's locations.
  22.   if (!$isfile($scriptdircrosscuts.ini)) resetcc
  23.   echo -a *** If you don't like the shortcuts, use the popups to hide them by default. You can also costumise them there.
  24.   echo -a *** Please visit http://www.aleger.tk for more information, including help.
  25.   if (!%listserver) %listserver = jazz.contrabandent.com | if (!%unse) %unse = sher | if (!%jj2.cfu) %jj2.cfu = on
  26.   if (!$isdir($scripdirsaves)) mkdir $qte($scriptdirsaves) | if (!$isdir($scripdircache)) mkdir $qte($scriptdircache)
  27.   if (%jj2.colorctf == $null) %jj2.colorctf = 1
  28.   unset %jj2.runtimes
  29.   run $qte($scriptdirreadme.txt)
  30. }
  31. alias inst1.23 if (%path.121) && (%path.121 != none) return $true | return $false
  32. alias inst1.24 if (%path.124) && (%path.124 != none) return $true | return $false
  33. alias inst1.24x if (%path.124x) && (%path.124x != none) return $true | return $false
  34.  
  35. alias -l resetcc {
  36.   if (!$isfile($scriptdircc-default.ini)) { echo -s *** 'cc-default.ini' is missing. | return }
  37.   copy -o $qte($scriptdircc-default.ini) $qte($scriptdircrosscuts.ini)
  38. }
  39. alias vernum {
  40.   if ($1 !isnum) return $false
  41.   elseif ($1 < 1) return $false
  42.   elseif ($int($1) != $1) return $false
  43.   if ($2 != $null) && ($1 < $2) return $false
  44.   if ($3 != $null) && ($1 > $3) return $false
  45.   else return $true
  46. }
  47. dialog unk {
  48.   title "Select Server Version"
  49.   icon %iconsl
  50.   size -1 -1 100 70
  51.   option dbu
  52.  
  53.   text "The Game Server did not send its version to the List Server. Therefore, this add-on cannot determine which .exe it should load. However, you can try to guess its version. If you get a 'Version of  Server is different' error, try the other one.",4,3 3 95 50
  54.  
  55.   button "1.23",2,5 55 20 12
  56.   button "1.24",3,29 55 20 12
  57.   button "Cancel",1,70 55 25 12,cancel
  58. }
  59. on *:dialog:unk:*:*: {
  60.   if ($devent == init) {  if (!$inst1.23) { did -b $dname 2 }
  61.   if (!$inst1.24) { did -b $dname 3 } }
  62.   elseif ($devent != sclick) return
  63.   if ($did == 2) { run %path.121 -connect $tab($did(server_list,1).seltext,6) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record) }
  64.   elseif ($did == 3) { run %path.124 -connect $tab($did(server_list,1).seltext,6) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record) }
  65. }
  66. dialog colorg {
  67.   title "Color Guide"
  68.   icon %iconsl
  69.   size -1 -1 270 200
  70.   option dbu
  71.   text "By Lïñk",3,241 3 45 9,disable
  72.   box "Color Guide",4,3 11 263 169
  73.   edit "",1,7 20 255 156,read vsbar multi
  74.   button "Close",2,116 184 30 11,cancel
  75. }
  76. dialog extfact {
  77.   title "Extension Factor"
  78.   size -1 -1 154 94
  79.   icon %iconsl
  80.   option dbu
  81.   list 1, 6 4 143 16, size
  82.   text "Extended (1-47)", 21, 9 30 38 7
  83.   text "Default (48)", 22, 9 43 38 6
  84.   text "Shrunk (49-58)", 23, 9 56 38 6
  85.   text "Size Zero (59)", 24, 9 69 38 6
  86.   text "Reversed (60+)", 25, 9 82 38 6
  87.   icon 8, 58 29 48 8,ext1.JPG
  88.   icon 9, 58 42 48 8,ext2.JPG
  89.   icon 10, 58 55 48 8,ext3.JPG
  90.   icon 11, 58 68 48 8,ext4.JPG
  91.   icon 12, 58 81 48 8,ext5.JPG
  92.   text "Curent E. F.", 13, 112 28 38 8, center
  93.   edit "", 14, 121 38 18 9,autohs result center
  94.   button "Cancel", 2, 117 74 29 13, cancel
  95.   button "OK", 15, 117 57 29 13,ok
  96. }
  97. dialog listss {
  98.   title "List Server Statistics"
  99.   size -1 -1 180 204
  100.   option dbu
  101.   text "", 1, 2 4 158 8
  102.   edit "", 2, 2 16 174 168, read multi return vsbar
  103.   button "Close", 3, 2 188 174 12,cancel default
  104. }
  105. on *:dialog:colorg:init:*: { loadbuf -o colorg 1 $qte($scriptdircolorg.txt) }
  106. dialog browse {
  107.   title "Select Level"
  108.   size -1 -1 144 204
  109.   option dbu
  110.   icon %iconsl, 0
  111.   box "Your Levels", 3, 4 4 136 146
  112.   list 1, 10 14 124 132, extsel
  113.   button "", 5, 40 188 34 12
  114.   button "Select!", 2, 4 188 28 12, disable default
  115.   button "Cancel", 4, 110 188 30 12, cancel
  116.   box "Filter", 6, 4 153 136 28
  117.   edit "", 7, 34 161 48 10, autohs
  118.   text "Keyword:", 8, 10 161 20 8
  119.   radio "Filename", 11, 94 161 36 6
  120.   radio "Level Name", 12, 94 171 40 6
  121.   button "Delete", 9, 74 188 28 12, disable
  122.   text "[ You may use wildcards (*,?) ]", 10, 10 172 74 6
  123. }
  124.  
  125. alias -l seldir { return $left($rep(1 $+ $chr(32),null,$did(server_list,1032).state ~ [ %path.121 ] ,$did(server_list,1033).state ~ [ %path.124 ] ),$pos($rep(1 $+ $chr(32),null,$did(server_list,1032).state ~ [ %path.121 ] ,$did(server_list,1033).state ~ [ %path.124 ] ),\,$count($rep(1 $+ $chr(32),null,$did(server_list,1032).state ~ [ %path.121 ] ,$did(server_list,1033).state ~ [ %path.124 ] ),\))) }
  126. alias -l remcolsp { var %s = $remove($1,|),%r = 0
  127.   ;removal of the numbers immediately after the §'s
  128.   while (%r < $count(%s)) { inc %r
  129.     %s = $mid(%s,1,$pos(%s,§,%r)) $+ $right(%s,$calc($len(%s) - $pos(%s,§,%r) -1))
  130.   }
  131.   return $remove(%s)
  132. }
  133. on *:dialog:browse:*:*: {
  134.   if ($devent == init) { mdx.start | loadtooltips $dname
  135.     set %a $mdx(SetControlMDX,1 listview rowselect single flatsb showsel report nosortheader > [ $mdx.vdll ] )
  136.     did -i $dname 1 1 headerdims 85:1 161:2
  137.     did -i $dname 1 1 headertext $+(File Name,$tab,Level Name)
  138.     did -c $dname 11
  139.     did -a browse 5 Copy to 1.2 $+ $vsel
  140.     if (!%path.12 [ $+ [ $vsel(1) ] ]) || (%path.12 [ $+ [ $vsel(1) ] ] == none) { did -b $dname 5 }
  141.     if (!%jj2.buildls) || (!$hget(jj2. $+ $ver.sel)) buildl $ver.sel
  142.     displist $ver.sel 1 *
  143.   }
  144.   did $iif($did(1).sel,-e,-b) $dname 2,5,9
  145.   if ($devent == edit) || ($did isnum 11-12) { displist $ver.sel $iif($did(11).state,1,2) $iif($remove($did(7),?,*) == $did(7),$+(*,$did(7),*),$did(7)) }
  146.   elseif ($devent == sclick) {
  147.     if ($did == 2) { did -ra server_list 1019 $tab($did(browse,1).seltext,1) | dialog -c browse }
  148.     elseif ($did == 5) { if (!$did(1).seltext) { set %a $input(Select a file first,516,JJ2 add-on error) | halt }
  149.       if (!$exists($otherdir $+ $tab($did(1).seltext,1))) goto other | set %a $?!="Overwrite? $crlf $crlf Selected file: $crlf $fpropers($asel $+ $tab($did(browse,1).seltext,1)) $crlf $crlf Other file: $crlf $fpropers($otherdir $+ $tab($did(browse,1).seltext,1)) $crlf " | if (%a == $false) halt
  150.       :other | copy -o $qte($asel $+ $tab($did(1).seltext,1)) $qte($otherdir)
  151.     }
  152.     elseif (($mouse.key & 4) && ($did(1).seltext)) || ($did == 9) { set %a $?!="Are you sure you want to delete ' $+ $asel $+ $tab($did(1).seltext,1) $+ ' ?" | if (%a == $true) { remove $qte($asel $+ $tab($did(1).seltext,1)) | did -d $dname 1 $did(1).sel } }
  153.   }
  154. }
  155. alias -l buildl { set -u1 %htn jj2. $+ $1 | var %dir = $nofile( [ %path.12 [ $+ [ $replace($right($1,1),3,1) ] ] ] )
  156.   ;/ (1.23/1.24)
  157.   %jj2.curr = 0 | if ($hget(%htn)) hfree %htn | set %a $findfile(%dir,*.j2l,0,1,sf $1-)
  158. }
  159. alias -l sf {
  160.   bread $qte($1-) 188 32 &temp | inc %jj2.curr
  161.   hadd -m %htn %jj2.curr $nopath($1-) $+ + $+ $remcolsp($bvar(&temp,1,32).text)
  162. }
  163. alias displist { if (!$dialog(browse)) halt
  164.   ;/ version (1-file,2-desc) mask
  165.   did -r browse 1 | var %r = 0,%htn = jj2. $+ $1
  166.   while (%r < $hget(%htn,0).item) { inc %r
  167.     if (($3- iswm $gettok($hget(%htn,%r),1,43)) && ($2 == 1)) || (($3- iswm $gettok($hget(%htn,%r),2-,43)) && ($2 == 2))  did -a browse 1 $gettok($hget(%htn,%r),1,43) $tab $gettok($hget(%htn,%r),2,43)
  168.   }
  169. }
  170.  
  171. alias -l qte return " $+ $1- $+ "
  172. alias fpropers { return File size: $sdisplay($file($$1).size) $crlf Created: $iif($file($$1).ctime != -1,$asctime($file($$1).ctime),no info) $crlf Modified: $iif($file($$1).mtime != -1,$asctime($file($$1).mtime),no info) }
  173. alias -l asel return $rep(1 $+ $chr(32),null,$did(server_list,1032).state ~ $nofile(%path.121),$did(server_list,1033).state ~ $nofile(%path.124))
  174. alias -l vsel return $rep(1 $+ $chr(32),null,$did(server_list,1032).state ~4,$did(server_list,1033).state ~ $+ $iif($1 == $null,3,1))
  175. alias ver.sel return $iif($did(server_list,1032).state,1.23,$iif($did(server_list,1033).state,1.24))
  176. alias -l otherdir return $nofile(%path.12 [ $+ [ $vsel(1) ] ])
  177. dialog enter_ip {
  178.   title "Join Game by IP"
  179.   size -1 -1 100 94
  180.   option dbu
  181.   icon %iconsl, 0
  182.   box "IP number", 848, 6 2 89 24
  183.   edit "", 849, 26 11 50 10, autohs center
  184.   radio "1.23", 821, 10 37 22 8,group
  185.   radio "1.24", 822, 39 37 22 8
  186.   radio "1.24 x", 823, 68 37 22 8
  187.   text "No erros until now.", 840, 9 61 81 7, center
  188.   button "Join Server!", 850, 6 79 43 10, default
  189.   button "Cancel", 851, 52 79 42 10, ok
  190.   box "Version", 1, 6 27 89 23
  191.   box "Errors", 2, 6 52 88 21
  192. }
  193. dialog jcspal {
  194.   title "Pallete"
  195.   icon %iconsl
  196.   size 1 1 198 80
  197.   option dbu
  198.  
  199.   icon 1198,5 5 374 109,pallete.jpg,noborder,left,top
  200.  
  201.   button "Done",1199,80 65 22 11,cancel
  202. }
  203. dialog redpro {
  204.   title "Reduce profile"
  205.   size -1 -1 95 30
  206.   option dbu
  207.   button "1.23", 1, 5 18 20 8
  208.   button "1.24", 2, 28 18 20 8
  209.   button "Cancel", 3,65 17 26 10, cancel
  210.   text "Reduce profile to which version?", 4, 5 4 90 8
  211. }
  212. dialog sl {
  213.   title Jazz2 Add-on for mIRC v $+ $s.version $+($chr(91),$s.data,$chr(93))
  214.   size -1 -1 $iif($crcuR(status),288,240) 162
  215.   option dbu
  216.   icon %iconsl, 0
  217.  
  218.   tab "Join", 11, 2 0 236 158
  219.   text "Inactive", 901, 4 20 144 10, tab 11
  220.   check "REC", 2001, 156 20 14 10, tab 11 push
  221.   button "R", 2000, 173 20 8 10, tab 11
  222.   check "B", 3, 195 20 8 10, tab 11 push
  223.   button "i", 999, 184 20 8 10, tab 11
  224.   button "IP", 802, 207 20 16 10, tab 11
  225.   box "Active Games", 900, 4 30 230 108, tab 11
  226.   list 1, 9 38 220 104, tab 11 extsel
  227.   text "No errors to report", 500, 5 143 150 14, tab 11
  228.   button "Join Server!", 600, 164 144 34 10, tab 11 default
  229.   button "Close", 700, 204 144 30 10, tab 11 ok
  230.   button $mostrarsetaparaklado, 1510, 227 22 6 6, tab 11
  231.   tab "Serve", 12
  232.   box "Server Config.", 1001, 4 19 230 94, tab 12
  233.   radio "Battle", 1011, 10 28 42 10, group tab 12
  234.   radio "CTF", 1012, 58 28 42 10, tab 12
  235.   radio "Treasure", 1013, 102 28 42 10, tab 12
  236.   radio "Co-op", 1014, 154 28 42 10, tab 12
  237.   radio "Race", 1015, 204 28 22 10, tab 12
  238.   text "Server Name:", 1016, 10 44 44 8, tab 12
  239.   edit "", 1017, 60 42 68 10, tab 12
  240.   text "Level File:", 1018, 10 58 34 8, tab 12
  241.   edit "", 1019, 60 56 68 10, tab 12 autohs
  242.   button "Browse", 1020, 130 56 26 10, tab 12
  243.   text "Score to Win:", 1021, 10 72 40 8, tab 12
  244.   edit "", 1022, 60 70 14 10, tab 12
  245.   text "Players Limit:", 1023, 10 86 40 8, tab 12
  246.   edit "", 1024, 60 84 14 10, tab 12 limit 2
  247.   text "Difficulty Level:", 1025, 10 100 40 8, tab 12
  248.   combo 1026, 60 98 40 40, tab 12 drop
  249.   radio "1.23", 1032, 184 60 20 10, group tab 12
  250.   radio "1.24", 1033, 184 74 20 10, tab 12
  251.   box "Server Listing", 1029, 4 118 186 38, tab 12
  252.   text "Status:", 1030, 8 134 40 8, tab 12
  253.   edit "", 1031, 30 132 110 10, tab 12 read
  254.   button "List Server", 1034, 144 132 40 12, tab 12
  255.   text "No Errors To Report", 1035, 114 100 80 8, tab 12
  256.   button "Start Server", 1027, 194 122 40 14, tab 12 default
  257.   button "Close", 1028, 194 142 40 10, tab 12 cancel
  258.   button $mostrarsetaparaklado, 1511, 225 14 6 6, tab 12
  259.   tab "Player 1", 13
  260.   box "Profiles", 2003, 162 16 71 140, tab 13
  261.   list 2004, 166 24 62 76, tab 13 extsel
  262.   button "Load", 2005, 166 100 34 10, tab 13
  263.   button "Save...", 2008, 202 112 26 10, tab 13
  264.   button "Load...", 2006, 202 100 26 10, tab 13
  265.   button "Save", 2007, 166 112 34 10, tab 13
  266.   button "Del", 2009, 166 126 14 8, tab 13
  267.   button "Ren", 2010, 182 126 14 8, tab 13
  268.   button "Dupl", 2014, 198 126 14 8, tab 13
  269.   button "Red", 2015, 214 126 14 8, tab 13
  270.   button "Change Default Directory", 2016, 166 136 62 8, tab 13
  271.   box "Player One Name", 2017, 6 16 150 32, tab 13
  272.   edit "", 2018, 10 24 58 10, tab 13 limit 14 center
  273.   icon 2019, 29 37 94 8, colorl.jpg, 0, tab 13
  274.   button "No Colon", 2020, 72 24 26 8, tab 13
  275.   button "Ext Factor", 2021, 99 24 26 8, tab 13
  276.   button "New Color", 2022, 126 24 26 8, tab 13
  277.   text "No errors so far", 2027, 82 58 73 12, tab 13
  278.   box "Errors", 2026, 78 50 78 24, tab 13
  279.   box "Version", 2023, 6 50 66 24, tab 13
  280.   radio "1.23", 2024, 10 60 22 8, group tab 13
  281.   radio "1.24", 2025, 48 60 22 8, tab 13
  282.   radio "Spaz", 2029, 10 84 22 8, group tab 13
  283.   radio "Jazz", 2030, 34 84 20 8, tab 13
  284.   radio "Lori", 2031, 61 84 20 8, tab 13
  285.   box "Character", 2028, 6 74 79 22, tab 13
  286.   box "Fur Colors", 2032, 6 98 150 32, tab 13
  287.   edit "", 2111, 50 105 14 10, tab 13 center
  288.   edit "", 2112, 134 105 14 10, tab 13 center
  289.   edit "", 2113, 50 118 14 10, tab 13 center
  290.   edit "", 2114, 134 118 14 10, tab 13 center
  291.   text "#1", 2101, 10 107 38 8, tab 13 center
  292.   text "#2", 2102, 92 107 38 8, tab 13 center
  293.   text "#3", 2103, 10 119 38 8, tab 13 center
  294.   text "#4", 2104, 92 119 38 8, tab 13 center
  295.   button "R-95", 2041, 69 106 16 7, tab 13
  296.   button "R-255", 2042, 69 118 16 7, tab 13
  297.   box "Base", 2043, 6 132 90 22, tab 13
  298.   radio "DEC (JazzED)", 2044, 8 142 41 7, group tab 13
  299.   radio "HEX (Regedit)", 2045, 52 142 42 7, tab 13
  300.   button "Save Definitions", 2046, 100 135 56 10, tab 13
  301.   button "Close", 2048, 130 147 26 7, tab 13
  302.   button "Revert", 2047, 100 147 28 7, tab 13
  303.   check "Save defs on loading", 2049, 166 147 62 7, tab 13
  304.   box "", 2050, 88 74 68 22, tab 13
  305.   button "Copy to ", 2051, 92 80 33 13, tab 13
  306.   button "Pallete", 2052, 128 80 24 6, tab 13
  307.   button "Cl. Guide", 2053, 128 87 24 6, tab 13
  308.  
  309.  
  310.   button $crcu(1), 1501, 245 19 36 8
  311.   button $crcu(2), 1502, 245 35 36 8
  312.   button $crcu(3), 1503, 245 51 36 8
  313.   button $crcu(4), 1504, 245 67 36 8
  314.   button $crcu(5), 1505, 245 83 36 8
  315.   button $crcu(6), 1506, 245 99 36 8
  316.   button $crcu(7), 1507, 245 115 36 8
  317.   button $crcu(8), 1508, 245 131 36 8
  318.   button $crcu(9), 1509, 245 147 36 8
  319.   box "Shortcuts", 2, 242 9 42 151
  320. }
  321. alias -l mostrarsetaparaklado return $iif($crcuR(status),<,>)
  322. alias -l inidir { if (!%jj2.inidir) return $scriptdirsaves | return %jj2.inidir }
  323. on *:dialog:redpro:*:*: {
  324.   if ($devent == sclick) {
  325.     if ($did == 1) %jj2.tver = 1.24
  326.     elseif ($did == 2) %jj2.tver = 1.23
  327.     elseif ($did == 3) %jj2.tver = cancel
  328.     if ($did) { dialog -x $dname | dialog -v server_list }
  329.   }
  330. }
  331. alias -l ttdll return $qte($scriptdirtooltip.dll)
  332. alias -l ttmark .echo -q $dll($ttdll,Mark,$dialog($1).hwnd)
  333. alias -l ttadd { var %s
  334.   ;icon 0 no icon, 1 ! icon, 2 warning icon, 3 error icon
  335.   if ($1 == help) return $ $+ ttadd(dialog,id,icon,title,text,[largura],[textcolor],[backgroundcolor])
  336.   %s = $gettok($dll($ttdll,ToolTip,$dialog($1).hwnd > $2),1,32)
  337.   %s = %s $gettok($dll($ttdll,SetTitle,$dialog($1).hwnd > $2 $3 $4),1,32)
  338.   %s = %s $gettok($dll($ttdll,SetText,$dialog($1).hwnd > $2 $5),1,32)
  339.   %s = %s $gettok($dll($ttdll,SetWidth,$dialog($1).hwnd > $2 $6),1,32)
  340.   ;cores em RGB
  341.   if ($7) %s = %s $gettok($dll($ttdll,SetTxtColor,$dialog($1).hwnd > $2 $7),1,32)
  342.   if ($8) %s = %s $gettok($dll($ttdll,SetBkgColor,$dialog($1).hwnd > $2 $8),1,32)
  343.   return $iif($istok(%s,error,32),error,ok)
  344. }
  345. alias -l ttini return $qte($scriptdirtooltips.ini)
  346. alias loadtooltips { if (!$isfile($ttini)) || (!$isfile($scriptdirtooltip.dll)) || (%jj2.toolt) return
  347.   ttmark $1 | var %r = 0,%1 = $1
  348.   while (%r < $ini($ttini,%1,0)) { inc %r | tokenize 44 $readini($ttini,%1,$ini($ttini,%1,%r))
  349.     .echo -q $ttadd(%1,$ini($ttini,%1,%r),$1,$2,$replace($3,;,$chr(44)),$4)
  350.   }
  351. }
  352. on *:dialog:server_list:*:*: {
  353.   ;Independentes da cadeia
  354.  
  355.   ;if ($devent != mouse) echo -s $devent $did
  356.   ;Activar/desactivar 'Load', 'Save', 'del.', 'ren', etc.
  357.   did $iif($did(2004).sel,-e,-b) $dname 2005,2007,2009,2010
  358.   if ($tab($did(2004).seltext,2) == 1.23) || ($tab($did(2004).seltext,2) == 1.24) did -b $dname 2015
  359.   else did $iif($did(2004).sel,-e,-b) $dname 2015
  360.   if ($tab($did(2004).seltext,2) == Both) did -b $dname 2014
  361.   else did $iif($did(2004).sel,-e,-b) $dname 2014
  362.  
  363.   ;Muda qq cousa, activa o revert e o Save
  364.   if (($devent == edit) && (($did isnum 2111-2114) || ($did == 2018))) || (($devent == sclick) && (($did isnum 2029-2031) || ($did isnum 2041-2042) || ($did isnum 2020-2022))) did -e $dname 2047,2046
  365.  
  366.   ;Clica no nome do boneco, muda a desc das cores
  367.   if ($devent == sclick) && ($did isnum 2029-2031) changecp
  368.  
  369.   ;Activa Recording
  370.   if ($devent == sclick) && ($did == 2001) && ($did(2001).state) {
  371.     var %a $input(Notes on Recording: $crlf If you activate recording it will work both for joined games and served games. $crlf It will always and only record the player who is serving even if you are a client. $crlf It will not record text or chat. $crlf It will work as a demo. Just don't press anything when you are on the main screen to watch it.,4,Macros)
  372.   dialog -v $dname }
  373.  
  374.   ;Início
  375.   if ($devent == init) { loadtooltips $dname | mdx.start | %jj2.w = $iif($crcuR(status),288,240)
  376.     set %a $mdx(SetControlMDX,1 listview rowselect single flatsb showsel report nosortheader > [ $mdx.vdll ] )
  377.     did -i $dname 1 1 headerdims 143:1 56:2 50:3 50:4 45:5 0:6 91:7 0:8
  378.     did -i $dname 1 1 headertext $+(Server Name,$tab,+c Type,$tab,+c Players,$tab,+c Version,$tab,+c Lag,$tab,IP,$tab,Uptime,$tab,ID)
  379.     didtok $dname 1026 46 Easy.Medium.Hard
  380.     if (!$inst1.23) { did -b $dname 1032 }
  381.     if (!$inst1.24) { did -b $dname 1033 }
  382.     did -c $dname $rep(%lastgmode,1011,Battle~1011,CTF~1012,Treasure~1013,Coop~1014,Race~1015 )
  383.     if (%lastgmode == race) { did -ra $dname 1022 5 | did -b $dname 1022 | did -b $dname 1026 }
  384.     elseif (%lastgmode == coop) { did -e $dname 1026 | did -b $dname 1022 | did -b $dname 1021 }
  385.     else { did -b $dname 1026 }
  386.     if (%lastversion == 1.24) && ($inst1.24) { did -c $dname 1033 }
  387.     elseif (%lastversion == 1.23) && ($inst1.23) { did -c $dname 1032 }
  388.     if (%lastlvl) did -ra $dname 1019 $ifmatch
  389.     if (%lastname) did -ra $dname 1017 $ifmatch
  390.     if (%lastscore) did -ra $dname 1022 $ifmatch
  391.     if (%lastlimit) did -ra $dname 1024 $ifmatch
  392.     if (%lastdlvl) { if (%lastdlvl == Easy) did -c $dname 1026 1 | elseif (%lastdlvl == Medium) did -c $dname 1026 2 | elseif (%lastdlvl == Hard) did -c $dname 1026 3 }
  393.     deact.range 2009 2010 $dname | deact.range 2014 2015 $dname
  394.     ;Loadings para o Player 1
  395.     %a = $mdx(SetControlMDX,2004 listview rowselect single flatsb showsel report nosortheader > [ $mdx.vdll ] )
  396.     did -i $dname 2004 1 headerdims 83:1 37:2
  397.     did -i $dname 2004 1 headertext $+(Name,$tab,+c Version)
  398.     if ($inst1.24) || ($inst1.23) {
  399.       did -b $dname 2005,2007
  400.       if (!$isdir($inidir)) erro.p1 Invalid profiles dir
  401.       else load.ini.list
  402.     }
  403.     did -c $dname $iif(%jj2.p1lastbase,%jj2.p1lastbase,2044)
  404.     set %jj2.lastbase $iif(%jj2.p1lastbase,%jj2.p1lastbase,2044)
  405.     if ($inst1.24) && (!$inst1.23) {
  406.       did -b $dname 2014,2015,2024,2051 | loaddefs 1.24
  407.     }
  408.     elseif (!$inst1.24) && ($inst1.23) {
  409.       did -b $dname 2014,2015,2025,2051 | loaddefs 1.23
  410.     }
  411.     elseif ($inst1.24) && ($inst1.23) {
  412.       if (%jj2.pl1lastv) loaddefs $ifmatch
  413.       else loaddefs 1.24
  414.     }
  415.     else { deact.range 2003 2010 $dname | deact.range 2014 2032 $dname
  416.       deact.range 2101 2104 $dname | deact.range 2111 2114 $dname
  417.       deact.range 2041 2047 $dname | deact.range 2049 2053 $dname
  418.     did -ra $dname 2051 $null }
  419.   }
  420.  
  421.   ;Clique no "B"
  422.   elseif ($devent == sclick) && ($did == 3) unset %jj2.notfirst
  423.  
  424.   ;Actualizar lista de profiles
  425.   elseif ($devent == sclick) && ($did == 13) && (($inst1.23) || ($inst1.24)) load.ini.list
  426.  
  427.   ;Recursos
  428.   elseif ($devent == sclick) && ($did isnum 2052-2053) {
  429.     dialog -m $str($iif($did == 2052,jcspal $chr(32),colorg $chr(32)),2)
  430.   }
  431.  
  432.   ;Clica no '1.23' ou '1.24' ou 'revert', carrega a respectiva versão
  433.   elseif ($devent == sclick) && (($did isnum 2024-2025) || ($did == 2047)) {
  434.   loaddefs $iif($did(2024).state,1.23,1.24) }
  435.  
  436.   ;Pêlo aleatório
  437.   elseif ($did isnum 2041-2042) && ($devent == sclick) {
  438.     if (!$did(2044).state) && (!$did(2045).state) { erro.p1 No base selected. Select either DEC or HEX | return }
  439.     var %r = 0 | while (%r < 4) { inc %r | var %ale = $iif($did == 2041,$r(0,95),$r(0,255))
  440.       var %rea = $iif($did(2044).state,%ale,$hexbin(%ale,2))
  441.       did -ra $dname 211 $+ %r $iif($len(%rea) < 2,0 $+ %rea,%rea)
  442.     }
  443.   }
  444.  
  445.   ;Funções de manipulação do nome
  446.   elseif ($devent == sclick) && ($did isnum 2020-2022) {
  447.     var %name = $did(2018)
  448.     if ($did == 2022) did -ra $dname 2018 $did(2018) $+ |
  449.     elseif ($did == 2021) { set %jj2.factor 48
  450.       if (§?* iswm $left($did(2018),2)) { %jj2.factor = $asc($mid($did(2018),2,1)) | %name = $right($did(2018),-2) }
  451.       %jj2.factor = $dialog(extfact,extfact)
  452.       if (%jj2.factor) { if (%jj2.factor == 48) did -ra $dname 2018 %name
  453.       else did -ra $dname 2018 § $+ $chr(%jj2.factor) $+ %name }
  454.     }
  455.     elseif ($did == 2020) && ($right($did(2018),1) != §) did -ra $dname 2018 %name $+ §
  456.     dialog -v $dname
  457.   }
  458.  
  459.   ;Mudança de bases
  460.   elseif ($devent == sclick) && ($did isnum 2044-2045) && (%jj2.lastbase != $did) {
  461.     var %oqestah = $did(2111) $did(2112) $did(2113) $did(2114)
  462.     if ($did == 2044) {
  463.       var %r = 0 | while (%r < 4) { inc %r
  464.         if (!$cfi($hexbin($did(211 $+ %r),1))) { erro.p1 Color error. Check the values.
  465.         did -u $dname 2044 | did -c $dname 2045 | halt }
  466.       }
  467.       var %result = $hexbin(%oqestah,1)
  468.     }
  469.     else {
  470.       var %r = 0 | while (%r < 4) { inc %r
  471.         if (!$cfi($did(211 $+ %r))) { erro.p1 Color error. Check the values.
  472.         did -u $dname 2045 | did -c $dname 2044 | halt }
  473.       }
  474.       var %result = $hexbin(%oqestah,2)
  475.     }
  476.     var %r = 0 | while (%r < 4) { inc %r
  477.     did -ra $dname 211 $+ %r $gettok(%result,%r,32) }
  478.  
  479.     %jj2.lastbase = $did
  480.   }
  481.  
  482.   ;Carregar no 'Load' ou no 'Load...',
  483.   elseif ($devent == sclick) && ($did isnum 2005-2006) {
  484.     if ($did == 2005) var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  485.     else { var %file = $sfile($inidir $+ \*.ini,Load Profile,Load)
  486.       if (!%file) return
  487.       if (!$isfile(%file)) { erro.p1 There is no such file | halt }
  488.     }
  489.     proc.carr.file %file
  490.     if (!$did(2049).state) did -e $dname 2046,2047
  491.   }
  492.   ;Carregar no 'Save' ou no 'Save...'
  493.   elseif ($devent == sclick) && ($did isnum 2007-2008) {
  494.     if ($did == 2007) var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  495.     else { var %file = $sfile($inidir $+ \*.ini,Save Profile,Save)
  496.       if (!%file) return
  497.     if (*.ini !iswm %file) %file = %file $+ .ini }
  498.     var %version = $iif($did(2024).state,1.23,1.24)
  499.     if ($ini(%file,%version)) {
  500.       if (%jj2.confover) var %edcv $$input(Do you want to overwrite the definitions for %version of that file?,136,Overwrite Defs)
  501.       else var %edcv 1
  502.       dialog -v $dname
  503.       if (!%edcv) return
  504.     }
  505.     save.to.ini %file
  506.     load.ini.list
  507.   }
  508.  
  509.   ;Eliminar .ini
  510.   elseif ($devent == sclick) && ($did == 2009) {
  511.     var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  512.     if (!$isfile(%file)) { erro.p1 There is no such file | halt }
  513.     .remove $qte(%file)
  514.     load.ini.list
  515.   }
  516.  
  517.   ;Renomear .ini
  518.   elseif ($devent == sclick) && ($did == 2010) {
  519.     var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  520.     if (!$isfile(%file)) { erro.p1 There is no such file | halt }
  521.     var %a $input(Write the new filename,1,Rename Profile,$nopath(%file))
  522.     dialog -v $dname |  if (!%a) return
  523.     if (*?.ini !iswm %a) { erro.p1 Invalid filename. Make sure you have entered the .ini extension | halt }
  524.     if ($chr(47) isin %a) || ($chr(92) isin %a) || ($chr(58) isin %a) || ($chr(42) isin %a) || ($chr(63) isin %a) || ($chr(34) isin %a) || ($chr(60) isin %a) || ($chr(62) isin %a) || ($chr(124) isin %a) { erro.p1 A filename cannot contain any of the following characters: \ / : * " < > $chr(124) | halt }
  525.     if ($isfile($nofile(%file) $+ %a)) { erro.p1 There is already a profile with that name | halt }
  526.     .rename $qte(%file) $qte($nofile(%file) $+ %a)
  527.     load.ini.list
  528.   }
  529.  
  530.   ;Duplicar .ini
  531.   elseif ($devent == sclick) && ($did == 2014) {
  532.     var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  533.     if (!$isfile(%file)) { erro.p1 There is no such file | halt }
  534.     if ($ini(%file,1.23)) && ($ini(%file,1.24)) { erro.p1 That profile has already info for both versions | halt }
  535.     if (!$ini(%file,1.23)) && (!$ini(%file,1.24)) { erro.p1 That profile is invalid | halt }
  536.     var %existant = $iif($ini(%file,1.23),1.23,1.24), %destiny = $iif($ini(%file,1.23),1.24,1.23)
  537.     writeini $qte(%file) %destiny name $readini(%file,n,%existant,name)
  538.     var %char = $readini(%file,n,%existant,char),%name = $readini(%file,n,%existant,name)
  539.     var %color = $readini(%file,n,%existant,color)
  540.     if (%char == $null) || (!%color) || (%name == $null)  { erro.p1 That profile is invalid | halt }
  541.     if (%char == lori) %char = Jazz
  542.     writeini $qte(%file) %destiny name %name
  543.     writeini $qte(%file) %destiny char %char
  544.     writeini $qte(%file) %destiny color %color
  545.     var %mode = $readini(%file,n,%existant,mode)
  546.     if (%mode) writeini $qte(%file) %destiny mode %mode
  547.     load.ini.list
  548.   }
  549.  
  550.   ;Reduzir .ini
  551.   elseif ($devent == sclick) && ($did == 2015) {
  552.     var %file = $inidir $+ \ $+ $tab($did(2004).seltext,1) $+ .ini
  553.     if (!$isfile(%file)) { erro.p1 There is no such file | halt }
  554.     if (!$ini(%file,1.23)) && (!$ini(%file,1.24)) { erro.p1 The .ini doesn't have information for both version | halt }
  555.     var %a = $dialog(redpro,redpro)
  556.     if (%jj2.tver == cancel) return
  557.     .remini $qte(%file) %jj2.tver
  558.     load.ini.list
  559.   }
  560.  
  561.   ;Change Default Directory
  562.   elseif ($devent == sclick) && ($did == 2016) {
  563.     var %a = $sdir($inidir,Select new default directory for the profiles)
  564.     if (!%a) return
  565.     if (!$isdir(%a)) { erro.p1 Invalid folder | halt }
  566.     else %jj2.inidir = %a
  567.     load.ini.list
  568.   }
  569.  
  570.   ;Copiar para a outra versão
  571.   elseif ($devent == sclick) && ($did == 2051) {
  572.     var %a $scriptdircache\temp.ini | .remove %a
  573.     save.to.ini %a
  574.     var %existant = $iif($did(2024).state,1.23,1.24), %destiny = $iif($did(2024).state,1.24,1.23)
  575.     writeini $qte(%a) %destiny name $readini(%a,n,%existant,name)
  576.     var %char = $readini(%a,n,%existant,char),%name = $readini(%a,n,%existant,name)
  577.     var %color = $readini(%a,n,%existant,color)
  578.     if (%char == lori) %char = Jazz
  579.     writeini $qte(%a) %destiny name %name
  580.     writeini $qte(%a) %destiny char %char
  581.     writeini $qte(%a) %destiny color %color | var %mode = $readini(%a,n,%existant,mode)
  582.     if (%mode) writeini $qte(%a) %destiny mode %mode
  583.     loadini %destiny %a
  584.     did -e $dname 2046,2047
  585.   }
  586.  
  587.   ;Gravar as definições
  588.   elseif ($devent == sclick) && ($did == 2046) savedefs
  589.  
  590.   ;Clique na lista de servers
  591.   elseif ($devent == sclick) && ($did == 1) {
  592.     if ($mouse.key & 4) && ($did(1,1).sel != 1) && ($did(1,1).sel) { did -d $dname 1 $did(1,1).sel }
  593.     if (%unse == dibu) {
  594.       if ($tab($did(1).seltext,6) == private) did -b $dname 600
  595.       elseif (!$did(1).seltext) did -b $dname 600
  596.       else {
  597.         var %vs = $tab($did(1).seltext,4)
  598.         if (%vs == 1.24 x) did $iif($inst1.24x,-e,-b) $dname 600
  599.         elseif (%vs == 1.21) || (%vs == 1.21 s) did $iif($inst1.23,-e,-b) $dname 600
  600.         elseif (%vs == 1.24) || (%vs == 1.24 s) did $iif($inst1.24,-e,-b) $dname 600
  601.         elseif (%vs == ??) did -e $dname 600
  602.         else did -b $dname 600
  603.       }
  604.     }
  605.   }
  606.   ;Server Information
  607.   elseif ($devent == sclick) && ($did == 999) {
  608.     if (!$did(1).seltext) { did -ra $dname 500 ERROR: You have to select the server before. | return }
  609.     if ($remove($tab($did(1).seltext,6),$chr(32)) == PRIVATE) { did -ra $dname 500 ERROR: You cannot get the server info of private servers | return }
  610.     if ($tab($did(1).seltext,4) == 1.21) || ($tab($did(1).seltext,4) == 1.21 s) || ($tab($did(1).seltext,4) == 1.24) || ($tab($did(1).seltext,4) == 1.24 s) {
  611.       var %a = ok
  612.       if (!%jj2.omitpur) {
  613.         %a = $dialog(ser_i_p,ser_i_p)
  614.       }
  615.       if (%a != ok) return
  616.       dialog -m ser_i ser_i
  617.       set %jj2.si.ver $iif($gettok($tab($did(1).seltext,4),1,32) == 1.21,121,124) | set %jj2.si.pl $remove($gettok($tab($did(1).seltext,3),1,47),$chr(91))
  618.       sockopen ser_i $tab($did(1).seltext,6) 10052
  619.     }
  620.     else { did -ra $dname 500 ERROR: Version not supported/unknown ( $+ $tab($did(1).seltext,4) $+ ) }
  621.   }
  622.  
  623.   ;Botão close
  624.   elseif ($devent == sclick) && (($did == 700) || ($did == 1028) || ($did == 2048)) {
  625.     %jj2.p1lastbase = $iif($did(2044).state,2044,2045)
  626.     %jj2.pl1lastv = $iif($did(2024).state,1.23,1.24) | .timerjj2.hossth off
  627.     sockclose listms | sockclose serverlist | .timernudpping off
  628.     sockclose udpping-* | unset %udpping.* | dialog -c $dname
  629.   }
  630.   ;Enter IP
  631.   elseif ($devent == sclick) && ($did == 802) dialog -m enter_ip enter_ip
  632.   ;Player 1
  633.   elseif ($devent == Sclick) && ($did == 801) chpl1click
  634.   ;Join Server (para mais ver alias -l joinser)
  635.   elseif (($devent == Sclick) && ($did == 600)) || (($devent == dclick) && ($did == 1)) joinser
  636.  
  637.   ;Iniciar Servidor
  638.   elseif ($devent == sclick) && ($did == 1027) {
  639.     if (!$did(1011).state) && (!$did(1012).state) && (!$did(1013).state) && (!$did(1014).state) && (!$did(1015).state) {
  640.     did -ra $dname 1035 Select a Game Mode }
  641.     elseif (!$did(1032).state) && (!$did(1033).state) did -ra $dname 1035 Select the version
  642.     elseif (!$remove($did(1017),$chr(32))) did -ra $dname 1035 Insert a name for your server
  643.     elseif (!$did(1019)) did -ra $dname 1035 Select the first level for your server
  644.     elseif (!$isfile($seldir $+ $did(1019))) did -ra $dname 1035 Insert a valid filename
  645.     elseif ($right($did(1019),4) != .j2l) did -ra $dname 1035 Your level name must end with .j2l
  646.     elseif (!$did(1015).state) && ((!$did(1022)) || (!$vernum($did(1022)))) did -ra $dname 1035 Insert a valid number in field "Score to Win".
  647.     elseif (!$did(1024)) did -ra $dname 1035 Insert a number in field "Player Limit".
  648.     elseif (!$vernum($did(1024))) did -ra $dname 1035 Insert a valid number in field "Player Limit".
  649.     elseif ($did(1014).state) && (!$did(1026).seltext) did -ra $dname 1035 Select a difficulty Level.
  650.     else {
  651.       %lastgmode = $rep(1 $+ $chr(32),null,$did(1011).state ~Battle,$did(1012).state ~CTF,$did(1013).state ~Treasure,$did(1014).state ~Coop,$did(1015).state ~Race)
  652.       %lastversion = $rep(1 $+ $chr(32),null,$did(1032).state ~1.23,$did(1033).state ~1.24)
  653.       writestat serve
  654.       %lastlvl = $did(1019) | %lastname = $did(1017) | %lastscore = $did(1022)
  655.       %lastlimit = $did(1024) | %lastdlvl = $did(1026).seltext
  656.       if (%lastgmode == CTF) colorctf %lastversion 1
  657.       run $rep(1 $+ $chr(32),null,$did(1032).state ~ [ %path.121 ] ,$did(1033).state ~ [ %path.124 ] ) -SERVER $did(1019) $&
  658.         $rep(1 $+ $chr(32),null,$did(1011).state ~-battle,$did(1012).state ~-capture,$did(1013).state ~-Treasure,$did(1014).state ~-COOP,$did(1015).state ~-Race) -MAXPLAYERS $did(1024) -COUNTS $did(1022) $iif($did(1014).state == 1,$did(1026).seltext) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record)
  659.     }
  660.   }
  661.   ;Selecção do tipo de jogo
  662.   elseif ($devent == sclick) && ($did isnum 1011-1015) {
  663.     if ($did(1033).state == 0) && ($did(1032).state == 0) { did -ra $dname 1035 First select a version }
  664.     if ($did == 1011) { did -ra $dname 1019 battle1.j2l | did -b $dname 1026 | did -e $dname 1021 | did -ra $dname 1021 Roasts to win | did -e $dname 1022 | did -ra $dname 1022 10 }
  665.     elseif ($did == 1012) { did -ra $dname 1019 capture1.j2l | did -b $dname 1026 | did -e $dname 1021 | did -ra $dname 1021 Points to win | did -e $dname 1022 | did -ra $dname 1022 10 }
  666.     elseif ($did == 1013) { did -ra $dname 1019 treasur1.j2l | did -b $dname 1026 | did -e $dname 1021 | did -ra $dname 1021 Gems to win | did -e $dname 1022 | did -ra $dname 1022 100 }
  667.     elseif ($did == 1014) { did -ra $dname 1019 share1.j2l | did -e $dname 1026 | did -b $dname 1021 | did -b $dname 1022 }
  668.     elseif ($did == 1015) { did -ra $dname 1019 race1.j2l | did -b $dname 1026 | did -e $dname 1021 | did -ra $dname 1021 Laps to Win | did -ra $dname 1022 5 | did -b $dname 1022 }
  669.   }
  670.   ;Shortcuts
  671.   elseif ($devent == sclick) && ($did isnum 1501-1509) $eval($crcuC($calc($did -1500)),3)
  672.   ;Clique na seta dos shtcuts
  673.   elseif ($devent == sclick) && (($did == 1510) || ($did == 1511)) hideorshowshtc $did(1510)
  674.  
  675.   ;Browse Button
  676.   elseif ($devent == sclick) && ($did == 1020) {
  677.     if (!$did(1032).state) && (!$did(1033).state) did -ra $dname 1035 First select a version
  678.     else var %a = $dialog(browse,browse)
  679.   }
  680.   elseif ($devent == sclick) && ($did == 1034) {
  681.     if (!$did(1011).state) && (!$did(1012).state) && (!$did(1013).state) && (!$did(1014).state) && (!$did(server_list,1015).state) {
  682.     did -ra $dname 1035 Select a Game Mode | return }
  683.     if (!$did(1032).state) && (!$did(1033).state) { did -ra $dname 1035 Select the version | halt }
  684.     if (!$did(1017)) { did -ra $dname 1035 Insert a name for your server | halt }
  685.     if ($did(1034).text == List Server) {
  686.       sockclose listms | did -ra $dname 1034 Cancel
  687.       sockopen listms %listserver 10054
  688.       did -ra $dname 1031 Connecting to %listserver $+ :10054
  689.     }
  690.     elseif ($did(1034).text == Cancel) { sockclose listms | did -ra $dname 1034 List Server | did -ra server_list 1031 Listing canceled }
  691.     elseif ($did(1034).text == Delist Server) { sockclose listms | did -ra $dname 1034 List Server | did -ra $dname 1031 Server delisted }
  692.     else { echo -s Unknown error | halt }
  693.   }
  694.  
  695.   ;Clique no "R"
  696.   elseif ($devent == sclick) && ($did == 2000) the.ar
  697.  
  698.  
  699. }
  700. alias -l proc.carr.file {
  701.   var %1.23 = $ini($1-,1.23),%1.24 = $ini($1-,1.24),%both
  702.   if (%1.23) && (%1.24) { %1.23 = $null | %1.24 = $null | %both = 1 }
  703.   elseif (!%1.23) && (!%1.24) { erro.p1 Invalid .ini (no version) | halt }
  704.   if ($inst1.23) && (!$inst1.24) {
  705.     if (%1.23) || (%both) { loadini 1.23 $1- | if ($did(2049).state) savedefs }
  706.     elseif (%1.24) erro.p1 That .ini is only for 1.24. To use it, you must duplicate its info.
  707.   }
  708.   elseif ($inst1.24) && (!$inst1.23) {
  709.     if (%1.24) || (%both) { loadini 1.24 $1- | if ($did(2049).state) savedefs }
  710.     elseif (%1.23) erro.p1 That .ini is only for 1.23. To use it, you must duplicate its info.
  711.   }
  712.   else {
  713.     if (!%both) { loadini $iif(%1.23,1.23,1.24) $1- | if ($did(2049).state) savedefs }
  714.     else {
  715.       var %1 = $iif($did(2024).state,1.24,1.23),%r
  716.       :salto | loadini %1 $1- | if ($did(2049).state) savedefs
  717.       %1 = $iif(%1 == 1.23,1.24,1.23) | if (%r) return | %r = 1 | goto salto
  718.   } }
  719. }
  720. alias -l save.to.ini {
  721.   tokenize 32 $replace($1-,\\,\)
  722.   var %version = $iif($did(2024).state,1.23,1.24)
  723.   if (!$did(2018)) { erro.p1 Fill in a name | halt }
  724.   if (!$did(2029).state) && (!$did(2030).state) && (%version == 1.23) { erro.p1 Pick a character. | halt }
  725.   if (!$did(2029).state) && (!$did(2030).state) && (!$did(2031).state) && (%version == 1.24) { erro.p1 Pick a character. | halt }
  726.   ver.cores
  727.   writeini $qte($1-) %version name $did(2018)
  728.   writeini $qte($1-) %version char $iif($did(2029).state,Spaz,$iif($did(2030).state,Spaz,Lori))
  729.   writeini $qte($1-) %version color $did(2111) $did(2112) $did(2113) $did(2114)
  730.   writeini $qte($1-) %version mode $iif($did(2044).state,BIN,HEX)
  731. }
  732. alias -l ler.entrada return $dll($scriptdirregistry.dll,GetKeyValue,$3 HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($2 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $2 $+ \Player0\\ $+ $1)
  733. alias loadini {
  734.   ;1 - version 2- path
  735.   did -ra $dname 2018 $readini($2-,n,$1,name)
  736.   did -u $dname 2024,2025 | did -c $dname $iif($1 == 1.23,2024,2025)
  737.   did -ra $dname 2051 Copy to $iif($1 == 1.23,1.24,1.23)
  738.   var %1 = $readini($2-,n,$1,char)
  739.   did -u $dname 2029,2030,2031
  740.   if ($1 == 1.24) did -c $dname $iif(%1 == Spaz,2029,$iif(%1 == lori,2031,2030))
  741.   else did -c $dname $iif(%1 == Spaz,2029,2030)
  742.   changecp
  743.   var %colors = $readini($2-,n,$1,color),%r = 0
  744.   while (%r < 4) { inc %r | did -ra $dname 211 $+ %r $gettok(%colors,%r,32) }
  745.   did -u $dname 2044,2045 | var %idbase = $iif($readini($2-,n,$1,mode) == HEX,2045,2044)
  746.   did -c $dname %idbase | %jj2.lastbase = %idbase
  747. }
  748. alias -l loaddefs {
  749.   did -ra server_list 2018 $ler.entrada(Name,$1)
  750.   if ($1 == 1.23) { var %spaz = 55000000,%jazz = 36000000 | did -u server_list 2025 | did -c server_list 2024 | did -ra $dname 2051 Copy to 1.24 }
  751.   elseif ($1 == 1.24) { var %spaz = 59000000,%jazz = 37000000,%lori = 3d000000 | did -u server_list 2024 | did -c server_list 2025 | did -ra $dname 2051 Copy to 1.23 }
  752.   else { echo -s ERROR: /loaddefs: Invalid parameters | halt }
  753.  
  754.   var %char = $ler.entrada(Char,$1,hex)
  755.   if (%char == %spaz) {
  756.   did -u server_list 2029,2030,2031 | did -c server_list 2029 | changecp }
  757.   elseif (%char == %jazz) { did -u server_list 2029,2030,2031  | did -c server_list 2030 | changecp }
  758.   elseif ($1 == 1.24) && (%char == %lori)  { did -u server_list 2029,2030,2031 | did -c server_list 2031 | changecp }
  759.   else { erro.p1 Invalid character, selecting Jazz
  760.   did -u server_list 2029,2030,2031  | did -c server_list 2030 | changecp }
  761.   did $iif($1 == 1.23,-b,-e) $dname 2031
  762.  
  763.   if ($did(2044).state) %reques = $hexbin($dll($scriptdirregistry.dll,GetKeyValue,splithex HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Color),1)
  764.   elseif ($did(2045).state) %reques = $dll($scriptdirregistry.dll,GetKeyValue,splithex HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Color)
  765.   else { erro.p1 No base selected (abnormal situation) | halt }
  766.   %reques = $upper(%reques)
  767.  
  768.   meter.nums.nos.inputs
  769.   ;desactivar o revert e o save definitions
  770.   did -b server_list 2046,2047
  771. }
  772. alias -l erro.p1 did -ra $dname 2027 $1- | .timerp1 1 8 did -r server_list 2027
  773. alias -l deact.range { var %r = $1 | while (%r <= $2) { did -b $3 %r | inc %r } }
  774. alias -l inishow { var %t
  775.   if ($ini($qte($1-),1.23)) %t = 1.23
  776.   if ($ini($qte($1-),1.24)) %t = %t 1.24
  777.   if (%t) did -a server_list 2004 $+($left($nopath($1-),-4),$tab,$replace(%t,1.23 1.24,Both))
  778. }
  779. alias -l load.ini.list {
  780. did -r $dname 2004 | .echo -q $findfile($inidir,*.ini,0,1,inishow $1-) }
  781. alias -l savedefs {
  782.   did -b $dname 2046
  783.  
  784.   if ($did(2024).state) tokenize 32 1.23
  785.   elseif ($did(2025).state) tokenize 32 1.24
  786.   else { erro.p1 No version selected (abnormal) | halt }
  787.  
  788.   if (!$did(2018)) { erro.p1 Fill in a name | halt }
  789.   .echo -q $dll($scriptdirregistry.dll,SetKeyValue,REG_SZ HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Name [ $cr ] $did(2018))
  790.   ;Chars (1.23) Spaz R - 55 I - (85); Jazz R - 36 I - (54)
  791.   ;Chars (TSF) Lori R - 3d I - (61); Spaz R - 59 I - (89); Jazz R - 37 I - (55)
  792.   if ($1 == 1.23) var %spaz = 85,%jazz = 54
  793.   elseif ($1 == 1.24) var %spaz = 89,%jazz = 55
  794.   if ($did(2030).state) { var %a = $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Char [ $cr ] %jazz 00 00 00) }
  795.   elseif ($did(2029).state) { var %a = $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Char [ $cr ] %spaz 00 00 00) }
  796.   elseif ($did(2031).state) && ($did(2025).state) { set %a $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 Special Edition\1.24\Player0\\Char [ $cr ] 61 00 00 00) }
  797.   else { erro.p1 Pick a character. | halt }
  798.  
  799.   ver.cores
  800.   if ($did(2044).state) var %a = $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Color [ $cr ] $did(2111) $did(2112) $did(2113) $did(2114))
  801.   elseif ($did(2045).state) var %a = $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Color [ $cr ] $hexbin($did(2111) $did(2112) $did(2113) $did(2114),1))
  802.  
  803.   else { erro.p1 Select a base. | halt }
  804.   did -b $dname 2047
  805. }
  806. on *:dialog:extfact:*:*: {
  807.   if ($devent == init) { mdx.start
  808.     var %a $mdx(SetControlMDX,1 trackbar noautosel tooltips > [ $mdx.bdll ] )
  809.     did -i $dname 1 1 params %jj2.factor 1 255 1 10 * * 25
  810.     did -i $dname 1 1 ticfreq 15 | did -ra $dname 14 %jj2.factor
  811.     actual.factor %jj2.factor
  812.   }
  813.   elseif ($devent == sclick) { var %sel = $gettok($did(1,1),1,32)
  814.     did -i $dname 1 1 tipText Extension Factor: %sel
  815.     did -ra $dname 14 %sel
  816.     actual.factor %sel
  817.   }
  818.   elseif ($devent == sclick) && ($did == 2) dialog -v $dname $dname
  819.   elseif ($devent == edit) && ($did == 14) {
  820.     if ($did(14) == $null) return
  821.     elseif ($did(14) !isnum) || ($did(14) < 1) { did -ra $dname 14 1 | actual.factor 1 }
  822.     elseif ($did(14) > 255) { did -ra $dname 14 255 | actual.factor 255 }
  823.     elseif ($did(14) != $int($did(14))) { did -ra $dname 14 $int($did(14)) | actual.factor $int($did(14)) }
  824.     else actual.factor $did(14)
  825.     did -i $dname 1 1 params $did(14)
  826.   }
  827. }
  828. alias -l actual.factor {
  829.   var %r = 0 | while (%r < 5) { inc %r
  830.   var %a $mdx(SetColor,extfact [ 2 [ $+ [ %r ] ] ] textbg reset) }
  831.   var %t = $iif($1 isnum 1-47,21,$iif($1 == 48,22,$iif($1 isnum 48-58,23,$iif($1 == 59,24,25))))
  832.   %a = $mdx(SetColor,extfact [ %t ] textbg $rgb(255,255,255))
  833. }
  834. alias -l ver.cores {
  835.   if ($did(2044).state) {
  836.     var %r = 0 | while (%r < 4) { inc %r
  837.       if (!$cfi($did(211 $+ %r))) { erro.p1 Color error. Check the values. | halt }
  838.   } }
  839.   elseif ($did(2045).state) {
  840.     var %r = 0 | while (%r < 4) { inc %r
  841.       if (!$cfi($hexbin($did(211 $+ %r),1))) { erro.p1 Color error. Check the values. | halt }
  842.   } }
  843. }
  844. dialog jj2.ssl {
  845.   title "Suitable Server Found"
  846.   size -1 -1 400 173
  847.   option pixels
  848.   text "A server with the required points have been found. The details of the best one follow.  You may join it immediately.", 1, 12 13 377 39
  849.   box "Details", 2, 14 55 374 77
  850.   text "Name:", 3, 27 77 52 18
  851.   text "Mode:", 4, 28 103 51 19
  852.   edit "", 5, 90 74 284 21, read
  853.   edit "", 6, 90 102 53 21, read
  854.   text "Players:", 7, 150 103 57 19
  855.   edit "", 8, 214 103 53 21, read
  856.   text "Version:", 9, 280 103 51 19
  857.   edit "", 10, 335 102 40 21, read
  858.   edit "", 14, 1 1 20 1, hidden
  859.   text "Joining in ...", 11, 15 142 138 20
  860.   button "Join", 12, 176 142 135 22, default ok
  861.   button "Cancel", 13, 325 142 62 22, cancel
  862. }
  863. on *:dialog:jj2.ssl:*:*: {
  864.   if ($devent == init) { did -ra $dname 14 %jj2.linenum
  865.     var %l = $did(server_list,1,$did(14))
  866.     did -ra $dname 5 $tab(%l,1) | did -ra $dname 6 $tab(%l,2)
  867.     did -ra $dname 8 $tab(%l,3) | did -ra $dname 10 $tab(%l,4)
  868.     ssl.startcount
  869.   }
  870.   elseif ($devent == sclick) {
  871.     if ($did == 12) { joinser $did(14) | .timerjj2.ssl off }
  872.     elseif ($did == 13) .timerjj2.ssl off
  873. } }
  874. alias ssl.startcount {
  875.   if (!$1) %jj2.sslcount = 6
  876.   dec %jj2.sslcount
  877.   did -ra jj2.ssl 11 Joining in %jj2.sslcount seconds...
  878.   if (%jj2.sslcount == 0) { joinser $did(jj2.ssl,14) | dialog -c jj2.ssl jj2.ssl | return }
  879.   .timerjj2.ssl 1 1 ssl.startcount 1
  880. }
  881.  
  882.  
  883. alias the.ar { if (!$dialog(server_list)) return
  884.   if ($dialog(ser_i)) { .timerjj2ar 1 %jj2.ar the.ar | return }
  885. .timernudpping off | sockclose udpping-* | did -r server_list 1 | unset %udpping.* | sockclose serverlist | readsl ao }
  886. alias readsl {
  887.   if ($1 == ao) { if (!$dialog(server_list)) halt | goto b }
  888.   if ($dialog(server_list)) { dialog -ve server_list | return }
  889.   if ($inst1.23) { set %iconsl %path.121 }
  890.   elseif ($inst1.24) { set %iconsl %path.124 }
  891.   sockclose serverlist | sockclose udpping-* | .timernudpping off | unset %udpping.*
  892.   dialog -m server_list sl
  893.   :b | if (%unse == dibu) { did -b server_list 600 }
  894.   if (%listserver != $null) { sockopen serverlist %listserver 10057 | did -ra server_list 901 Connecting to %listserver $+ :10057... }
  895.   else { did -ra server_list 500 ERROR: List server not defined | halt }
  896.   unset %sip.*
  897. }
  898. alias -l tab { if (!$1-) return $chr(9)
  899.   return $gettok($gettok($gettok($1,2-,32),$2,9),5-,32)
  900. }
  901. alias -l mdx.start { dll $shortfn($scriptdirmdx.dll) SetMircVersion $version | var %a = $mdx(MarkDialog,$dname) }
  902. alias -l mdx { if ($lock(dll)) return | if ($isid) return $dll($mdx.udll,$1,$iif($2- != $null,$2-,.)) | dll $shortfn($mdx.udll) $1- }
  903. alias -l mdx.bdll { return $shortfn($scriptdirbars.mdx) }
  904. alias -l mdx.vdll { return $shortfn($scriptdirviews.mdx) }
  905. alias -l mdx.udll { return $shortfn($scriptdirmdx.dll) }
  906. on *:sockopen:serverlist: {
  907.   if ($sock($sockname).status == connecting) && ($dialog(server_list)) { did -ra server_list 901 Inactive | did -ra server_list 500 ERROR: Could not connect to the list server. | halt }
  908.   else did -ra server_list 901 Connected! | set %jj2.serverid 0 | unset %jj2.aosa.* | %jj2.aosa.total.players = 0 | if ($hget(jj2.pts)) hfree jj2.pts
  909.   .timerjj2.joinbest off
  910. }
  911. alias rembrackets return $remove($1,$chr(91),$chr(93))
  912. on *:sockread:serverlist:{ if (!$dialog(server_list)) { sockclose serverlist | halt }
  913.   if ($sockerr > 0) { did -ra server_list 901 Inactive | did -ra server_list 500 ERROR | halt }
  914.   did -ra server_list 901 Receiving Server List...
  915.   set %q 2
  916.   :nextread | inc %jj2.serverid
  917.   sockread %temp | tokenize 32 %temp
  918.   if ($sockbr == 0) || (%temp == $null) return
  919.   inc %q
  920.  
  921.   var %ip = $gettok($1,1,58),%mon = $2,%pp = $3,%type = $replace($iif($4 == unknown,??,$4),treasure,treas),%id = %jj2.serverid
  922.   if ($6 isnum) { var %version = $iif($5 == 1.,??,$5),%uptime = $duration($6),%players = $iif($rembrackets($7) == 0/0,??,$rembrackets($7)),%servername = $remcolsp($8-) }
  923.   else { var %version = $5-6,%uptime = $duration($7),%players = $iif($rembrackets($8) == 0/0,??,$rembrackets($8)),%servername = $remcolsp($9-) }
  924.  
  925.   if ($gettok(%players,1,47) isnum) %jj2.aosa.total.players = %jj2.aosa.total.players + $ifmatch
  926.  
  927.   if (%pp == private) {
  928.     if (%unse == hide) goto nextread
  929.     did -i server_list 1 %q %servername $tab %type $tab %players $tab %version $tab ----- $tab PRIVATE $tab %uptime $tab %jj2.serverid
  930.   }
  931.   elseif (%version == 1.21) || (%version == 1.21 s) {
  932.     if (%unse == hide) && (!$inst1.23) goto nextread
  933.     did -i server_list 1 %q %servername $tab %type $tab %players $tab %version $tab ... $tab %ip $tab %uptime $tab %jj2.serverid
  934.   }
  935.   elseif (%version == 1.24) || (%version == 1.24 s) {
  936.     if (%unse == hide) && (!$inst1.24) goto nextread
  937.     did -i server_list 1 %q %servername $tab %type $tab %players $tab %version $tab ... $tab %ip $tab %uptime $tab %jj2.serverid
  938.   }
  939.   elseif (%version == 1.24 x) {
  940.     if (%unse == hide) && (!$inst1.24x) goto nextread
  941.     did -i server_list 1 %q %servername $tab %type $tab %players $tab %version $tab ... $tab %ip $tab %uptime $tab %jj2.serverid
  942.   }
  943.   else {
  944.     if (%unse == hide) goto nextread
  945.     did -i server_list 1 %q %servername $tab %type $tab %players $tab %version $tab ... $tab %ip $tab %uptime $tab %jj2.serverid
  946.   }
  947.  
  948.   goto nextread
  949. }
  950. on *:sockclose:serverlist: { if (%unse != hide) { var %s = $calc($did(server_list,1).lines -1),%t = %jj2.aosa.total.players
  951.     if (%t > %jj2.player.record) || (!%jj2.player.record) %jj2.player.record = %t
  952.   did -ra server_list 901 Finished. $calc($did(server_list,1).lines -1) server $+ $iif(%s != 1,s) listed ( $+ %t player $+ $iif(%t != 1,s) $+ . Max: %jj2.player.record $+ ). }
  953.   else did -ra server_list 901 Finished. One or more servers may have been hidden.
  954.   if (%jj2.ar isnum 1-) { .timerjj2ar 1 %jj2.ar the.ar }
  955.   set %jj2.aosa.listed.servers %s | %jj2.aosa.anysofar = 0 | %jj2.aosa.veraosa = 0 | jj2.aosa.ex | .timer -m 1 200 hemudpping
  956.   if ($did(server_list,3).state == 1) .timerjj2.joinbest -o 1 8 jj2.joinbest
  957. }
  958. alias hemudpping { if (!$dialog(server_list)) halt | var %d = 1,%r | while (%d < $did(server_list,1).lines) { inc %d | if ($tab($did(server_list,1,%d),5) == ...) { udpping %d | inc %r } } | if (%r > 0) .timernudpping 1 4 hemudpping }
  959. alias udpping { if (!$1) halt | var %ip = $tab($did(server_list,1,$1),6)
  960.   if (%ip == PRIVATE) { var %cluc = $did(server_list,1,$1) | did -d server_list 1 $1
  961.   did -i server_list 1 $1 $tab(%cluc,1) $tab $tab(%cluc,2) $tab $tab(%cluc,3) $tab $tab(%cluc,4) $tab ----- $tab PRIVATE $tab $tab(%cluc,7) $tab $tab(%cluc,8) | return }
  962.   bread $qte($scriptdirudpping.dat) 0 $file($scriptdirudpping.dat).size &ping
  963.   if (%ip) { sockudp -k udpping- [ $+ [ %ip ] ] %ip 10052 &ping | set %udpping. [ $+ [ %ip ] ] $ticks $tab($did(server_list,1,$1),8) }
  964. }
  965. on *:udpread:udpping-*: {
  966.   var %rf = $ticks,%id = $gettok(%udpping. [ $+ [ $gettok($sockname,2,45) ] ] ,2,32)
  967.   sockread &bvar
  968.   ;echo -s $gettok($sockname,2,45) $+ : $bvar(&bvar,1,$bvar(&bvar,0))
  969.   var %byte = $bvar(&bvar,9),%version = ??,%pp = 1,%type = ??,%base
  970.   if (%byte isnum 129-133) { %version = 1.24 | %pp = 1 | %base = 129 }
  971.   elseif (%byte == 5) { %version = 1.24 s | %pp = 1 | %base = 1 }
  972.   elseif (%byte == 69) { %version = 1.21 s | %pp = 1 | %base = 65 }
  973.   elseif (%byte isnum 161-165) { %version = 1.24 | %pp = 0 | %base = 161 }
  974.   elseif (%byte isnum 193-197) { %version = 1.21 | %pp = 1 | %base = 193 }
  975.   elseif (%byte isnum 225-229) { %version = 1.21 | %pp = 0 | %base = 225 }
  976.   %type = $rep($calc(%byte - %base),??,0~co-op,1~battle,2~race,3~treas,4~ctf)
  977.   if (%udpping. [ $+ [ $gettok($sockname,2,45) ] ] == $null) halt
  978.   var %y = 0,%x | while (%y < $did(server_list,1).lines) { inc %y
  979.   %x = $did(server_list,1,%y) | if ($tab(%x,8) == %id) { %linha = %y | goto x } } | halt
  980.   :x | var %cluc = $did(server_list,1,%linha)
  981.   if ($tab(%cluc,4) == $(1.24 x)) {
  982.   did -o server_list 1 %linha $tab(%cluc,1) $tab $tab(%cluc,2) $tab $tab(%cluc,3) $tab $tab(%cluc,4) $tab $calc(%rf - $gettok(%udpping. [ $+ [ $gettok($sockname,2,45) ] ] ,1,32)) $tab $tab(%cluc,6) $tab $tab(%cluc,7) $tab $tab(%cluc,8) }
  983.   else {
  984.   did -o server_list 1 %linha $tab(%cluc,1) $tab %type $tab $tab(%cluc,3) $tab %version $tab $iif(%pp,$calc(%rf - $gettok(%udpping. [ $+ [ $gettok($sockname,2,45) ] ] ,1,32)),-----) $tab $iif(%pp,$gettok($sockname,2,45),PRIVATE) $tab $tab(%cluc,7) $tab $tab(%cluc,8) }
  985.   jj2.aosa.ex %id | sockclose $sockname
  986. }
  987. alias jj2.joinbest { var %r = 0,%bestsofar = 0,%bb,%t = $hget(jj2.pts,0).item
  988.   if (!%t) { %jj2.notfirst = 1 | return }
  989.   while (%r < %t) { inc %r
  990.     if ($hget(jj2.pts,$hget(jj2.pts,%r).item) > %bestsofar) { %bb = $hget(jj2.pts,%r).item
  991.     %bestsofar = $ifmatch }
  992.   }
  993.   if (%jj2.ptsmin isnum) && (%bestsofar < %jj2.ptsmin) { %jj2.notfirst = 1 | return }
  994.   %r = 0
  995.   while (%r < $did(server_list,1).lines) { inc %r | %s = $did(server_list,1,%r)
  996.     if ($tab(%s,8) == %bb) { if (!%jj2.notfirst) joinser %r
  997.     else { %jj2.linenum = %r | dialog -m jj2.ssl jj2.ssl ) } }
  998. } }
  999.  
  1000. ;--- AOSA
  1001. dialog jj2.aosa {
  1002.   title "Automatic On-Server Actions"
  1003.   size -1 -1 132 201
  1004.   option dbu
  1005.   icon %iconsl, 0
  1006.   text "This feature is mIRC scripting based. See the examples included by default and the mIRC help file (type /mirc if-then-else, for instance) for more information.", 1, 4 3 128 22
  1007.   box "Condition", 80, 2 58 128 20
  1008.   edit "", 4, 6 66 120 10, autohs
  1009.   box "General", 5, 2 29 128 28
  1010.   text "Name:", 6, 6 38 18 6
  1011.   edit "", 3, 26 36 34 8, autohs limit 35
  1012.   check "Active", 8, 38 47 24 6
  1013.   box "Actions", 9, 2 82 128 54
  1014.   edit "", 10, 6 90 120 42, multi return hsbar vsbar
  1015.   text "Additional Variables: %jj2.aosa. + {name, gametype, player.num, capacity, version, lag, ip, id, listed.servers, total.players}, %jj2.id (id of the last added server)", 11, 4 138 128 26
  1016.   text "Additional Commands: remove.server, jj2.addserver, set.field, refresh.list", 12, 4 168 128 14
  1017.   button "Save", 13, 4 188 40 10
  1018.   button "OK", 14, 52 188 36 10, default
  1019.   button "Close", 15, 96 188 32 10, cancel
  1020.   button "Delete", 7, 89 46 22 8
  1021.   button "Reload", 16, 89 36 22 8
  1022.   text "Pos:", 17, 6 46 18 6
  1023.   edit "", 18, 26 46 10 8, disable autohs limit 35
  1024.   button "/\", 19, 70 36 9 8
  1025.   button "\/", 20, 70 46 9 8
  1026.   button ">", 22, 80 41 6 6
  1027.   button "<", 21, 62 41 6 6
  1028.   button "N.", 23, 113 36 12 18
  1029. }
  1030.  
  1031.  
  1032. on *:dialog:jj2.aosa:*:*: {
  1033.   if ($devent == init) loadtooltips $dname
  1034.   elseif ($devent == sclick) {
  1035.     if ($did == 7) { var %entry = $did(18)
  1036.       if ($hget(jj2.aosa,%entry)) {
  1037.         var %a = $input(Are you sure you want to delete the entry $+(",%entry,") $+($chr(40),$gettok($hget(jj2.aosa,%entry),1,22),$chr(41),?),136,JJ2 add-on for mIRC)
  1038.         dialog -ve jj2.aosa
  1039.         if (!%a) return | var %r = %entry,%h = 0
  1040.         hdel jj2.aosa %entry
  1041.         while (%r < $calc($hget(jj2.aosa,0).item +1)) { inc %r | %h = 1 | hadd jj2.aosa $calc(%r -1) $hget(jj2.aosa,%r) }
  1042.         if (%h) hdel jj2.aosa $hget(jj2.aosa,0).item | saveaosa
  1043.         if ($hget(jj2.aosa,0).item > 0) jj2.aosa.load $dname $hget(jj2.aosa,0).item
  1044.       }
  1045.       did -r $dname 3,4,10,18 | did -u $dname 8
  1046.     }
  1047.     elseif ($did == 13) jj2.aosa.save
  1048.     elseif ($did == 14) { jj2.aosa.save | dialog -x $dname }
  1049.     elseif ($did == 2) run http://www.aleger.tk/
  1050.     elseif ($did == 16) jj2.aosa.load $dname $did(18)
  1051.     elseif ($did isnum 19-20) {
  1052.       if (($did == 19) && ($did(18) == 1)) || (($did == 20) && ($did(18) >= $hget(jj2.aosa,0).item)) return
  1053.       jj2.aosa.save | var %subnum = $iif($did == 19,$calc($did(18) -1),$calc($did(18) +1))
  1054.       var %curr = $hget(jj2.aosa,$did(18)),%asub = $hget(jj2.aosa,%subnum)
  1055.       hadd jj2.aosa $did(18) %asub | hadd jj2.aosa %subnum %curr
  1056.       jj2.aosa.load $dname %subnum
  1057.     }
  1058.     elseif ($did isnum 21-22) {
  1059.       if (!$hget(jj2.aosa,0).item) { .echo -q $input(There are no entries,516,JJ2 add-on for mIRC)
  1060.       dialog -ve jj2.aosa | halt }
  1061.       if ($did(18) == $null) { if ($did == 21) var %subnum = 1 | if ($did == 22) var %subnum = $hget(jj2.aosa,0).item | goto load }
  1062.       if (($did == 21) && ($did(18) == 1)) || (($did == 22) && ($did(18) >= $hget(jj2.aosa,0).item)) return
  1063.       jj2.aosa.save | var %subnum = $iif($did == 21,$calc($did(18) -1),$calc($did(18) +1))
  1064.       :load | jj2.aosa.load $dname %subnum
  1065.     }
  1066.     elseif ($did == 23) { jj2.aosa.save | did -r $dname 3,4,10,18 }
  1067. } }
  1068. alias jj2.aosa.save {
  1069.   if ($did(3) == $null) || ($did(10) == $null) || ($did(4) == $null) {
  1070.     .echo -q $input(One of the fields was left blank,516,JJ2 add-on for mIRC)
  1071.   dialog -ve jj2.aosa | halt } | var %ta = jj2.aosa
  1072.   if ($did(18) !isnum) { did -ra $dname 18 $calc($hget(%ta,0).item +1)
  1073.     var %r = 0 | while (%r < $hget(%ta,0).item) { inc %r
  1074.       if ($gettok($hget(%ta,$hget(%ta,%r).item),1,22) == $did(3)) {
  1075.   did -ra $dname 18 $hget(%ta,%r).item | break } } }
  1076.   if (!$1) && (!$vernum($did(18),1)) { .echo -q $input(The position must be a natural number,516,JJ2 add-on for mIRC)
  1077.   dialog -ve jj2.aosa | halt }
  1078.   var %r = 0,%p | while (%r < $did(10).lines) { inc %r
  1079.   %p = %p $iif($did($dname,10,%r) != $null,$chr(124)) $did($dname,10,%r) } | %p = $right(%p,-2)
  1080.   hadd -m %ta $did(18) $+($replace($did(3),$chr(32),_),$chr(22),$did(8).state,$chr(22),$did(4),$chr(22),%p)
  1081.   saveaosa
  1082. }
  1083. alias jj2.aosa.edit { var %ta = jj2.aosa
  1084.   if ($dialog(%ta)) dialog -ve %ta
  1085.   dialog -m %ta %ta
  1086.   if ($1 !isnum) {
  1087.     var %r = 0 | while (%r < $hget(%ta,0).item) { inc %r
  1088.       if ($gettok($hget(%ta,$hget(%ta,%r).item),1,22) == $1) { tokenize 32 $hget(%ta,%r).item | break }
  1089.   } }
  1090.   if ($1) {
  1091.     if (!$hget(%ta,$1)) { .echo -q $input(There is no such entry: $+(",$1,"),516,JJ2 add-on for mIRC)
  1092.     dialog -ve %ta | halt }
  1093.     jj2.aosa.load %ta $1
  1094.   }
  1095. }
  1096. alias -l jj2.aosa.load { var %ta = $1
  1097.   did -ra %ta 18 $2 | var %line = $hget(%ta,$2)
  1098.   did -ra %ta 3 $gettok(%line,1,22)
  1099.   did $iif($gettok(%line,2,22) == 1,-c,-u) %ta 8
  1100.   did -ra %ta 4 $gettok(%line,3,22) | did -r %ta 10
  1101.   var %r = 0,%s = $replace($gettok(%line,4-,22),||,$chr(22)),%total = $gettok(%s,0,124)
  1102.   while (%r < %total) { inc %r | did -i %ta 10 %r $replace($gettok(%s,%r,124),$chr(22),||) }
  1103. }
  1104. alias jj2.aosa.ex { var %opk = 0
  1105.   ;echo -s /jj2.aosa.ex $1-
  1106.   var %d = $iif($2,$2,1),%r = $iif($3,$3,0)
  1107.   if ($1 isnum) && ($1) { var %y = 0,%x,%opk = $1 | while (%y < $did(server_list,1).lines) { inc %y
  1108.   %x = $did(server_list,1,%y) | if ($tab(%x,8) == $1) { %d = %y | goto x } } | return }
  1109.   while (%d < $did(server_list,1).lines) { inc %d | :x
  1110.     var %g = 1,%i,%z | :a | %z = $tab($did(server_list,1,%d),%g) | if (%z == $null) goto b
  1111.     %i = %i $+ $chr(9) $+ $tab($did(server_list,1,%d),%g) | inc %g | goto a
  1112.     :b | tokenize 9 %i
  1113.     %jj2.aosa.name = $1 | %jj2.aosa.gametype = $2 | %jj2.aosa.player.num = $gettok($3,1,47) | %jj2.aosa.capacity = $gettok($3,2,47)
  1114.     %jj2.aosa.version = $4 | %jj2.aosa.lag = $replace($5,...,undef,-----,priv) | %jj2.aosa.ip = $6 | %jj2.aosa.id = $8
  1115.     if (sec isin $7) || (min isin $7) || (hr isin $7) var %jj2.aosa.uptime = $calc($replace($7,$chr(32),+,secs,$null,sec,$null,mins,*60,min,*60,hours,*3600,hour,*3600,days,*86400,day,*86400))
  1116.     else var %jj2.aosa.uptime = $7
  1117.     ;formato: activo (0/1) chr22 condição chr22 comandos
  1118.     if (!$hget(jj2.aosa,0).item) return | var %t
  1119.     ;echo -s $+ 1 é $+(,$1,) --- %r < $hget(jj2.aosa,0).item ?? ---
  1120.     while (%r < $hget(jj2.aosa,0).item) { inc %r
  1121.       %t = $hget(jj2.aosa,%r) | tokenize 22 %t
  1122.       if (!$2) continue
  1123.       ;if (%jj2.aosa.anysofar == 0) .timer 1 0 set %jj2.aosa.anysofar 1
  1124.       .timer 1 0 if ( $3 ) $4 $chr(124) jj2.aosa.ex $iif(%opk,%opk,normal) $calc(%d -1) %r
  1125.       ;echo -s .timer 1 0 $eval($4,2)
  1126.       ;if (!%jj2.aosa.this.aosa.sofar) %jj2.aosa.veraosa = %jj2.aosa.veraosa %r
  1127.       return
  1128.     }
  1129.     if (%opk) break | %r = 0
  1130.   }
  1131. }
  1132. alias -l saveaosa hsave -o jj2.aosa $qte($scriptdiraosa.txt)
  1133. ;Aliases de pontos
  1134. alias jj2.calcpts {
  1135.   ;Sintaxe: users,ping
  1136.   var %u = $calc($log10($calc(5* $1 +1)) * 81.565112 +20),%p
  1137.   ;calcular influência do ping
  1138.   if ($2 <= 750) %p = $calc(1.8095*10^-6* $2 * $2 -0.003224 * $2 +2)
  1139.   else %p = $calc(-1.538462*10^-4* $2 +0.715385)
  1140.   ;Factor de influência do ping: %jj2.fip ]-1;+inf[
  1141.   if (%jj2.fip == $null) || (%jj2.fip !isnum) %jj2.fip = 0
  1142.   %p = $calc((%p + %jj2.fip )/(1+ %jj2.fip))
  1143.   return $round($calc(%u * %p),0)
  1144. }
  1145. alias -l log10 return $calc($log($1) / 2.303)
  1146. ;alias aosa.integridade {
  1147. ;  var %r = 0 | while (%r < $hget(jj2.aosa,0).item) { inc %r
  1148. ;    if ($hget(jj2.aosa,%r).item !isnum) { hdel jj2.aosa $ifmatch
  1149. ;    echo -a *** AOSA table integrity: Entry $ifmatch was not a number. Deleted. }
  1150. ;  }
  1151. ;}
  1152. ;-- Conjunto de aliases adicionais --
  1153. alias -l remove.server { var %r = 1
  1154.   if ($1 == $null) { echo $color(info) -a * /remove.server: syntax is /remove.server <server id> | return }
  1155.   while (%r < $did(server_list,1).lines) { inc %r | if ($tab($did(server_list,1,%r),8) == $1) did -d server_list 1 %r }
  1156. }
  1157. alias -l set.field { var %r = 1,%s
  1158.   if ($3 == $null) { echo $color(info) -a * /set.field: Invalid Syntax (/set.field $1- $+ ). Syntax is /set.field <server id> <field num> <new value> | return }
  1159.   if ($1 !isnum) || ($2 !isnum) { echo $color(info) -a * /set.field: Invalid Syntax (/set.field $1- $+ ). Syntax is /set.field <server id> <field num> <new value> | return }
  1160.   while (%r < $did(server_list,1).lines) { inc %r | %s = $did(server_list,1,%r)
  1161.     if ($tab(%s,8) == $1) {
  1162.       did -o server_list 1 %r $puttok($tab(%s,1) $tab $tab(%s,2) $tab $tab(%s,3) $tab $tab(%s,4) $tab $tab(%s,5) $tab $tab(%s,6) $tab $tab(%s,7) $tab $tab(%s,8),$chr(32) $+ $3- $+ $chr(32),$2,9)
  1163. } } }
  1164. alias -l refresh.list the.ar
  1165. ;--
  1166. on *:dialog:warning_jj2:Sclick:*: {
  1167.   if ($did == 4) && ($did(3).state) { set %jj2.omitwarning 1 }
  1168.   elseif ($did == 7) && ($dialog(server_list)) { .timer -m 1 50 dialog -v server_list }
  1169. }
  1170.  
  1171. alias -l back { did -u $dname $did | did -c $dname 2021 }
  1172. alias -l meter.nums.nos.inputs {
  1173.   did -ra server_list 2111 $gettok(%reques,1,32)
  1174.   did -ra server_list 2112 $gettok(%reques,2,32)
  1175.   did -ra server_list 2113 $gettok(%reques,3,32)
  1176.   did -ra server_list 2114 $gettok(%reques,4,32)
  1177. }
  1178. alias -l hexbin {
  1179.   if (!$2) { echo -s $hexbin: falta o segundo parâmetro. REVER CHAMADAS A ESTE ALIAS | halt }
  1180.   if ($2 == 1) {
  1181.     var %r = 0,%t,%neq | while (%r < 4) { inc %r | %neq = $gettok($1,%r,32)
  1182.     %t = %t $base(%neq,16,10) } | return %t
  1183.   }
  1184.   elseif ($2 == 2) {
  1185.     var %r = 0,%t,%neq | while (%r < 4) { inc %r | %neq = $gettok($1,%r,32)
  1186.     %t = %t $iif($len($base(%neq,10,16)) == 1,0 $+ $base(%neq,10,16),$base(%neq,10,16)) } | return %t
  1187.   }
  1188. }
  1189.  
  1190. alias changecp { var %dia = server_list
  1191.   if ($did(2029).state) { did -ra %dia 2101 Blaster | did -ra %dia 2102 Limbs, Ears
  1192.   did -ra %dia 2103 Feet, Wristband | did -ra %dia 2104 Chest, Face }
  1193.   elseif ($did(2030).state) { did -ra %dia 2101 Body | did -ra %dia 2102 Headband
  1194.   did -ra %dia 2103 Blaster | did -ra %dia 2104 Wrist band }
  1195.   elseif ($did(2031).state) { did -ra %dia 2101 Eyes | did -ra %dia 2102 Blaster edge
  1196.   did -ra %dia 2103 Blaster | did -ra %dia 2104 Body }
  1197.   else { did -ra %dia 2101 #1 | did -ra %dia 2102 #2 |  did -ra %dia 2103 #3
  1198.   did -ra %dia 2104 #4 }
  1199. }
  1200. alias -l cfi {
  1201.   if ($int($$1) != $$1) return $false
  1202.   if ($1 < 0) return $false
  1203.   if ($1 > 255) return $false
  1204.   if ($len($1) > 3) { return $false }
  1205.   return $true
  1206. }
  1207.  
  1208. on *:dialog:enter_ip:*:*: {
  1209.   if ($devent == init) {
  1210.     if (!$inst1.23) did -b $dname 821
  1211.     if (!$inst1.24) did -b $dname 822
  1212.     if (!$inst1.24x) did -b $dname 823
  1213.   }
  1214.   elseif ($devent == sclick) && ($did == 850) {
  1215.     ;1.23 = ID 821, 1.24 = ID 822, 1.24 x = ID 823
  1216.     if ($did(821).state) run %path.121 -connect $did(849) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record)
  1217.     elseif ($did(822).state) run %path.124 -connect $did(849) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record)
  1218.     elseif ($did(823).state) run %path.124x -connect $did(849) $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record)
  1219.     else did -ra $dname 840 Select a version!
  1220.   }
  1221. }
  1222. alias -l stat return $qte($scriptdirstatistics.ini)
  1223. alias -l incva return $2 $calc($iif(!$readini($stat,$1,$2),0,$readini($stat,$1,$2)) +1)
  1224. alias -l getsv return $readini($stat,$1,$2)
  1225. alias -l writestat {
  1226.   if ($1 == join) goto join
  1227.   else goto serve
  1228.   :join | var %st = $did(server_list,1).seltext | if ($2) %st = $did(server_list,1,$2)
  1229.   writeini $stat $1 $incva($1,$replace($remove($tab(%st,4),$chr(32),s),1.21,1.23))
  1230.   var %type = $remove($tab(%st,2),-) | if (!%type) %type = ??
  1231.   writeini $stat $1 $incva($1,%type) | return
  1232.   :serve | writeini $stat $1 $incva($1,%lastversion)
  1233.   writeini $stat $1 $incva($1,$remove(%lastgmode,-))
  1234. }
  1235. alias jj2.statistics jj2.stat $1-
  1236. alias stat.jj2 jj2.stat $1-
  1237. alias -l pcmaker { var %a = $round($calc((100* $1)/($1 + $2 + $3 + $4 + $5)),0) $+ % | return $iif(%a != %,%a,0%) }
  1238. alias jj2.stat {
  1239.   var %joined1.23 = $getsv(join,1.23),%joined1.24 = $getsv(join,1.24),%joined1.24x = $getsv(join,1.24x)
  1240.   var %totjoined = $calc(%joined1.23 + %joined1.24 + %joined1.24x)
  1241.   var %served1.23 = $getsv(serve,1.23),%served1.24 = $getsv(serve,1.24)
  1242.   var %totserved = $calc(%served1.23 + %served1.24)
  1243.   var %pcjoined = $pcmaker(%totjoined,%totserved)
  1244.   var %pcserved = $pcmaker(%totserved,%totjoined)
  1245.   var %pcserved1.23 = $pcmaker(%served1.23,%served1.24),%pcserved1.24 = $pcmaker(%served1.24,%served1.23)
  1246.   var %pcjoined1.23 = $pcmaker(%joined1.23,%joined1.24,%joined1.24x),%pcjoined1.24 = $pcmaker(%joined1.24,%joined1.23,%joined1.24x)
  1247.   var %joinedbattle = $getsv(join,battle),%joinedctf = $getsv(join,ctf)
  1248.   var %joinedtreas = $getsv(join,treas),%joinedctf = $getsv(join,race),%joinedcoop = $getsv(join,coop)
  1249.   var %pcjbattle = $pcmaker(%joinedbattle,%joinedctf,%joinedtreas,%joinedrace,%joinedcoop)
  1250.   var %pcjctf = $pcmaker(%joinedctf,%joinedbattle,%joinedtreas,%joinedrace,%joinedcoop)
  1251.  
  1252.   var %servedbattle = $getsv(serve,battle),%servedctf = $getsv(serve,ctf)
  1253.   var %servedtreas = $getsv(serve,treas),%servedrace = $getsv(serve,race),%servedcoop = $getsv(serve,coop)
  1254.   var %pcsbattle = $pcmaker(%servedbattle,%servedctf,%servedtreas,%servedrace,%servedcoop)
  1255.   var %pcsctf = $pcmaker(%servedctf,%servedbattle,%servedtreas,%servedrace,%servedcoop)
  1256.   if ($active == $(Status Window)) || (@* iswm $active) { echo -a *** Please use this command only on channels and queries | return }
  1257.   say  $+ JJ2 add-on v $+ $s.version statistics $+ : Joined:  $+ %totjoined $+  ( $+ %pcjoined $+ ) $&
  1258.     $chr(91) $+ %pcjoined1.23 1.23, %pcjoined1.24 1.24 :: %pcjbattle Battle, %pcjctf CTF $+ $chr(93) $&
  1259.     Served:  $+ %totserved $+  ( $+ %pcserved $+ ) $&
  1260.     $chr(91) $+ %pcserved1.23 1.23, %pcserved1.24 1.24 :: %pcsbattle Battle, %pcsctf CTF $+ $chr(93)
  1261. }
  1262. alias -l joinser { var %st = $did(server_list,1).seltext
  1263.   if ($1) %st = $did(server_list,1,$1)
  1264.   if (%st == $null) { did -ra server_list 500 ERROR: You did not pick a server... | halt }
  1265.   did -u server_list 3 | var %ip = $tab(%st,6)
  1266.   if (%ip == PRIVATE) { did -ra server_list 500 ERROR: Private servers are NOT supported! | halt }
  1267.   elseif ($tab(%st,4) == 1.24 x) {
  1268.     if ($inst1.24x) {
  1269.       run %path.124x -connect %ip $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record)
  1270.       writestat join $1 | return
  1271.     }
  1272.     else { did -ra server_list 500 ERROR: You did not specify the location for 1.24 x jazz2.exe | halt }
  1273.   }
  1274.   if ($tab(%st,4) == 1.21) || ($tab(%st,4) == 1.21 s) {
  1275.     if ($inst1.23) {
  1276.       run %path.121 -connect %ip $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record) | writestat join $1
  1277.       colorctf 1.23 | return
  1278.     }
  1279.     else { did -ra server_list 500 ERROR: You did not specify the location for 1.23 jazz2.exe | halt }
  1280.   }
  1281.   elseif ($tab(%st,4) == 1.24) || ($tab(%st,4) == 1.24 s) {
  1282.     if ($inst1.24) {
  1283.       run %path.124 -connect %ip $iif(%jj2.spy,-spy,-nospy) $iif($did(server_list,2001).state,-record) | writestat join $1
  1284.       colorctf 1.24 | return
  1285.     }
  1286.     else { did -ra server_list 500 ERROR: You did not specify the location for 1.24 jazz2.exe | halt }
  1287.   }
  1288.   elseif ($tab(%st,4) == 1.23) { did -ra server_list 500 ERROR: Holiday Hare '98 servers are NOT supported! | halt }
  1289.   elseif ($tab(%st,4) == ??) {
  1290.   var %a = $dialog(unk,unk) | halt }
  1291.   else { did -ra server_list 500 ERROR: Unknown version ( $+ $tab(%st,4) $+ ) | halt }
  1292. }
  1293. alias -l colorctf {
  1294.   if (!%jj2.colorctf) || (!$1) return
  1295.   if (!$2) && ($tab($did(server_list,1).seltext,2) != ctf) return
  1296.   set %jj2.realname $ler.entrada(Name,$1)
  1297.   .echo -q $dll($scriptdirregistry.dll,SetKeyValue,REG_SZ HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Name [ $cr ] $remove(%jj2.realname,|))
  1298.   .timersetrealname 1 5 .echo -q $!dll($scriptdirregistry.dll,SetKeyValue,REG_SZ HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2 $+ $iif($1 == 1.24,$chr(32) $+ Special Edition) $+ \ $+ $1 $+ \Player0\\Name [ $cr ] $eval(%jj2.realname,0) )
  1299. }
  1300.  
  1301. ;==============================
  1302. ;------ List my Server! -------
  1303. ;==============================
  1304. ;Ver mais sobre o list server no on dialog event geral do server_list
  1305. alias spacy { set %w 1 | set %lc $left($1-,1) | :j | inc %w
  1306.   if ($right($left($1-,%w),1) == $right($1-,1)) return %lc $+ $chr(160) $+ $right($1-,1)
  1307.   set %lc %lc $+ $chr(160) $+ $right($left($1-,%w),1) |  goto j
  1308. }
  1309. on *:sockopen:listms: {
  1310.   if ($sock($sockname).status == connecting) {
  1311.     did -ra server_list 1031 Unable to connect to the list server.
  1312.   did -ra server_list 1034 List Server | return }
  1313.   did -ra server_list 1031 Connected! Preparing data...
  1314.   if ($did(server_list,1011).state == 1) { .copy -o $qte($scriptdirbattle.srv) $temp2s | bwrite $temp2s 2 -1 $did(server_list,1017).text }
  1315.   elseif ($did(server_list,1012).state == 1) { .copy -o $qte($scriptdirCTF.srv) $temp2s | bwrite $temp2s 2 -1 $did(server_list,1017).text }
  1316.   elseif ($did(server_list,1013).state == 1) { .copy -o $qte($scriptdirtreasure.srv) $temp2s | bwrite $temp2s 2 -1 $did(server_list,1017).text }
  1317.   elseif ($did(server_list,1014).state == 1) { .copy -o $qte($scriptdirother.srv) $temp2s | bwrite $temp2s 2 -1 $did(server_list,1017).text -> Coop }
  1318.   elseif ($did(server_list,1015).state == 1) { .copy -o $qte($scriptdirother.srv) $temp2s | bwrite $temp2s 2 -1 $did(server_list,1017).text -> Race }
  1319.   else { echo -s Unknown Error | halt }
  1320.   if ($ver.sel == 1.23) bwrite $temp2s 38 2 00
  1321.   elseif ($ver.sel == 1.24) bwrite $temp2s 38 2 24
  1322.   else { echo -s Unknown error | halt }
  1323.   bread $temp2s 0 $file($temp2s).size &info
  1324.   did -ra server_list 1031 Sending data to list server...
  1325.   sockwrite listms &info
  1326.   did -ra server_list 1031 Done
  1327.   did -ra server_list 1034 Delist Server
  1328. }
  1329. alias -l temp2s return $qte($scriptdirtemp2.srv)
  1330. alias -l rep {
  1331.   ;$rep(variável,subs no caso de n se verificar nenhum,hip1~res1,hip2~res2,etc.)
  1332.   IF (!$2) return $null
  1333.   IF (!$3) return $2
  1334.   var %kis = 3 | :ui | if ($gettok( [ $chr(36) $+ [ %kis ] ] ,1,126) == $1) {
  1335.     if ($gettok( [ $chr(36) $+ [ %kis ] ] ,2,126) == null) { return $null }
  1336.     else return $gettok( [ $chr(36) $+ [ %kis ] ] ,2,126)
  1337.   }
  1338.   if ( [ $chr(36) $+ [ $calc(%kis +1) ] ] == $null) {
  1339.     if ($2 == null) return $null
  1340.     else return $2
  1341.   }
  1342.   inc %kis | goto ui
  1343. }
  1344. menu menubar,channel,status,query {
  1345.   JJ2 add-on v $+ $s.version
  1346.   .Start:readsl
  1347.   .-
  1348.   .Say Statistics:jj2.stat
  1349.   .-
  1350.   .Version paths
  1351.   ..1.23 - $iif(%path.121 == $null,none,%path.121) : set %path.121 $sfile(c:\,Select your Jazz2 executble for version 1.23)
  1352.   ..1.24 - $iif(%path.124 == $null,none,%path.124) : set %path.124 $sfile(c:\,Select your Jazz2 executble for version 1.24)
  1353.   ..1.24 x - $iif(%path.124x == $null,none,%path.124x) : set %path.124x $sfile(c:\,Select your Jazz2 executble for version 1.24 x)
  1354.   ..-
  1355.   ..I haven't got 1.23: set %path.121 none
  1356.   ..I haven't got 1.24: set %path.124 none
  1357.   ..I haven't got 1.24 x: set %path.124x none
  1358.   ..Using $iif(%listserver == $null,not defined,%listserver):halt
  1359.   ..-
  1360.   ..Use jazz.contrabandent.com:set %listserver jazz.contrabandent.com
  1361.   ..Use jazz.nimrod-online.com:set %listserver jazz.nimrod-online.com
  1362.   ..Other...:set %listserver $$?="Write the IP/host of the list server"
  1363.   ..-
  1364.   ..List Server Statistics:listss
  1365.   .Unjoinable Servers
  1366.   ..Show Error $iif((%unse != dibu) && (%unse != hide),[×],$deac):set %unse sher
  1367.   ..Dis Join Button $iif(%unse == dibu,[×],$deac):set %unse dibu
  1368.   ..Hide Servers $iif(%unse == hide,[×],$deac):set %unse hide
  1369.   .Updates
  1370.   ..Auto C-4-Updates $+ $chr(58) $iif(%jj2.cfu == on,On,OFF):set %jj2.cfu $iif(%jj2.cfu == on,off,on)
  1371.   ..-
  1372.   ..Check Now!:check4updates warn
  1373.   ..-
  1374.   ..Update method $+  $chr(58) $iif(%jj2.pro == manual,Manual,Auto):set %jj2.pro $iif(%jj2.pro == Manual,Auto,Manual)
  1375.   .Move cache files into jj2 dir
  1376.   ..$iif((%path.121 != none) && (%path.121),1.23):moveall $qte($nofile(%path.121) $+ cache\) $qte($nofile(%path.121))
  1377.   ..$iif((%path.124 != none) && (%path.124),TSF):moveall $qte($nofile(%path.124) $+ cache\) $qte($nofile(%path.124))
  1378.   .Shortcuts
  1379.   ..Status $+ $chr(58) $iif($crcuR(status),On,OFF):crcuW status $iif($crcuR(status),0,1)
  1380.   ..-
  1381.   ..Costumise...
  1382.   ;In order to mantain compatibility with 5.91, I am not going to use $submenu
  1383.   ...1. $crcu(1):aliasdosatalhos 1
  1384.   ...2. $crcu(2):aliasdosatalhos 2
  1385.   ...3. $crcu(3):aliasdosatalhos 3
  1386.   ...4. $crcu(4):aliasdosatalhos 4
  1387.   ...5. $crcu(5):aliasdosatalhos 5
  1388.   ...6. $crcu(6):aliasdosatalhos 6
  1389.   ...7. $crcu(7):aliasdosatalhos 7
  1390.   ...8. $crcu(8):aliasdosatalhos 8
  1391.   ...9. $crcu(9):aliasdosatalhos 9
  1392.   ...-
  1393.   ...Reset:var %a = $?!="Are you sure you want to reset your shortcuts?" | if (%a) resetcc
  1394.  
  1395.   .Automatic On Server Actions
  1396.   ..Create New:jj2.aosa.edit
  1397.   ..-
  1398.   ..$submenu($aosamenu($1))
  1399.   ..-
  1400.   ..List on Status (mIRC 5.91):jj2.aosa.list
  1401.   ..-
  1402.   ..Download Default AOSA: { if (!$isfile($scriptdircache\jj2u.ini)) { echo -a *** A required file is not present. | return }
  1403.   jj2upd $readini($scriptdircache\jj2u.ini,jj2,aosa) $qte($scriptdiraosa.txt) jj2.hloadaosa }
  1404.   ..Backup AOSA hash table: { var %r = 1 | while ($exists($+($scriptdiraosa.b,%r))) { inc %r }
  1405.   copy -o $qte($scriptdiraosa.txt) $qte($scriptdiraosa.b $+ %r) }
  1406.  
  1407.   .Server Points
  1408.   ..Rebuild AOSA entries: { var %a = $input(This will replace AOSA entries #1 and #2. Are you sure?,136,JJ2 add-on for mIRC) | if (%a) rebuildaosa }
  1409.   ..Show Points after Server Name $iif(%jj2.shpts,[×],$deac):set %jj2.shpts $iif(%jj2.shpts,0,1)
  1410.   ..Min. Points to join automatically $+([,$iif(%jj2.ptsmin,%jj2.ptsmin,0),]):set %jj2.ptsmin $$input(Enter the minimum number of points the best server must have in order to be joined if the B button is activated.,1,JJ2 add-on for mIRC,$iif(%jj2.ptsmin,%jj2.ptsmin,175))
  1411.   ..Change Ping Influence
  1412.   ...Status $+ $chr(58) $rep(%jj2.fip,Costum $+ $chr(58) %jj2.fip,500~No Influence,8~Very Low Influence,4~Low Influence,1~Moderately Low Influence,0~Normal,-0.3~Moderately High Influence,-0.5~High Influence,-0.7~Very High Influence):.echo -q a
  1413.   ...-
  1414.   ...No Influence:set %jj2.fip 500
  1415.   ...Very Low Influence:set %jj2.fip 8
  1416.   ...Low Influence:set %jj2.fip 4
  1417.   ...Moderately Low Influence:set %jj2.fip 1
  1418.   ...Normal:set %jj2.fip 0
  1419.   ...Moderately High Influence:set %jj2.fip -0.3
  1420.   ...High Influence:set %jj2.fip -0.5
  1421.   ...Very High Influence:set %jj2.fip -0.07
  1422.  
  1423.   .$(S.I.) bot name
  1424.   ..Use default $iif(%jj2.botname == $null,[×],$deac):unset %jj2.botname
  1425.   ..Show empty line $iif(%jj2.botname == $blanklinename,[×],$deac):set %jj2.botname $blanklinename
  1426.   ..Set costum $iif((%jj2.botname != $blanklinename) && (%jj2.botname != $null),$chr(91) $+ %jj2.botname $+ $chr(93),$deac): {
  1427.     var %a = %jj2.botname | if (%a == $blanklinename) || (%a == $null) %a = JJ2 add-on S.I. bot
  1428.     %jj2.botname = $$input(Enter the name for the S.I. bot. $crlf $+ ATTENTION: SOME NAMES MAY CRASH OR FREEZE THE JJ2 SERVER. MAKE SURE YOU TEST THEM.,1,JJ2 add-on for mIRC,%a)
  1429.   }
  1430.   .Auto-refresh list $+ $chr(58) $iif(%jj2.ar isnum 1-,%jj2.ar secs,deactivated):set %jj2.ar $input(Enter the delay between the refreshes (secs); enter nothing to deactivate,1,JJ2 add-on for mIRC,$iif(%jj2.ar,%jj2.ar,60))
  1431.   .S.I. permissive mode $+ $chr(58) $iif(%jj2.permissive,[×],$deac):set %jj2.permissive $iif(%jj2.permissive,0,1)  
  1432.   .Auto LVL list build $+ $chr(58) $iif(%jj2.buildls,[×],$deac):set %jj2.buildls $iif(%jj2.buildls,0,1)
  1433.   .Show Desktop wins $+ $chr(58) $iif(%jj2.desktop,[×],$deac):set %jj2.desktop $iif(%jj2.desktop,0,1)
  1434.   .Participate in Stats $+ $chr(58) $iif(%jj2.statistics != 0,[×],$deac):set %jj2.statistics $iif(%jj2.statistics != 0,0,1)
  1435.   .Use Spy $+ $chr(58) $iif(%jj2.spy,[×],$deac):set %jj2.spy $iif(%jj2.spy,0,1)
  1436.   .Do not use colors w/ CTF $+ $chr(58) $iif(%jj2.colorctf,[×],$deac):set %jj2.colorctf $iif(%jj2.colorctf,0,1)
  1437.   .Confirm .ini overwrite $+ $chr(58) $iif(%jj2.confover,[×],$deac):set %jj2.confover $iif(%jj2.confover,0,1)
  1438.   .$iif($version != 5.91,Do not load Tooltips $+ $chr(58) $iif(%jj2.toolt,[×],$deac)):set %jj2.toolt $iif(%jj2.toolt,0,1)
  1439.   .Run Script Dir:run $qte($scriptdir)
  1440.   .Read Readme.txt:run $qte($scriptdirreadme.txt)
  1441. }
  1442. alias -l aosamenu {
  1443.   if ($1 isnum) { if (!$hget(jj2.aosa,$1)) return | return $1 $+ . $gettok($hget(jj2.aosa,$1),1,22) :jj2.aosa.edit $1 }
  1444. }
  1445. alias jj2.aosa.list {
  1446.   echo -s -- Entries for AOSA --
  1447.   var %r = 0,%s | :a | inc %r | %s = $gettok($hget(jj2.aosa,%r),1,22)
  1448.   if (!%s) goto b | echo -s %r $+ . %s | goto a
  1449.   :b
  1450.   echo -s -- End of the list --
  1451.   echo -s Type /jj2.aosa.edit <number/name> to edit/delete the specified entry
  1452. }
  1453. alias -l blanklinename return §È ddddddd
  1454. alias -l deac return $+(,[,$chr(32),])
  1455. alias -l aliasdosatalhos crcuW $1 $$input(The actual command is $iif($crcuC($1),$qte($crcuC($1)),not defined) $+ . $+ $cr $+ Type the new one after having typed the button text followed by an asterisk. $cr $+ e.g.: JCS*run c:\games\jazz2\jcs.exe,1,JJ2 add-on)
  1456. alias -l listss { if ($dialog(listss)) dialog -av listss
  1457.   if (!%listserver) { .timer 1 0 .echo -q $input(You must specify a list server before.,516,JJ2 add-on) | return }
  1458.   dialog -m listss listss
  1459. }
  1460. alias -l moveall { tokenize 63 $gettok($1-,1,34) $+ ? $+ $gettok($1-,3,34)
  1461.   ;Cuidado com os chamamentos através de scripts. É perigoso supor que o alias já fez
  1462.   ;o que lhe foi pedido imediatamente após o chamamento.
  1463.   ;Se for o caso, certificar-se de que os paths terminam em "\"
  1464.   var %1,%2
  1465.   if (!$isdir($1)) || (!$isdir($2)) { echo $color(info) -s * /moveall: um dos directórios especificados não é | halt }
  1466.   if ($right($1,1) != \) %1 = $1 $+ \
  1467.   if ($right($2,1) != \) %2 = $2 $+ \
  1468.   if (%2) || (%1) { .timermoveall 1 0 $qte(%1) $qte(%2) | return }
  1469.   var %1 = $1,%2 = $2,%cont = 0
  1470.   .echo -q $findfile(%1,*,0,1,if (!$exists(%2 $+ $nopath($1-))) [ $chr(123) ] .copy $qte($1-) %2 [ $chr(124) ] inc %cont [ $chr(124) ] .remove $qte($1-) [ $chr(125) ] )
  1471.   echo $color(info) -s  * /moveall: A total of %cont files was moved
  1472. }
  1473. alias rebuildaosa {
  1474.   hadd -m jj2.aosa 1 $eval(markpts1(%jj2.aosa.lag != priv) && (%jj2.aosa.lag != undef) && ($istok(battle ctf,%jj2.aosa.gametype,32))hadd -m jj2.pts %jj2.aosa.id $jj2.calcpts(%jj2.aosa.player.num,%jj2.aosa.lag),0)
  1475.   hadd -m jj2.aosa 2 $eval(showpts1($hget(jj2.pts,%jj2.aosa.id)) && (%jj2.shpts)set.field %jj2.aosa.id 1 %jj2.aosa.name ( $+ $hget(jj2.pts,%jj2.aosa.id) pts),0)
  1476. saveaosa }
  1477. alias jj2.hloadaosa { hload jj2.aosa $shortfn($scriptdiraosa.txt) | echo -a *** Loaded AOSA file. }
  1478. on *:dialog:listss:init:*: { did -ra $dname 1 Connecting to %listserver $+ :10055 | sockopen listss %listserver 10055 | .remove $qte($scriptdircache\onrush.txt) }
  1479. on *:sockopen:listss: {
  1480.   if ($sock($sockname).status == connecting) did -ra listss 1 Connection failed!
  1481.   else did -ra listss 1 Connected!
  1482. }
  1483. on *:sockread:listss: {
  1484.   if ($sockerr > 0) return
  1485.   :binary
  1486.   sockread &tvar
  1487.   if ($sockbr == 0) return
  1488.   bwrite $qte($scriptdircache\onrush.txt) -1 &tvar
  1489.   goto binary
  1490. }
  1491. on *:sockclose:listss: { if ($file($scriptdircache\onrush.txt) > 0) { loadbuf -o listss 2 $qte($scriptdircache\onrush.txt) | did -ra listss 1 Done. } | else did -ra listss 1 An error has occurred. | .remove $qte($scriptdircache\onrush.txt) }
  1492.  
  1493. alias -l hideorshowshtc {
  1494.   var %sl = server_list
  1495.   ;min: 240 dbu; max: 288 dbu
  1496.   if ($1) { did -ra %sl 1510,1511 $iif($did(%sl,1510) == <,>,<)
  1497.     if ($did(%sl,1510) == >) { .timerjj2.hossth off | %jj2.hossth = shrink }
  1498.     else { .timerjj2.hossth off | %jj2.hossth = enlarge }
  1499.   }
  1500.   if ($cpixdbu($dialog(%sl).cw) <= 240) && (%jj2.hossth == shrink) return
  1501.   if ($cpixdbu($dialog(%sl).cw) >= 288) && (%jj2.hossth == enlarge) return
  1502.   .timerjj2.hossth -m 1 20 dialog -sb %sl $dialog(%sl).x $dialog(%sl).y $iif(%jj2.hossth == shrink,$calc($cpixdbu($dialog(%sl).cw) -2),$calc($cpixdbu($dialog(%sl).cw) +2)) 162 $chr(124) hideorshowshtc
  1503. }
  1504. alias -l cpixdbu return $calc($1 / $dbuw)
  1505.  
  1506. ;==================
  1507. ;---- Updates -----
  1508. ;==================
  1509. on *:start: {
  1510.   unset %jj2u.* | unset %jj2k.*
  1511.   if (%jj2.buildls) { dialog -m loadlists loadlists
  1512.     .timer 1 1 if ($inst1.24) buildl 1.24 $chr(124) if ($inst1.23) buildl 1.23 $chr(124) dialog -x loadlists
  1513.     if (%jj2.order == fn) || (%jj2.order == ln) { jj2.order 1.23 %jj2.order | jj2.order 1.24 %jj2.order }
  1514.   }
  1515.   if (!$hget(jj2.aosa)) hmake jj2.aosa 15 | if ($isfile($scriptdiraosa.txt)) hload jj2.aosa $qte($scriptdiraosa.txt)
  1516.   if (%jj2.cfu == on) check4updates
  1517.   else statistics
  1518. }
  1519. dialog loadlists {
  1520.   title "Loading..."
  1521.   size -1 -1 104 32
  1522.   option dbu
  1523.   icon %iconsl, 0
  1524.   text "Building level lists...", 1, 3 4 46 7
  1525.   text "Wait a moment, please...", 2, 3 11 67 8
  1526.   text "You may deactivate this automatic loading.", 3, 3 23 112 7
  1527.   button "", 4, 0 0 0 6, hide ok cancel
  1528. }
  1529.  
  1530. ;código para a contagem de utilizadores
  1531. alias -l statistics {
  1532.   if (%jj2.statistics != 0) {
  1533.     if (!%jj2.runtimes) jj2upd http://www.cataphract.tk:80/ $qte($scriptdircache\lixo.txt) incruntimes
  1534.     else jj2upd http://www.aleger.tk/ $qte($scriptdircache\lixo.txt) incruntimes
  1535.   }
  1536. }
  1537. alias -l incruntimes inc %jj2.runtimes
  1538. ;Adaptado do HTDL v1.1 by Cataphract
  1539. alias -l data2 return $qte($scriptdircache\data2.txt)
  1540. on *:sockread:jj2u: {
  1541.   if ($sockerr > 0) return | :header
  1542.   if (%jj2u.binary == yes) goto binary
  1543.   sockread %temp | tokenize 32 %temp | write $qte($scriptdircache\infoadicional.txt) %temp
  1544.   if ($sockbr == 0) return
  1545.   if (%temp == $null) { %jj2u.binary = yes | goto binary }
  1546.   if (HTTP/* iswm %temp) && ($2 != 200) { echo -a *** The HTTP server ( $+ $sock($sockname).ip $+ ) has sent an unexpected response. Details: $1- | sockclose $sockname | return }
  1547.   elseif (Content-Length:* iswm %temp) set %jj2u.len $2
  1548.   goto header
  1549.  
  1550.   :binary
  1551.   sockread &tvar
  1552.   if ($sockbr == 0) return
  1553.   bwrite $qte(%jj2u.desfile) -1 &tvar
  1554.   if ((%jj2u.len == $file(%jj2u.desfile)) && (%jj2u.len)) { sockclose jj2u | .timer 1 1 %jj2u.fc | return }
  1555.   goto binary
  1556. }
  1557.  
  1558. on *:sockopen:jj2u: { if ($sock($sockname).status == connecting) { echo -a *** Unable to connect to the HTTP server. IP: $sock($sockname).ip | halt }
  1559.   bread $data2 0 $file($data2).size &a | sockwrite $sockname &a
  1560. }
  1561. on *:sockclose:jj2u: {
  1562.   if ($file(%jj2u.desfile) == $null) { echo -s *** Error: The server has closed the connection before sending the file (if so, try again later)? Poor scripting :) ? | return }
  1563.   if ((%jj2u.len == $file(%jj2u.desfile)) && (%jj2u.len)) || (!%jj2u.len) { .timer 1 1 %jj2u.fc }
  1564.   else { echo -a *** File size mismatch: %jj2u.len bytes <--> $file(%jj2u.desfile).size $+ bytes! }
  1565. }
  1566.  
  1567. alias jj2upd {
  1568.   if ($(http:* "*:*"*) iswm $1-) tokenize 63 $1 $+ ? $+ $gettok($1-,2,$asc(")) $+ ? $+ $gettok($1-,3-,$asc("))
  1569.   ;echo -s 1: $1 ;;; 2: $2 ;;; 3: $3
  1570.   ;/jj2upd <url> <desfile> <comando>
  1571.   if (http://* !iswm $1) { echo -a *** O ficheiro pedido para download ( $+ $iif(!$1,não especificado,$1) $+ ) vem com um endereço inválido. | halt }
  1572.   write -c $data2 GET $relpath($1) HTTP/1.1
  1573.   write $data2 Accept: */*
  1574.   write $data2 Referer: $1
  1575.   write $data2 Accept-Encoding: gzip, deflate
  1576.   write $data2 User-Agent: HTDL v1.1 by Cataphract (adaptado)
  1577.   write $data2 Host: $host($1) | write $data2 Connection: Keep-Alive
  1578.   write $data2 $chr(10) | var %b = %jj2u.warn | unset %jj2u.* | %jj2u.desfile = $2 | %jj2u.fc = $3-
  1579.   %jj2u.warn = %b | .remove $qte(%jj2u.desfile)
  1580. .remove $qte($scriptdircache\infoadicional.txt) | sockopen jj2u $host($1) $porta($1) }
  1581.  
  1582. alias -l host return $gettok($gettok($1,2,47),1,58)
  1583. alias -l relpath return / $+ $gettok($1,3-,47)
  1584. alias -l porta return $iif($gettok($gettok($1,2,47),2,58),$gettok($gettok($1,2,47),2,58),80)
  1585. alias -l filename return $gettok($1,$count($1,$chr(47)),47)
  1586.  
  1587. alias check4updates {
  1588.   if ($1 == warn) set %jj2u.warn 1
  1589.   jj2upd http://pwp.netcabo.pt:80/0149486101/jj2/jj2u.ini $qte($scriptdircache\jj2u.ini) infofile
  1590. }
  1591. alias -l infofile {
  1592.   if ($readini(%jj2u.desfile,news,id) != %jj2.lastid) { set %jj2.lastid $readini(%jj2u.desfile,news,id)
  1593.     window -aCrk0 @JJ2 10 10 300 150 | titlebar @JJ2 Add-on News
  1594.     var %r = 0,%t | :a | inc %r | %t = $readini(%jj2u.desfile,news,%r) | if (!%t) { sline @JJ2 4 | goto c } | echo @JJ2 %t | goto a
  1595.   }
  1596.   :c
  1597.   if ($s.version < $readini(%jj2u.desfile,jj2,latestversion)) .timerpedirupdate 1 0 pedirupdate
  1598.   elseif (%jj2u.warn) { var %a = $input(You have the latest version. $crlf $+ No Updates available.,68,JJ2 add-on) | unset %jj2u.warn }
  1599.   else statistics
  1600. }
  1601.  
  1602. alias -l pedirupdate {
  1603.   if (%jj2.pro == Manual) var %msg = Your 'JJ2 mIRC add-on' version seems to be out of date. Shall I take you to the HTTP location from where you can download it?
  1604.   else var %msg = Your 'JJ2 mIRC add-on' version seems to be out of date. Shall I download and install the latest one?
  1605.   %a = $input(%msg,136,JJ2 add-on)
  1606.   if (%a) { if (%jj2.pro == Manual) url $readini(%jj2u.desfile,jj2,manual)
  1607.     else { %jj2k.num = 1 | jj2upd $readini(%jj2u.desfile,jj2,1) $qte($scriptdircache\ $+ $filename($readini(%jj2u.desfile,jj2,1))) nextdfile
  1608.       .timer 1 0 var %c = $input(The downloading of the files may take some time. If the new version is not loaded within two/three minutes $+ $chr(44) please request the update once more,68,JJ2 add-on)
  1609.     }
  1610.   }
  1611. }
  1612. alias -l nextdfile { :beg | inc %jj2k.num | var %b = $readini($scriptdircache\jj2u.ini,jj2,%jj2k.num)
  1613.   if ($readini($scriptdircache\jj2u.ini,jj2,%jj2k.num $+ p) == skip) && ($isfile($scriptdir $+ $filename(%b))) { goto beg }
  1614.   if (!%b) { var %t = 1
  1615.     while ($readini($scriptdircache\jj2u.ini,jj2,%t)) {
  1616.     if ($readini($scriptdircache\jj2u.ini,jj2,%t $+ p) != skip) .copy -o $qte($scriptdircache\ $+ $filename($readini($scriptdircache\jj2u.ini,jj2,%t))) $qte($scriptdir) | inc %t }
  1617.     .timer 1 1 load -rs $qte($scriptdir $+ $readini($scriptdircache\jj2u.ini,jj2,script)) | .unload -rs $qte($script) | halt
  1618.   }
  1619.   jj2upd %b $qte($scriptdircache\ $+ $filename(%b)) nextdfile
  1620. }
  1621. alias sdisplay {
  1622.   if ($1 == $null) return 0 bytes*
  1623.   elseif ($1 < 1024) return $1 bytes
  1624.   elseif ($1 < $calc(2^20)) return $round($calc($1 / $calc(2^10)),2) KB
  1625.   elseif ($1 < $calc(2^30)) return $round($calc($1 / $calc(2^20)),2) MB
  1626.   else return $round($calc($1 / $calc(2^30)),2) GB
  1627. }
  1628. ;Fim dos Updates
  1629. ;
  1630. ;Server Info
  1631. dialog ser_i_p {
  1632.   title "JJ2 Add-on: Regarding Server Info"
  1633.   size -1 -1 162 60
  1634.   option dbu
  1635.   text "Please do not use this feature for  reprehensible purposes such as 'cloning'.  Use it only for educational ends. Otherwise,  make sure you have the consent of the implicated player.", 2, 7 11 150 21
  1636.   check "Omit this box in the future.", 3, 3 36 68 9
  1637.   button "I Agree", 4, 3 46 96 10,ok
  1638.   box "Purpose", 6, 3 4 156 30
  1639.   button "Go Back", 7, 105 46 53 10,cancel
  1640.   edit "ok",20,1 1 1 1,hide result
  1641. }
  1642. on *:dialog:ser_i_p:Sclick:*: {
  1643.   if ($did == 4) && ($did(3).state) { set %jj2.omitpur 1 }
  1644.   elseif ($did == 7) && ($dialog(server_list)) { .timer -m 1 50 dialog -v server_list }
  1645. }
  1646. dialog ser_i {
  1647.   title "Server Information"
  1648.   size -1 -1 166 126
  1649.   option dbu
  1650.   icon %iconsl
  1651.   list 1, 8 34 146 62, size
  1652.   edit "", 2, 84 10 56 10
  1653.   box "Level", 3, 4 2 158 22
  1654.   box "Player List", 4, 4 26 158 76
  1655.   button "Save Settings", 5, 3 110 50 10, disable
  1656.   button "Close", 6, 111 110 50 10, default cancel
  1657.   text "Filename of the level:", 7, 8 12 52 6
  1658.   button "Join This Server", 8, 57 110 50 10
  1659. }
  1660. on *:dialog:ser_i:*:*: {
  1661.   if ($devent == init) { mdx.start | loadtooltips $dname
  1662.     set %a $mdx(SetControlMDX,1 listview rowselect single flatsb showsel report nosortheader > [ $mdx.vdll ] )
  1663.     did -i $dname 1 1 headerdims 24:1 120:2 50:3 90:4
  1664.     did -i $dname 1 1 headertext $+(ID,$tab,Player Name,$tab,Char,$tab,Fur Colors)
  1665.   }
  1666.   elseif ($devent == sclick) {
  1667.     if ($did == 1) {
  1668.       if (!$did(1).seltext) did -b $dname 5
  1669.       else did -e $dname 5
  1670.     }
  1671.     elseif ($did == 5) {
  1672.       if (!$did(1).seltext) { did -b $dname $did | return }
  1673.       var %file = $sfile($inidir $+ \*.ini,Save Profile,Save)
  1674.       var %version = $iif(%jj2.si.ver == 121,1.23,1.24)
  1675.       if (!%file) return
  1676.       var %file2 = $nopath(%file)
  1677.       if (*.ini !iswm %file) %file = %file $+ .ini
  1678.       if ($ini(%file,%version)) {
  1679.         if (%jj2.confover) var %edcv $$input(Do you want to overwrite the definitions for %version of that file?,136,Overwrite Defs)
  1680.         else var %edcv 1
  1681.         dialog -v $dname
  1682.         if (!%edcv) return
  1683.       }
  1684.       writeini $qte(%file) %version name $tab($did(1).seltext,2)
  1685.       writeini $qte(%file) %version char $tab($did(1).seltext,3)
  1686.       writeini $qte(%file) %version color $tab($did(1).seltext,4)
  1687.       writeini $qte(%file) %version mode BIN
  1688.       dialog -v ser_i
  1689.     }
  1690.     elseif ($did == 6) || ($did == 8) {
  1691.       unset %jj2.si.* | sockclose ser_i
  1692.       if ($dialog(server_list)) dialog -v server_list
  1693.       if ($did == 8) {
  1694.         if (!$dialog(server_list)) { did -b $dname 8 | return }
  1695.         joinser
  1696.         dialog -x ser_i
  1697.       }
  1698.     }
  1699.   }
  1700. }
  1701. on *:sockopen:ser_i: {
  1702.   if ($sock($sockname).status == connecting) { fatalsierr Error connecting to the server! }
  1703.   bset &b 1 9 15 1 4 50 $iif(%jj2.si.ver == 121,49,52) 32 32 1 | sockwrite $sockname &b | %jj2.si.stage = 1
  1704. }
  1705. alias fatalsierr {
  1706.   ;.timer 1 0 .echo -q $input($1-,516,JJ2 add-on)
  1707.   did -ra server_list 500 ERROR: S.I.: $1-
  1708.   unset %jj2.si.* | if ($dialog(ser_i)) dialog -x ser_i | sockclose ser_i
  1709.   halt
  1710. }
  1711. on *:sockclose:ser_i: { fatalsierr The server has closed the connection. }
  1712. on *:sockread:ser_i: {
  1713.   if ($sockerr > 0) return
  1714.   :nextread
  1715.   if (!$dialog(ser_i)) { sockclose $sockname | halt }
  1716.   if (!$sock(ser_i)) return
  1717.   sockread &b
  1718.   if ($sockbr == 0) return
  1719.  
  1720.   if (%jj2.si.stage == 1) {
  1721.     bset -t &botname 1 $iif(%jj2.botname == $null,JJ2||add-on| v $+ $s.version,%jj2.botname)
  1722.     if (%jj2.botname == $null) bset &botname $calc($bvar(&botname,0) +1) 32 32 32 32 167 58
  1723.     ;echo -s -> $bvar(&b,1,$bvar(&b,0))
  1724.     if (.j2l !isin $bvar(&b,1,$bvar(&b,0)).text) && (!%jj2.permissive) fatalsierr The server has sent an unexpected response. Wrong version? Server full? Level w/out extension?
  1725.     did -ra ser_i 2 $bvar(&b,6,$calc($bvar(&b,0) -15)).text
  1726.     %jj2.si.pl = $bvar(&b,4)
  1727.     ;echo -s bvar: %jj2.si.pl
  1728.     ;*if ($bvar(&b,3) != $bvar(&b,4)) echo 4 -s A Estudar: $bvar(&b,1,$bvar(&b,0))
  1729.     bset &m 1 1 14 1 %jj2.si.pl 1 0 0 0 0 $bvar(&botname,1,$bvar(&botname,0))
  1730.     sockwrite $sockname &m
  1731.   }
  1732.   elseif (%jj2.si.stage == 2) {
  1733.     did -r ser_i 1
  1734.     if ($bvar(&b,$bvar(&b,0)) != 0) fatalsierr The server has sent an unexpected response
  1735.     var %r = 3
  1736.     :k
  1737.     var %parte = skip,%num,%char,%nome,%pelo,%neq,%pelonum = 0
  1738.     while (%r < $bvar(&b,0)) { inc %r | %neq = $bvar(&b,%r)
  1739.       if (%parte == num) { %num = %neq | %parte = char }
  1740.       elseif (%parte == skip) { %parte = num }
  1741.       elseif (%parte == char) { %char = $rep(%neq,?? $eval(%neq,2),1~Spaz,0~Jazz,2~Lori,16~Jazz,17~Spaz,18~Lori,10~Jazz,11~Spaz,241~Spaz,240~Jazz,19~Bird) | %parte = pelo }
  1742.       elseif (%parte == pelo) { inc %pelonum
  1743.         %pelo = %pelo %neq
  1744.         if (%pelonum == 4) %parte = nome
  1745.       }
  1746.       elseif (%parte == nome) {
  1747.         if (%neq == 0) {
  1748.           if (JJ2||add-on|v !isin %nome) && (%nome != %jj2.botname) did -i ser_i 1 $calc(%num +2) $+($chr(160),%num,$tab,$chr(32),%nome,$tab,$chr(32),%char,$tab,$chr(32),%pelo)
  1749.           goto k
  1750.         }
  1751.         %nome = %nome $+ $chr(%neq)
  1752.       }
  1753.     }
  1754.     ;fim do while
  1755.     .timer -m 1 200 sockclose ser_i
  1756.   }
  1757.   inc %jj2.si.stage
  1758.   goto nextread
  1759. }
  1760. alias -l dialog {
  1761.   if (-m isin $1) {
  1762.     if ($dialog($2)) dialog -v $2
  1763.     elseif (%jj2.desktop) dialog -d $+ $remove($1,-) $2-
  1764.     else dialog $1-
  1765.   }
  1766.   else dialog $1-
  1767. }
  1768. ;Shortcuts (ver mais a partir da linha 853)
  1769. alias -l crcuW writeini $qte($scriptdircrosscuts.ini) crcu $1-
  1770. alias crcuR return $readini($scriptdircrosscuts.ini,n,crcu,$$1)
  1771. alias -l crcu return $gettok($crcuR($$1),1,42)
  1772. alias -l crcuC return $gettok($crcuR($$1),2,42)
  1773.  
  1774.  
  1775. ;Extra aliases
  1776. alias jj2.trickfg echo -s $dll($scriptdirregistry.dll,SetKeyValue,REG_BINARY HKEY_CURRENT_USER\Software\Epic MegaGames\Jazz Jackrabbit 2\1.23\Player0\\Char [ $cr ] $hexbin($1-,1))
  1777. ;Based on Overlord's list - http://geocities.com/atlastsome/jj2/
  1778. ;00 00 00 00 You will be seen as ammo and some other cool things
  1779. ;2E 00 00 00 Play like a frog with strange animation
  1780. ;08 00 00 00 If you want to start as a bird set the char to this value
  1781. ;43 00 00 00 Food and some ammo boxes
  1782. ;56 00 00 00 Weapons and their effects
  1783. ;76 00 00 00 Weapons, their fire and effects
  1784. ;98 00 00 00 Jazz with Spaz's sounds.
  1785. alias jj2.addserver { inc %jj2.serverid | did -i server_list 1 2 Server on $$1 $tab ?? $tab ?? $tab $iif($2,$2,??) $tab ... $tab $$1 $tab ?? $tab %jj2.serverid | jj2.aosa.ex %jj2.serverid | hemudpping }
  1786.  
  1787. ;eof
  1788.