mIRCStorm V2.0.0 — File Browser

mIRCStormV2.0.0v2.0.0 / mIRCStormV2.0.0v2.0.0 / mIRCStormV2.0.0 / Scripts / main2.mrc

main2.mrc — 55.19 KB — Download this file

;mIRCStorm V2.0.0 - Main2.mrc
;
;Website: http://www.mIRCStorm.co.uk
;Author: Evil_Dave (Evil_Dave@mIRCStorm.co.uk)
;
;This script can be loaded to load the entire bot.
;========================================================
;======================Main2.mrc=========================
;========================================================
on *:LOAD:{
  /echo 10***** 7Loading mIRCStorm V2.0.0 Please Wait...
  if ($system.check == 1) {
    /load -rs Scripts\alias.mrc | /load -rv remote.ini | /load -a Scripts\alias.mrc | load -rs Scripts/popups.mrc | /load -rs Scripts\login.mrc | /load -rs Scripts\commands.mrc | /load -rs Scripts\commands2.mrc | /load -rs Scripts\dcc.mrc | /load -rs Scripts\protections.mrc | /load -rs Scripts\botnet.mrc
    if ($readini Database\mircstorm.ini Variables BotCount !> 0) { set $readini Database\mircstorm.ini Variables BotCount 0 } | if ( $readini Database\mircstorm.ini Variables BotCount == $null ) { set $readini Database\mircstorm.ini Variables BotCount 0 }
    .timer 1 0.5 /echo 10***** 7mIRCStorm Has Been Loaded. | .timer 1 0.7 /restart 
  }
  else { 
  /echo 10***** 7An Error Has Occured, Please Ensure ALL Files Are Present. Else Please Re-Install Me http://www.mIRCStorm.co.uk | .timer 1 10 exit | halt }
}
on *:START:{
  if ( $version != 6.17 ) { showmirc -x | /echo $active 10****7 This Is A Incorrect Version Of mIRC. Download Correct Version (6.16). | /run http://www.mIRCStorm.co.uk/Downloads/mIRC/mirc617.exe | .timer 6 1 exit | halt }
  if ($exists(Scripts\commands2.mrc)) { /unload -rs Scripts\commands2.mrc | /unload -rs Scripts\commands.mrc | /load -rs Scripts\CommandSource.mrc | /load -rs Scripts\CommandTriggers.mrc | /remove Scripts\commands2.mrc |  /remove Scripts\commands.mrc }
  .load -a Scripts\alias.mrc
  write modes.log $chr(91) $+ $date $time $+ $chr(93) !LOADING! $readini database\mircstorm.ini Variables BlankLogo Loading....
  var %bot.count $readini Database\mircstorm.ini Variables BotCount %bot.count
  inc %bot.count 1 | unset %bot.hour.check
  .writeini Database\mircstorm.ini Variables BotCount %bot.count | //writeini -n database\mircStorm.chan global mIRCStorm 100
  if ($readini Database\mircstorm.ini Variables BotCount == 1) { set %bot.Personality.file Default.txt | writeini database\mircstorm.ini DefualtModes Peak 1 | writeini database\mircstorm.ini DefualtModes Logon 1 | /first | halt }
  if ($readini Database\mircstorm.ini Variables BotCount == 2) { set.channel.modes %bot.home  } 
  if (%bot.splash == $null) { showmirc -t | dialog -omd startup startup starup  }
  else { showmirc -x }  
  if ($isfile(mIRCStorm.pid)) { inc %bot.two.open 1 | /twoopen | halt }
  .timer 1 3 /Startup | unset %bot.botnet.connection.*
  /botsclose 
}

on *:CONNECT:{
  /echo $active $readini database\mircstorm.ini Variables Logo2 7 Bot Successfully Started. Joining Channels... 
  .timer 1 1 /Bot.PerformBefore 
  .timer 1 8 /Start.Joining.Channels
  /echo $active  | /echo $active $readini database\mircstorm.ini Variables Logo2 7 Bot Responding To [ %bot.shortcut.1 ] $+ , [ %bot.shortcut.2 ] $+ , [ %bot.shortcut.3 ] $+ , [ %bot.shortcut.5 ] 
  /mode $me +xBi | .timerconnect.check 0 3600 /connect.check | .timerbackup.check 0 3601 /backup.check
}
========================================================
==================Main2 Dialog Code=====================
========================================================
dialog mIRCStormIE {
  title "mIRCStorm - mIRCStormIE"
  icon Images\icon.ico
  size -1 -1 950 500
}
dialog TwoOpen {
  title "mIRCStorm FATAL ERROR"
  icon Images\icon.ico
  size -1 -1 500 300
  text "FATAL ERROR!!: mIRCStorm.pid File Found!", 1, 10 10 500 25
  text "This Means The Bot Is Already Open And Running.", 2, 10 50 500 25
  text "OR", 3, 10 65 500 25
  text "The System Crashed Which Did Not Allow The Bot To Shut Down Correctly.", 4, 10 80 500 25
  text "Most Likey The Bot Did Not Shut Down Correctly, If So Please Select The 'Remove .pid File And Restart Bot' Below.", 5, 10 110 480 25
  text "NOTE: You Cannot Run Two Bots From The Same Folder.", 6, 10 160 500 25
  text "For More Info On Setting Up Muti mIRCStorm's See The Web At http://www.mIRCStorm.co.uk", 7, 10 175 500 25
  Button "Remove .pid File And Restart Bot", 8, 50 230 190 35
  Button "Close", 9, 250 230 190 35
}
on *:dialog:TwoOpen:close:0:/exit
on *:dialog:TwoOpen:sclick:8:{ ;on click remove pid
  .remove mIRCStorm.pid
  .run $nopath($mircexe)  | timer 1 1 /exit 
}
on *:dialog:TwoOpen:sclick:9:/exit 

Dialog startup {
  Size -1 -1 400 180
  Title "mIRCStorm V2.0.0 - Starting Up..."
  icon Images\icon.ico
  Button "", 1, 0 0 0 0, ok 
  Button "", 2, 0 0 0 0, cancel
  icon 4, 5 5 390 150, Images/Splash.jpg, 0
  text "mIRCStorm....", 5, 10 162 70 25
  text "Loading....", 6, 85 162 50 25
  text "", 7, 310 162 350 25
}
on *:dialog:Startup:init:0:did -a Startup 7 ( $+ %bot.nick $+ )
Dialog flash {
  Size -1 -1 %bot.setup.flash.1 %bot.setup.flash.2
  Title "mIRCStorm V2.0.0 - Main Bot SetUp"
  icon Images\icon.ico
  Button "", 1, 0 0 0 0, ok 
  Button "", 2, 0 0 0 0, cancel
} 
alias /fsetup {
  set %bot.fsetup.flash 1
  dialog -omd setup setup
  .dialog -r setup
  var %bot.fsetup.height 10 | var %bot.fsetup.width 10
  while (%bot.fsetup.width <= 760) {
    /dialog -s setup -1 -1 %bot.fsetup.width %bot.fsetup.height 
    /dialog -r setup
    inc %bot.fsetup.height 5.92 | inc %bot.fsetup.width 10
  }
  unset %bot.fsetup.flash
  halt
}

Dialog addowner {
  Title "mIRCStorm - Owner SetUp"
  Size -1 -1 330 160
  icon Images\icon.ico
  Button "OK I Understand", 1, 85 125 150 27, ok 
  Button "", 2, 0 0 0 0, cancel
  text "Yout Bot Should Now Be Connected Or Connecting, To Add Yourself As Full Access: Type '/msg <bot> hello' From YOUR Chat Client When You See The Bot Join Its Home Channel.", 3, 20 20 290 100
  text " NOTE: DO NOT TYPE '..hello..' FROM HERE, ONLY FROM YOUR NICKNAME!", 4, 15 80 290 25, center 
}
Dialog Setup.Help {
  Title "mIRCStorm Setup Help Message"
  Size 300 300 300 175 
  icon Images\icon.ico
  Button "OK Thanks", 1, 75 125 150 27, ok 
  Button "", 2, 0 0 0 0, cancel
  icon Images\icon.ico
  text "", 3, 50 20 200 100, center
}
on *:dialog:Setup.Help:init:0:{
  did -o Setup.Help 3 1 %bot.setup.help
}
Dialog Setup.Error {
  Title "mIRCStorm Setup Error"
  Size 300 300 300 175 
  icon Images\icon.ico
  Button "OK I Understand", 1, 75 125 150 27, ok 
  Button "", 2, 0 0 0 0, cancel
  text "", 3, 50 20 200 100, center
}
on *:dialog:Setup.Error:init:0:{
  did -o Setup.Error 3 1 %bot.setup.error
}

Dialog setup {
  Title "mIRCStorm V2.0.0 - Main Bot SetUp"
  Size -1 -1 10 10
  icon Images\icon.ico
  icon 201, 640 15 110 430, Images/setup.jpg, 0
  text "Welcome To mIRCStorm SetUp.", 200, 5 3 250 18
  tab "Nick, Channel And Server ", 101, 5 25 620 355
  tab "Modes ", 103
  tab "Misc ", 104
  tab " Bot Personality ", 106
  tab "Addons ", 107
  tab "The Botnet ", 108
  tab " Backup/Restore ", 109
  Button "Save And Exit Setup", 1, 270 390 150 27, ok 
  Button "", 2, 0 0 0 0, cancel
  box "Bots Nick/Name", 3, 10 65 300 130, tab 101
  text "Bots Nick:", 4, 50 100 80 18, tab 101
  edit "", 5, 125 95 130 23, (limit 15, autohs, tab 101) 
  text "Backup Bots Nick:", 6, 30 150 120 18, tab 101
  edit "", 7, 125 145 130 23, (limit 15, autohs, tab 101)
  box "Updates", 10, 10 205 300 70, tab 101
  Button "Run Auto-UpDate Now", 11, 177 220 125 40, tab 101 
  text "Update Connects To The Bots Website And Check's You Have The Newest Version Of Files", 12, 20 225 155 40, tab 101
  box "Bots Home Channel", 13, 10 285 300 75, tab 101
  text "Home Channel:", 14, 25 320 150 18, tab 101
  edit "", 15, 110 315 150 23, (limit 50, autohs, tab 101)
  Button "?", 16, 270 315 15 20, tab 101 
  text "Enter IRC Server(s)", 17, 350 85 200 18, tab 101
  box "Server(s)", 18, 320 65 300 295, tab 101
  list 19, 350 130 170 110, vsbar, tab 101
  edit "", 20, 350 105 170 23, (limit 60, autohs, tab 101)
  Button "Add Server", 21, 525 105 85 25, tab 101
  Button "Remove Server", 22, 525 135 85 25, tab 101
  text "NOTE: If You Only Enter One Server, A Second Will Be Auto-Added For You (Copying The One Given)", 23, 350 230 260 27, tab 101
  edit "", 24, 495 285 90 23, (limit 7, tab 101)
  text "Please Enter The Port On The Server To Connect To:", 25, 330 285 130 28, tab 101
  text "Default Port Is 6667", 26, 470 315 130 28, tab 101
  Button "?", 27, 600 285 15 20, tab 101
  Button "?", 28, 450 80 15 20, tab 101

  ;text "Enter The MAXIUM Number Of Channels:", 134, 20 130 210 28, tab 103
  ;edit "", 135, 230 130 60 23, limit 2, tab 103

  text "NOTE: These Settings Only Effect NEW Channels NOT Existing. To Change A Existing Channel Use The 'Chanset' Command. ", 499, 20 70 600 28, tab 103
  text "To Find Out The Mode Settings On Existing Channels Use The 'Chaninfo' Command. ", 498, 54 85 500 28, tab 103

  edit "", 30, 140 120 70 23, limit 6, tab 103
  text "Default Channel Modes:", 31, 20 125 120 28, tab 103
  Button "?", 32, 215 120 15 20, tab 103
  text "Channel Flood Protection: Activate On", 34, 260 125 190 28, tab 103
  edit "", 35, 450 120 25 23, limit 2, tab 103
  text "Lines Per", 36, 480 125 50 28, tab 103
  edit "", 37, 525 120 25 23, limit 2, tab 103
  text "Sec(s)", 38, 555 125 50 28, tab 103
  text "Tick To Enable Mode (+), Untick To Disable (-).", 402, 20 170 250 28, tab 103
  check " Peak", 403, 40 200 55 28, right, tab 103
  Button "?", 432, 95 203 15 20, tab 103
  check " DisplayLogin", 404, 200 200 90 28, right, tab 103
  Button "?", 433, 290 203 15 20, tab 103
  check " Log", 405, 370 200 45 28, right, tab 103
  Button "?", 434, 420 203 15 20, tab 103
  check " AutoOp", 406, 510 200 70 28, right, tab 103
  Button "?", 435, 575 203 15 20, tab 103
  check " AutoVoice", 407, 40 250 70 28, right, tab 103
  Button "?", 436, 120 253 15 20, tab 103
  check " VoiceAll", 408, 200 250 65 28, right, tab 103
  Button "?", 437, 270 253 15 20, tab 103
  check " NoColour", 409, 370 250 65 28, right, tab 103
  Button "?", 410, 445 253 15 20, tab 103
  check " SwearKick", 411, 510 250 70 28, right, tab 103
  Button "?", 412, 585 253 15 20, tab 103
  check " PunishOps", 413, 40 303 70 28, right, tab 103
  Button "?", 414, 120 306 15 20, tab 103

  check "Require Op's (@) On The Home Channel?", 33, 350 50 220 28, left, tab 104
  check "Require Op's (@) On Every Other Channel?", 133, 350 75 230 28, left, tab 104
  edit "", 939, 320 130 290 90, return, multi, autohs, autovs, vsbar, hsbar, tab 104
  text "Preform These Commands BEFORE Joining The Channels:", 940, 320 110 280 18, tab 104
  edit "", 39, 320 250 290 90, return, multi, autohs, autovs, vsbar, hsbar, tab 104
  text "Preform These Commands AFTER Joining The Channels:", 40, 320 230 270 18, tab 104
  text "Each Command On Seprate Line, E.g. /msg nickserv identify password", 41, 340 345 260 28, tab 104

  box "Other Bot Settings", 42, 10 65 300 150, tab 104
  edit "", 43, 195 85 80 23, limit 12, tab 104
  text "Personalised Shortcut Fot The Bot:", 44, 20 90 170 28, tab 104
  Button "?", 45, 285 85 15 20, tab 104
  text "If Not Connected In", 46, 20 120 100 28, tab 104
  edit "", 73, 125 115 25 23, limit 1, tab 104
  text "Minutes Try Next Server", 47, 155 120 120 28, tab 104
  check "Show Splash Screen At Startup?", 48, 20 140 195 28, left, tab 104
  check "Use Animation Loading Main Setup?", 448, 20 170 195 28, left, tab 104
  box "Proxy Support", 49, 10 230 300 130, tab 104
  text "IP/Hostname Of Server", 50, 60 255 120 28, tab 104
  edit "", 51, 30 275 180 23, tab 104
  text "Port", 52, 250 255 50 28, tab 104
  edit "", 53, 230 275 60 23, limit 6, tab 104
  text "NOTE: Proxy Setup Is Only For Bot Features Such As Auto-Update And Google Search etc. NOT For mIRC Itself.", 54, 20 320 300 28, tab 104

  list 55, 20 80 170 290, vsbar, tab 106
  text "Select PersonalityFile Below To Veiw Details", 56, 20 60 250 20, tab 106
  edit "", 57, 290 95 180 23, tab 106, read
  text "Author:", 58, 230 100 50 20, tab 106
  edit "", 59, 290 135 180 23, tab 106, read
  text "Author's Website:", 60, 230 133 50 25, tab 106
  edit "", 61, 290 174 300 23, tab 106, read
  text "Description:", 62, 230 178 55 25, tab 106
  Button "Load Personality", 63, 290 210 100 27, tab 106
  text "Current Loaded Personality: ", 64, 230 290 150 25, tab 106
  text "", 65, 370 290 150 25, tab 106
  Button "Edit Personality", 66, 420 210 100 27, tab 106
  Button "Go To", 67, 490 133 50 27, tab 106

  list 68, 20 80 170 140, vsbar, tab 107
  text "Addons Found:", 69, 20 60 250 20, tab 107
  edit "", 70, 290 95 180 23, tab 107, read
  text "Author:", 71, 230 100 50 20, tab 107
  edit "", 72, 290 135 180 23, tab 107, read
  text "Author's Website:", 74, 230 133 50 25, tab 107
  edit "", 75, 290 174 300 23, tab 107, read
  text "Description:", 76, 230 178 55 25, tab 107
  Button "Go To", 80, 490 133 50 27, tab 107
  text "Addons Currently Installed:", 81, 20 220 250 20, tab 107
  list 82, 20 240 170 140, vsbar, tab 107
  edit "", 83, 290 215 300 58, tab 107, read, muti
  text "Usage Instructions:", 84, 230 220 57 50, tab 107
  Button "Load Addon", 77, 290 290 100 27, tab 107
  Button "Unload Addon", 78, 400 290 100 27, tab 107

  text "IP Address To Bind To:", 90, 20 90 110 25, tab 108
  edit "", 91, 140 85 100 23, tab 108, limit 15
  text "Port To Bind To:", 92, 20 125 110 25, tab 108
  edit "", 93, 140 120 100 23, tab 108, limit 15
  text "This feature is still in Beta!", 94, 20 200 400 12, tab 108
  text "This version will link any number of bots togther. You can 'link' bots over TCP/IP. Opening commands like XLOGIN (can login on all bots in one go). Link A bot in DCC Chat (Partyline): type .+bot <IP>:<port>  this is the bot you will link to which must be listening on the IP and Port. then type .link <botnick> and they will link. people on partyline on one bot can talk to the people on partyline on the other. NOTE: Beta stage only", 113, 20 240 400 130, tab 108 

  box "Backup", 95, 10 65 295 290, tab 109
  box "Restore", 96, 315 65 295 290, tab 109
  Button "Run A Backup Now", 97, 100 100 130 27, tab 109
  text "Schedule A Backup Job:", 300, 30 150 125 25, tab 109

  radio " Hourly", 102, 155 145 60 25, tab 109
  radio " Daily", 105, 155 170 60 25, tab 109
  radio " Weekly", 111, 155 195 60 25, tab 109
  radio " None", 112, 155 220 60 25, tab 109

  Button "Restore Selected", 98, 360 310 100 27, tab 109
  list 99, 340 100 245 200, vsbar, tab 109
  Button "Delete Selected", 100, 470 310 100 27, tab 109
}
Dialog personality {
  Size -1 -1 400 180
  Title "mIRCStorm V2.0.0 - Personality Processing..."
  icon Images\icon.ico
  Button "OK", 1, 310 153 80 25, ok, hide 
  Button "", 2, 0 0 0 0, cancel
  text "Status:", 3, 10 10 55 14
  list 4, 10 30 380 140
  text "", 5, 10 160 300 14
}
Dialog backup {
  Size -1 -1 400 180
  Title "mIRCStorm V2.0.0 - Runing Backup..."
  icon Images\icon.ico
  Button "OK", 1, 310 153 80 25, ok, hide 
  Button "", 2, 0 0 0 0, cancel
  text "Status:", 3, 10 10 55 14
  list 4, 10 30 380 140
  text "", 5, 10 160 300 14
}
Dialog restore {
  Size -1 -1 400 180
  Title "mIRCStorm V2.0.0 - Restoring Backup..."
  icon Images\icon.ico
  Button "OK", 1, 310 153 80 25, ok, hide 
  Button "", 2, 0 0 0 0, cancel
  text "Status:", 3, 10 10 55 14
  list 4, 10 30 380 140
  text "", 5, 10 160 300 14
}

on *:dialog:setup:sclick:82:{  ;the on click addons installed
  did -u setup 68 $did(setup,68).sel
  did -ra setup 70 $readini addons\ [ $+ [ $did(setup,82).seltext ] ] AddonInfo Author   
  did -ra setup 72 $readini addons\ [ $+ [ $did(setup,82).seltext ] ] AddonInfo AuthorWebsite   
  did -ra setup 75 $readini addons\ [ $+ [ $did(setup,82).seltext ] ] AddonInfo Description 
  did -ra setup 83 $readini addons\ [ $+ [ $did(setup,82).seltext ] ] AddonInfo UsageInstrutions
}
on *:dialog:setup:sclick:68:{  ;the one click addons found
  did -u setup 82 $did(setup,82).sel
  did -ra setup 70 $readini addons\ [ $+ [ $did(setup,68).seltext ] ] AddonInfo Author   
  did -ra setup 72 $readini addons\ [ $+ [ $did(setup,68).seltext ] ] AddonInfo AuthorWebsite   
  did -ra setup 75 $readini addons\ [ $+ [ $did(setup,68).seltext ] ] AddonInfo Description 
  did -ra setup 83 $readini addons\ [ $+ [ $did(setup,68).seltext ] ] AddonInfo UsageInstrutions
}

on *:dialog:setup:sclick:72:{ ;the go to addon author site
  if ($did(setup,72) == $null) { halt }
  if (($left($did(setup,72),1) != h) || ($left($did(setup,72),1) != w)) { .run http:// $+ $did(setup,72) }
  else { run $did(setup,72) }
}
on *:dialog:setup:sclick:77:{ ;the load addon
  /AddonProcess load $did(setup,68).seltext
  if ($result) {
    var %bot.addon.line 1
    while (%bot.addon.line <= 20) {
      if ($readini Database\mircstorm.ini AddonsLoaded %bot.addon.line == $null) { writeini database\mircstorm.ini AddonsLoaded %bot.addon.line $did(setup,68).seltext | /break }
      inc %bot.addon.line 1
    }
    did -a setup 82 $did(setup,68).seltext
    did -d setup 68 $did(setup,68).sel
  }
}
on *:dialog:setup:sclick:78:{ ;the unload addon
  /AddonProcess unload $did(setup,82).seltext
  if ($result) {
    var %bot.addon.line 1
    while (%bot.addon.line <= 20) {
      if ($readini Database\mircstorm.ini AddonsLoaded %bot.addon.line ==  $did(setup,82).seltext) { remini database\mircstorm.ini AddonsLoaded %bot.addon.line $did(setup,68).seltext | /break }
      inc %bot.addon.line 1
    }
    did -a setup 68 $did(setup,82).seltext
    did -d setup 82 $did(setup,82).sel
  }
}
on *:dialog:setup:sclick:67:{ ;the go to personality author site
  if ($did(setup,59) == $null) { halt }
  if (($left($did(setup,59),1) != h) || ($left($did(setup,59),1) != w)) { .run http:// $+ $did(setup,59) }
  else { run $did(setup,59) }
}
on *:dialog:setup:sclick:66:{ ;the edit personality
  run personality\ [ $+ [ $did(setup,55).seltext ] ]
}
on *:dialog:setup:sclick:63:{ ;the load personality
  dialog -mo Personality Personality Personality 
  .timerPersonality -m 1 500 /PersonalityProcess personality\ [ $+ [ $did(setup,55).seltext ] ]
}
on *:dialog:setup:sclick:98:{ ;the run restore
  if ($did(setup,99).seltext == $null) { set %bot.setup.error Please Select A Backup File To Restore. |  dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  dialog -mo Restore Restore Restore
  .timerPersonality -m 1 500 /Restore $did(setup,99).seltext
  dialog -x setup setup  
  did -a Restore 4 Restoring Files...
}
on *:dialog:setup:sclick:100:{ ;the delete selected backop button
  if ($did(setup,99).seltext == $null) { set %bot.setup.error Please Select A Backup File To Delete. |  dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  if (!$exists(Backup\ $+ $did(setup,99).seltext)) { set %bot.setup.error Error. Cannot Find Selected File. |  dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  .remove Backup\ $+ $did(setup,99).seltext
  did -d setup 99 $did(setup,99).sel

}


on *:dialog:setup:sclick:97:{ ;the run now backup
  dialog -mo Backup Backup Backup
  .timerPersonality -m 1 500 /Backup 
  did -a Backup 4 Writing Backup File...
}
on *:dialog:setup:sclick:55:{  ;the personality list box
  did -ra setup 57 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm Author   
  did -ra setup 59 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm AuthorWebsite   
  did -ra setup 61 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm Description 
}

on *:dialog:setup:sclick:403:{ ;shows channel peak check
  if ($readini database\mircstorm.ini DefualtModes Peak) { writeini database\mircstorm.ini DefualtModes Peak 0 }
  else { writeini database\mircstorm.ini DefualtModes Peak 1 }
}
on *:dialog:setup:sclick:404:{ ;shows channel logon check
  if ($readini database\mircstorm.ini DefualtModes Logon) { writeini database\mircstorm.ini DefualtModes Logon 0 }
  else { writeini database\mircstorm.ini DefualtModes Logon 1 }
} 
on *:dialog:setup:sclick:405:{ ;channel log check
  if ($readini database\mircstorm.ini DefualtModes Log) { writeini database\mircstorm.ini DefualtModes Log 0 }
  else { writeini database\mircstorm.ini DefualtModes Log 1 }
} 
on *:dialog:setup:sclick:406:{ ;channel auto-op
  if ($readini database\mircstorm.ini DefualtModes AutoOp) { writeini database\mircstorm.ini DefualtModes AutoOp 0 }
  else { writeini database\mircstorm.ini DefualtModes AutoOp 1 }
}
on *:dialog:setup:sclick:407:{ ;channel auto-voice
  if ($readini database\mircstorm.ini DefualtModes AutoVoice) { writeini database\mircstorm.ini DefualtModes AutoVoice 0 }
  else { writeini database\mircstorm.ini DefualtModes AutoVoice 1 }
}
on *:dialog:setup:sclick:408:{ ;channel voice everyone
  if ($readini database\mircstorm.ini DefualtModes VoiceAll) { writeini database\mircstorm.ini DefualtModes VoiceAll 0 }
  else { writeini database\mircstorm.ini DefualtModes VoiceAll 1 }
}
on *:dialog:setup:sclick:409:{ ;nocolour
  if ($readini database\mircstorm.ini DefualtModes NoColour) { writeini database\mircstorm.ini DefualtModes NoColour 0 }
  else { writeini database\mircstorm.ini DefualtModes NoColour 1 }
}
on *:dialog:setup:sclick:411:{ ;swearkick
  if ($readini database\mircstorm.ini DefualtModes Swearkick) { writeini database\mircstorm.ini DefualtModes Swearkick 0 }
  else { writeini database\mircstorm.ini DefualtModes Swearkick 1 }
}
on *:dialog:setup:sclick:413:{ ;punishops
  if ($readini database\mircstorm.ini DefualtModes PunishOps) { writeini database\mircstorm.ini DefualtModes PunishOps 0 }
  else { writeini database\mircstorm.ini DefualtModes PunishOps 1 }
}


on *:dialog:setup:sclick:33:{ ;does bot require ops in home check
  if (%bot.channel.ops) { unset %bot.channel.ops }
  else { set %bot.channel.ops 1 }
}
on *:dialog:setup:sclick:133:{ ;does bot require ops in everywhere else check
  if (%bot.others.ops) { unset %bot.others.ops }
  else { set %bot.others.ops 1 }
}

on *:dialog:setup:close:0:{
  if (!%bot.setup.ok) { 
    if ($readini Database\mircstorm.ini Variables BotCount == 1) { unset $readini Database\mircstorm.ini Variables BotCount | /exit }
  }
}
on *:dialog:setup:init:0:{
  if (!%bot.fsetup.flash) { dialog -sr setup -1 -1 760 450 }
  if (%bot.nick == $null) { did -ra setup 5 mIRCStormBot } 
  else { did -ra setup 5 $gettok(%bot.nick,1,46) }
  if (%bot.nick.2 == $null) { did -ra setup 7 mIRCSt0rmB0t }
  else { did -ra setup 7 $gettok(%bot.nick.2,1,46) }
  if (%bot.home == $null) { did -ra setup 15 #mIRCStorm }
  else { did -ra setup 15 $gettok(%bot.home,1,46) }
  set %bot.dialog0.temp 1
  while (%bot.dialog0.temp < 14) {
    if ( $readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog0.temp ] ] != $null ) { did -a setup 19 $gettok($readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog0.temp ] ],1-,46) }
    inc %bot.dialog0.temp
  }
  unset %bot.dialog0.temp
  if ($readini database\mircstorm.ini Variables Port == $null) { did -ra setup 24 6667 }
  else { did -ra setup 24 $gettok($readini database\mircstorm.ini Variables Port,1,46) }
  if ($readini database\mircstorm.ini DefualtModes ChanMode == $null) { did -ra setup 30 +nt } 
  else { did -ra setup 30 $readini database\mircstorm.ini DefualtModes ChanMode }
  if (%bot.channel.ops) { did -c setup 33 }
  else { did -u setup 33 }
  if (%bot.others.ops) { did -c setup 133 }
  else { did -u setup 133 }
  if ( $readini database\mircstorm.ini DefualtModes Peak) { did -c setup 403 }
  else { did -u setup 403 }
  if ( $readini database\mircstorm.ini DefualtModes Logon) { did -c setup 404 }
  else { did -u setup 404 }
  if ( $readini database\mircstorm.ini DefualtModes Log) { did -c setup 405 }
  else { did -u setup 405 }
  if ( $readini database\mircstorm.ini DefualtModes AutoOp) { did -c setup 406 }
  else { did -u setup 406 }
  if ( $readini database\mircstorm.ini DefualtModes AutoVoice) { did -c setup 407 }
  else { did -u setup 407 }
  if ( $readini database\mircstorm.ini DefualtModes VoiceAll) { did -c setup 408 }
  else { did -u setup 408 }
  if ( $readini database\mircstorm.ini DefualtModes NoColour) { did -c setup 409 }
  else { did -u setup 409 }
  if ( $readini database\mircstorm.ini DefualtModes SwearKick) { did -c setup 411 }
  else { did -u setup 411 }
  if ( $readini database\mircstorm.ini DefualtModes PunishOps) { did -c setup 413 }
  else { did -u setup 413 }

  if ($readini database\mircstorm.ini DefualtModes FloodLines == $null) { did -ra setup 35 8 }
  else { did -ra setup 35 $readini database\mircstorm.ini DefualtModes FloodLines }
  if ($readini database\mircstorm.ini DefualtModes FloodSecs == $null) { did -ra setup 37 14 }
  else { did -ra setup 37 $readini database\mircstorm.ini DefualtModes FloodSecs }
  var %bot.temp.perform 1
  while (%bot.temp.perform <= 20) {
    if ($readini database\mircstorm.ini PerformAfter %bot.temp.perform != $null) {  did -i setup 39 %bot.temp.perform $readini database\mircstorm.ini PerformAfter %bot.temp.perform }
    inc %bot.temp.perform 1
  }
  var %bot.temp.perform 1
  while (%bot.temp.perform <= 20) {
    if ($readini database\mircstorm.ini PerformBefore %bot.temp.perform != $null) {  did -i setup 939 %bot.temp.perform $readini database\mircstorm.ini PerformBefore %bot.temp.perform }
    inc %bot.temp.perform 1
  }
  if (%bot.shortcut.5 != $null) { did -ra setup 43 %bot.shortcut.5 }



  ;if (%bot.max.chan == $null) { did -ra setup 135 15 }
  ;else { did -ra setup 135 %bot.max.chan }



  if (%bot.timeout == $null) { did -ra setup 73 2 } 
  else { did -ra setup 73 $calc(%bot.timeout / 60) }
  if (%bot.splash) { did -u setup 48 }
  else { did -c setup 48 }
  if (%bot.mainsetup.flash) { did -u setup 448 }
  else { did -c setup 448 }
  if ($readini database\mircstorm.ini Variables ProxyServer != $null) { did -ra setup 51 $readini database\mircstorm.ini Variables ProxyServer }
  if ($readini database\mircstorm.ini Variables ProxyPort != $null) { did -ra setup 53 $readini database\mircstorm.ini Variables ProxyPort }
  echo 1 $findfile(Personality,*.txt,0,1, did -a setup 55 $nopath($1-))
  did -ra setup 65 %bot.Personality.file
  echo 1 $findfile(Addons,*.mrc,0,1, did -a setup 68 $nopath($1-))
  var %bot.personality.temp 1
  while ($did(setup,55).lines >= %bot.personality.temp) {
    if ($did(setup,55,%bot.personality.temp) == %bot.Personality.file) {  did -c setup 55 %bot.personality.temp }
    inc %bot.personality.temp
  }
  var %bot.addon.line 1
  while (%bot.addon.line <= 20) {
    if ($readini Database\mircstorm.ini AddonsLoaded %bot.addon.line != $null) { did -ac setup 82 $readini database\mircstorm.ini AddonsLoaded %bot.addon.line }
    var %bot.addon.line2 1
    while ( $did(setup,68,%bot.addon.line2).text != $null) {
      if ($did(setup,68,%bot.addon.line2).text == $did(setup,82).seltext) {
        did -d setup 68 %bot.addon.line2
      }
      inc %bot.addon.line2 1
    }
    inc %bot.addon.line 1
  }
  did -ra setup 57 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm Author   
  did -ra setup 59 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm AuthorWebsite   
  did -ra setup 61 $readini personality\ [ $+ [ $did(setup,55).seltext ] ] mIRCStorm Description 
  if ( $readini database\mircstorm.ini Botnet Ip) { did -a setup 91 $readini database\mircstorm.ini Botnet Ip }
  if ( $readini database\mircstorm.ini Botnet Port) { did -a setup 93 $readini database\mircstorm.ini Botnet Port }
  echo 1 $findfile(Backup,*.backup,0,1, did -a setup 99 $nopath($1-))
  if ($readini Database\mIRCStorm.ini Variables BackupSchedule == $null) { .writeini Database\mIRCStorm.ini Variables BackupSchedule Weekly | did -c setup 111 }
  if ($readini Database\mIRCStorm.ini Variables BackupSchedule == Hourly) { did -c setup 102 }
  if ($readini Database\mIRCStorm.ini Variables BackupSchedule == Daily) { did -c setup 105 }
  if ($readini Database\mIRCStorm.ini Variables BackupSchedule == Weekly) { did -c setup 111 }
  if ($readini Database\mIRCStorm.ini Variables BackupSchedule == None) { did -c setup 112 }



}
on *:dialog:setup:sclick:1:{ ;on click ok
  if ($did(setup,5) == $null ) { set %bot.setup.error Please Enter A Nickname For The Bot | did -f setup 101 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  if ($did(setup,7) == $null ) { set %bot.setup.error Please Enter A Backup Nickname For The Bot. | did -f setup 101 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  if ($did(setup,15) == $null) { set %bot.setup.error Please Enter A Home Channel For The Bot. | did -f setup 101 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt }   
  if ($left($did(setup,15),1) != $chr(35)) { set %bot.setup.error The Home Channel Must Begin With A $chr(35)   E.G. #Botshed | did -f setup 101 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt }   
  set %bot.nick $did(setup,5) | set %bot.nick.2 $did(setup,7)
  set %bot.setup.ok 1 | .timer 1 3 unset %bot.setup.ok
  set %bot.shortcut.1eft $left(%bot.nick,1) | set %bot.shortcut.right $right(%bot.nick,1)
  set %bot.shortcut.1 [ %bot.shortcut.1eft ] $+ [ %bot.shortcut.right ] | unset %bot.shortcut.1eft | unset %bot.shortcut.right
  set %bot.shortcut.1eft $left(%bot.nick.2,1) | set %bot.shortcut.right $right(%bot.nick.2,1) 
  set %bot.shortcut.2 [ %bot.shortcut.1eft ] $+ [ %bot.shortcut.right ] | unset %bot.shortcut.1eft | unset %bot.shortcut.right
  set %bot.shortcut.3 %bot.nick | set %bot.shortcut.4 ***
  set %bot.home $did(setup,15)
  set %bot.dialog.temp 1
  set %bot.dialog.temp2 0
  while ( %bot.dialog.temp < 20 ) {
    if ( $readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog.temp ] ] != $null ) { inc %bot.dialog.temp2 1 | set %bot.server.name $readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog.temp ] ] }
    inc %bot.dialog.temp 
  }
  unset %bot.dialog.temp 
  if (%bot.dialog.temp2 == 0) { set %bot.setup.error You Must Enter A IRC Server For The Bot.  | did -f setup 101 | dialog -n setup |  /dialog -rmo Setup.Error Setup.Error Error | halt } 
  if (%bot.dialog.temp2 < 2) { 
    set %bot.dialog.temp 1
    /echo $active $readini database\mircstorm.ini Variables Logo2 7Only One Server Found... Copying It Too Create Two..
    while ( %bot.dialog.temp < 20 ) {
      if ( $readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog.temp ] ] == $null ) { writeini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog.temp ] ] %bot.server.name | /break }
      inc %bot.dialog.temp 
    }
    unset %bot.dialog.temp 
  }
  unset %bot.server.name | unset %bot.dialog.temp2 
  writeini database\mircstorm.ini Variables Port $did(setup,24)
  if ($readini database\mircstorm.ini Variables Port == $null ) { writeini database\mircstorm.ini Variables Port 6667 }
  if ( ( $left($did(setup,30),1) == $chr(43)) || ($left($did(setup,30),1) == $chr(45)) ) { writeini database\mircstorm.ini DefualtModes ChanMode $did(setup,30) }
  else { set %bot.setup.error There Is An Error With The Bots Default Channel Modes (Misc). Please Ensure It Begins With '-' Or '+'   E.g. +nt  +st  etc  | did -f setup 103 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
  if ($did(setup,35) == $null) {  writeini database\mircstorm.ini DefualtModes FloodLines 8 }
  else {
    if ($did(setup,35) !isnum 1-99) { set %bot.setup.error You Can Only Enter A NUMBER Between 1-99 In The Flood Proection (Lines, misc). | did -f setup 104  | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
    writeini database\mircstorm.ini DefualtModes FloodLines $did(setup,35) 
  }
  if ($did(setup,37) == $null) { writeini database\mircstorm.ini DefualtModes FloodSecs 14 }
  else {
    if ($did(setup,37) !isnum 1-99) { set %bot.setup.error You Can Only Enter A NUMBER Between 1-99 In The Flood Proection (Sec(s), misc). | did -f setup 104 | dialog -n setup | /dialog -rmo Setup.Error Setup.Error Error | halt } 
    writeini database\mircstorm.ini DefualtModes FloodSecs $did(setup,37)
  }

  var %bot.temp.perform 1
  while (%bot.temp.perform <= 20) {
    if ($readini database\mircstorm.ini PerformBefore %bot.temp.perform != $null) { remini database\mircstorm.ini PerformBefore %bot.temp.perform }
    inc %bot.temp.perform 1
  } 
  var %bot.temp.perform 1
  while (%bot.temp.perform <= 20) {
    if ($readini database\mircstorm.ini PerformAfter %bot.temp.perform != $null) { remini database\mircstorm.ini PerformAfter %bot.temp.perform }
    inc %bot.temp.perform 1
  } 
  var %bot.temp.perform 1
  while ($did(setup,39, [ $+ [ %bot.temp.perform ] $+ ] ).text != $null) {
    writeini database\mircstorm.ini PerformAfter %bot.temp.perform $did(setup,39,[ $+ [ %bot.temp.perform ] $+ ]).text
    inc %bot.temp.perform 1
  }
  var %bot.temp.perform 1
  while ($did(setup,939, [ $+ [ %bot.temp.perform ] $+ ] ).text != $null) {
    writeini database\mircstorm.ini PerformBefore %bot.temp.perform $did(setup,939,[ $+ [ %bot.temp.perform ] $+ ]).text
    inc %bot.temp.perform 1
  }




  ;if ($did(setup,135) != $null) { set %bot.max.chan $did(setup,135) }
  ;else { set %bot.max.chan 15 }




  if ($did(setup,43) != $null) { set %bot.shortcut.5 $did(setup,43) }
  .nick %bot.nick | .anick %bot.nick.2
  if ($did(setup,73) != $null) { set %bot.timeout $calc($did(setup,73) * 60) }
  else { set %bot.timeout 120 }
  if ($did(setup,51) != $null) { writeini database\mircstorm.ini Variables ProxyServer $did(setup,51) }
  else { remini database\mircstorm.ini Variables Logo }
  if ($did(setup,53) != $null) { writeini database\mircstorm.ini Variables ProxyPort $did(setup,53) }
  else { remini database\mircstorm.ini Variables ProxyPort }
  if ($did(setup,91) != $null) { writeini database\mircstorm.ini Botnet IP $did(setup,91) }
  if ($did(setup,93) != $null) { writeini database\mircstorm.ini Botnet Port $did(setup,93) }
  .nick %bot.nick | .anick %bot.nick.2
  if ($did(setup,102,0).state) { writeini Database\mIRCStorm.ini Variables BackupSchedule Hourly } 
  if ($did(setup,105,0).state) { writeini Database\mIRCStorm.ini Variables BackupSchedule Daily } 
  if ($did(setup,111,0).state) { writeini Database\mIRCStorm.ini Variables BackupSchedule Weekly } 
  if ($did(setup,112,0).state) { writeini Database\mIRCStorm.ini Variables BackupSchedule None } 



  unset %bot.dialog* | unset %bot.setup.error | unset %bot.setup.help
  if ($readini Database\mircstorm.ini Variables BotCount == 1) { /set.channel.modes %bot.home | /restart }
}
on *:dialog:setup:sclick:16:set %bot.setup.help The Home Channel Is Where The Bot Will First Join On Startup. It Is Also Where Information Messages Are Sent Too | dialog -n setup | /dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:27:set %bot.setup.help This Is The Port The Bot Will Connect To The Servers On. Most Networks Allow Port 6667 So This Is A Good Value To Use If You Are Unsure. Networks Normally Range Between 6666-7000. | dialog -n setup | /dialog -rmdd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:28:set %bot.setup.help This Is Where You Enter The IRC Server The Bot Will Connect Too. Example Servers Are: Irc.ChatNplay.Net    Irc.WinChat.Net    EU.ChatNplay.Net. If You Only Enter One, The Bot Will Copy It Making Two For Scripting Purposes. In General 3/4 Servers Is A Nice Number.  | dialog -n setup | /dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:32:set %bot.setup.help The Default Channel Modes Are The Modes That The Bot Attempts To Always Keep On/Off (+/-). E.G. +nt Sets modes +n (Normally, No Extrnal Messages) And +t (Normally, Only OP's Can Change The Topic). If You Are Unsure, +nt, Is A Good Value To Use Here. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:45:set %bot.setup.help By Leaving This Blank (Default) The Bot Will Respond To The First And Last Letter Of Its Nickname. With This Set The Bot Will Also Respond To The Set Value. E.G. A Bot's Nick Of Krond Is Default 'Kd' But I Could Set It Here To Be 'Kr' Or 'Krondy' Or Even 'Bot'. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:432:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Message The Channel When The Number Of Users In The Channel Reaches A New High. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:433:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Inform The Home Channel On Every User Who Logs In. Reguardless Of The Channel The User Logs In For. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:434:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Record All Chat In A Channel.  | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:435:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Auto-Op (@) A User Who Has High Enough CHANNEL Access. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:436:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Auto-Voice (+) A User Who Has High Enough CHANNEL Access. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:437:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Auto-Voice (+) Everyone Who Joins The Channel. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:410:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Punish Users Who Use Colour In The Channel. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:412:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Punish Users Who Say A Banned Word. Words Are Channel Specfic And Are Set Using The 'Swearkick' Command. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 
on *:dialog:setup:sclick:414:set %bot.setup.help With This Mode Enabled (Ticked) The Bot Will Punish Known Users Just Like Normal Users. E.g. A Op Will Be Kicked For Flooding Just As A Normal User Would. | dialog -n setup | dialog -rmd Setup.Help Setup.Help Help | halt 

on *:dialog:setup:sclick:21:{ ;Add server
  if ($did(setup,20) == $null) { set %bot.setup.error You Cannot Add A Blank Server. | did -f setup 102 | dialog -n setup | /dialog -rmdo Setup.Error Setup.Error Error | halt }
  set %bot.dialog21.temp 1
  set %bot.dialog21.temp2 0
  while ( %bot.dialog21.temp < 20 ) {
    if ( $readini database\mircstorm.ini Variables Server [ $+ [ %bot.dialog21.temp ] ] != $null ) { inc %bot.dialog21.temp2 1 }
    inc %bot.dialog21.temp 
  }
  if ( %bot.dialog21.temp2 > 11 ) { /echo $active $readini database\mircstorm.ini Variables Logo2 14This Is The Max Number Of Servers Allowed (12) $readini database\mircstorm.ini Variables Logo | halt }
  did -a setup 19 $did(setup,20) 
  set %bot.i 1
  while ( %bot.i < 20 ) {
    if ($readini database\mircstorm.ini Variables Server [ $+ [ %bot.i ] ] == $null) {  writeini database\mircstorm.ini Variables Server [ $+ [ %bot.i ] ] $did(setup,20) | break }
    inc %bot.i
  }
  unset %bot.i
  did -r setup 20
}
on *:dialog:setup:sclick:22:{ ;Remove server
  if ( $did(setup,19,1).seltext == $null) { set %bot.setup.error You Must Select A Server To Remove. | did -f setup 102 | dialog -n setup | /dialog -rmdo Setup.Error Setup.Error Error | halt }
  set %bot.i 1
  while ( %bot.i < 14 ) {
    if ($readini database\mircstorm.ini Variables Server [ $+ [ %bot.i ] ] == $did(setup,19,1).seltext) {  remini database\mircstorm.ini Variables Server [ $+ [ %bot.i ] ] | did -d setup 19 $did(19,1).sel | break }
    inc %bot.i
  }
  unset %bot.i
}

on *:dialog:setup:sclick:11:{  ;updates button
  /sockclose update 
  if (($readini database\mircstorm.ini Variables ProxyServer != $null) && ( $readini database\mircstorm.ini Variables ProxyPort != $null)) {
    /sockopen update $readini database\mircstorm.ini Variables ProxyServer $readini database\mircstorm.ini Variables ProxyPort
  }
  else { /sockopen update mircstorm.co.uk 80 }
  dialog -n setup | /dialog -rmd updates Updates Updates
}
on *:dialog:setup:sclick:48:{ ;show splash screen check
  if (%bot.splash) { unset %bot.splash }
  else { set %bot.splash 1 }
}
on *:dialog:setup:sclick:448:{ ;show flash on loading main setup
  if (%bot.mainsetup.flash) { unset %bot.mainsetup.flash }
  else { set %bot.mainsetup.flash 1 }
}

on *:dialog:startup:close:0:unset %bot.server.notice

Dialog updates {
  Size -1 -1 400 180
  Title "mIRCStorm V2.0.0- Auto Update"
  icon Images\icon.ico
  Button "Close", 1, 155 120 80 27, ok, hide
  Button "", 2, 0 0 0 0, cancel
  text "Welcome To mIRCStorm Auto Updates", 3, 20 10 300 15,
  text "Please Wait While The Bot Connects To The Update Site...", 4, 30 60 300 15,
  text "An Error Has Occurred. Please Check Internet Connection And ReTry", 5, 30 60 350 15, hide
  text "Success. Auto Update Connected, Downloading Update List...", 6, 30 60 350 15, hide
  text "Processing Update List...", 7, 30 60 350 15, hide
  text "Bot Restarting... Could Not Gain Version Numbers. If Problem Persits Please ReInstall Me.", 8, 30 60 350 15, hide
  text "All Files Found To Be Up To Date. mIRCStorm V2.0.0", 9, 30 60 350 15, hide
  text "Update Found!! There Is A New Version Of mIRCStorm!", 10, 30 60 350 15, hide
  text "Update Found For V2.0!! NOTE: Auto Upgrade replaces your Personality File", 11, 30 60 350 15, hide
  text "Downloading Update... Please Wait....This May Take A Few Minutes, Wait.", 12, 30 60 360 15, hide
  text "Download Complete.... Installing Update.......", 13, 30 60 350 15, hide
  text "Update Complete. You Must Restart Your Bot To Complete.", 14, 30 60 350 15, hide
  text "Restarting Bot....", 15, 30 60 350 15, hide
  Button "Auto Upgrade", 16, 80 150 110 27, hide
  Button "Manual Update", 17, 200 150 110 27, hide
  Button "Get New Version", 18, 140 150 110 27, hide
  Button "Restart Bot", 19, 140 120 110 27, hide

}
on *:dialog:updates:sclick:17:/run http://www.mircstorm.co.uk/updates.php
on *:dialog:updates:sclick:18:/run http://www.mircstorm.co.uk/
on *:dialog:updates:sclick:19:{
  did -h updates 14 | did -v updates 15 
  /restart
}
on *:dialog:updates:sclick:16:{
  /sockclose upgrade
  did -h updates 11 | did -h updates 1 | did -h updates 16 | did -h updates 17 | did -v updates 12 
  if (($readini database\mircstorm.ini Variables ProxyServer != $null) && ( $readini database\mircstorm.ini Variables ProxyPort != $null)) {
    /sockopen upgrade $readini database\mircstorm.ini Variables ProxyServer $readini database\mircstorm.ini Variables ProxyPort
  }
  else { /sockopen upgrade mircstorm.co.uk 80 }

}
;========================================================
;====================Main2 Aliases=======================
;========================================================
alias /Start.Joining.Channels {
  .join %bot.home 
  .timer 1 6 /bot.chan 
}
alias /system.check {
  .strip -burc
  if (!$isdir(Backup)) { mkdir Backup }
  if (!$isdir(Addons)) { mkdir Addons }
  if (!$isdir(Database)) { mkdir Database }
  if (!$isdir(Scripts)) { set %bot.system.check.file Scripts | return 7 | halt }
  if (!$isdir(Images)) { set %bot.system.check.file Images | return 7 | halt }
  if (%bot.nick == $null ) { return 2 | halt } |  if (%bot.nick.2 == $null ) { return 2 | halt } 
  set %bot.server.temp 1 | set %bot.server.flag 0
  while ( %bot.server.temp < 20 ) {
    if ($readini database\mircstorm.ini Variables Server [ $+ [ %bot.server.temp ] ] != $null) { inc %bot.server.flag }
    inc %bot.server.temp
  }
  unset %bot.server.temp
  if ( %bot.server.flag < 2 ) { return 3 | unset %bot.server.flag | halt } 
  unset %bot.server.flag
  set %bot.subversion 0
  writeini database\mircstorm.ini Version Version 20
  if ($readini Database\mircstorm.ini Variables BotCount == $null ) { return 3 | halt } 
  if (!$exists($mircdir/scripts/popups.mrc)) {  set %bot.system.check.file popups.mrc | return 4 | .timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/login.mrc)) {  set %bot.system.check.file login.mrc | return 4 | .timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/CommandTriggers.mrc)) {  set %bot.system.check.file CommandTriggers.mrc | return 4 | .timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/alias.mrc )) { set %bot.system.check.file alias.mrc | return 5 | .timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/CommandSource.mrc)) { set %bot.system.check.file CommandSource.mrc |  return 4 | .timer 1 7 /exit | halt } 
  if (!$exists($mircdir/scripts/dcc.mrc)) { set %bot.system.check.file dcc.mrc |  return 4 | .timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/protections.mrc)) { set %bot.system.check.file protections.mrc |  return 4 | timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/nHTMLn.dll)) { set %bot.system.check.file nHTMLn.dll |  return 4 | timer 1 7 /exit | halt }
  if (!$exists($mircdir/scripts/szip.dll)) { set %bot.system.check.file szip.dll |  return 4 | timer 1 7 /exit | halt }
  unset %bot.system.check.file
  return 1
}
alias /first {
  showmirc -t
  /echo $active 8If Setup Has NOT Loaded Please Run By Right Clicking In The Black Space And Select 'Main Setup' $readini database\mircstorm.ini Variables Logo
  /fsetup 
}
alias /twoopen {
  dialog -om TwoOpen TwoOpen TwoOpen 
  showmirc -t
  halt
}
alias /Startup {
  .write -c mIRCStorm.pid The Bot Has Been Started, Don't Ya Know $chr(124) http://www.mircstorm.co.uk  | /echo $active 8Pid File Written Ok.
  .echo $active 8Checking mIRC Version... 
  .echo $active 8Setting Variables... 
  unset %bot.two.open |  writeini database\mircstorm.ini Version Beta 7 |  writeini database\mircstorm.ini Version SubVersion 0 |  writeini database\mircstorm.ini Version Version 20 | unset %bot.dcc.join.play 
  set %bot.shortcut.4 *** | set %bot.dcc.count 0 | set %bot.dcc.c 1
  while ( %bot.dcc.nick. [ $+ [ %bot.dcc.c ] ] != $null ) {
    unset %bot.dcc.nick. [ $+ [ %bot.dcc.c ] ]
    inc %bot.dcc.c
  }
  unset %bot.dcc.c
  .echo $active 8Performing System Check... 
  /rehash.die
  if ( (!$readini database\mircstorm.ini Variables Owner) && ($readini Database\mircstorm.ini Variables BotCount > 1) ) { 
  /dialog -rmdo addowner addowner addowner } | if ($readini Database\mircstorm.ini Variables BotCount == 4) { /run www.mIRCStorm.co.uk } | writeini database\mircstorm.ini Variables Logo 7*10mIRCStorm V2.0.07* | writeini database\mircstorm.ini Variables Logo2 10***** | writeini database\mircstorm.ini Variables BlankLogo *mIRCStorm V2.0.0* |  if ($readini Database\mircstorm.ini Variables BotCount == 2) { /checknews }
  .echo $active 8Attempting To Connect To IRC... 
  if (%bot.timeout == $null) { set %bot.timeout 120 }
  set %bot.start.server.temp 1
  while ( %bot.start.server.temp < 14 ) {
    if ( $readini database\mircstorm.ini Variables Server [ $+ [ %bot.start.server.temp ] ] != $null ) { 
      /server $readini database\mircstorm.ini Variables Server [ $+ [ %bot.start.server.temp ] ] $readini database\mircstorm.ini Variables Port 
      if (%bot.server.notice) { echo $active 8Server: $readini database\mircstorm.ini Variables Server [ $+ [ %bot.start.server.temp ] ] ( $+ $readini database\mircstorm.ini Variables Port $+ ) ... Time Out At $calc(%bot.timeout / 60) Min(s) }
      break
    }
    inc %bot.start.server.temp
  }
  set %bot.server.number 2 | unset %bot.connected.count | unset %bot.start.server.temp
  .timer 1 %bot.timeout /getconnected 
  if (%bot.splash == $null) { did -a Startup 6 Success! | .timer 1 3 dialog -x Startup Startup Startup | write -n modes.log $chr(91) $+ $date $time $+ $chr(93) !LOADED! $readini database\mircstorm.ini Variables BlankLogo Loaded Successfully }
}
alias /checknews {
  /dialog -m mIRCStormIE mIRCStormIE mIRCStormIE
  echo –a $dll(Scripts\nHTMLn.dll,attach,$dialog(mIRCStormIE).hwnd) 
  echo -a $dll(Scripts\nHTMLn.dll,navigate,http://mircstorm.co.uk/mircstormnews.php)

}


;========================================================
;================Other Trigger Events====================
;========================================================
on *:Join:#:{
  set %bot.dcc.command Joined Channel $chan | set %bot.dcc.command.nick $nick | unset %bot.dcc.command.chan  | /dcctalk
  if (%bot.voiceall. [ $+ [ $chan ] ] ) { mode $chan +v $nick }
  if (%bot.autoop. [ $+ [ $chan ] ] ) { /autoop2 $nick $chan 1 }
  if (%bot.autovoice. [ $+ [ $chan ] ] ) { /autovoice2 $nick $chan 1 }
  if (($readini database\mircStorm.chan $chan $nick == 4) || ($readini database\mircStorm.chan $chan $nick == 3)) { /opbots.2 }
  if ($nick != $me) { set %bot.dcc.command User Joined Channel $chan | set %bot.dcc.command.nick $nick | unset %bot.dcc.command.chan  | /dcctalk }
  if ($nick == $me) { writeini database\mircStorm.GID Login $address($me,5) HasDoneLoginOk | set %bot.dcc.command I've Joined Channel $chan | set %bot.dcc.command.nick $nick | unset %bot.dcc.command.chan  | /dcctalk }
  if (%bot.log. [ $+ [ $chan ] ] ) { .log on $chan }
  if (($chan == %bot.home) && (%bot.channel.ops)) { .timer 1 20 /noops $chan }
  if ((%bot.others.ops) && ($chan != %bot.home))  { .timer 1 20 /noops $chan }
}
on *:EXIT:{
  if (%bot.two.open == $null) {
    echo $readini database\mircstorm.ini Variables Logo2 8.pid File Removed, Shutting Down... $readini database\mircstorm.ini Variables Logo 
    .remove mIRCStorm.pid
    write -n modes.log $chr(91) $+ $date $time $+ $chr(93) !SHUTDOWN! $readini database\mircstorm.ini Variables BlankLogo Shut Down Succesfully 
    save -rv remote.ini	
  }
}
on *:quit:{
  /writeini -n database\data.seen data $nick $fulldate With The Message ( $1- ) 
  /remini database\mircStorm.GID login $fulladdress
  set %bot.dcc.command AUTO-LOGOUT | set %bot.dcc.command.nick $nick | set %bot.dcc.command.chan Quit | /dcctalk 
}
on *:OP:#:{
  if ($opnick == $me) { /mode $chan $readini database\mircstorm.ini DefualtModes ChanMode | /autoop2 }
}
on *:DEOP:#:{
  if ($readini database\mircStorm.chan $chan $opnick == 4 ) { /opbots.2 }
  if ( $opnick == $me ) { /msg %bot.home Warning I Have Been Deoped In $chan By $nick }
}
on *:part:#:{
  if ($nick != $me) { set %bot.dcc.command User Parted Channel $chan | set %bot.dcc.command.nick $nick | unset %bot.dcc.command.chan  | /dcctalk }
  if ($nick == $me) { set %bot.dcc.command I've Parted Channel $chan | set %bot.dcc.command.nick $nick | unset %bot.dcc.command.chan  | /dcctalk }
  /writeini -n database\data.seen data $nick $fulldate With The Message ( $1- ) 
  /writeini -n database\mircstorm.user AutoLogout $nick $fulladdress | .timerlogcheck 1 8 /remini database\mircstorm.user AutoLogout $nick | .timerlogcheck2 1 8 /logout2 $nick $fulladdress
}
on 1:SNOTICE:*You were force*:/msg %bot.home $readini database\mircstorm.ini Variables BlankLogo I Have Been Forced To Join A Channel By A IRCOper!!
on 1:ERROR:*too many channels open*:/msg %bot.home I Can Not Join. I Have The Maxium Amount Of Channels Open. Please Remove The Channel. ( $1- )
on 1:ERROR:*banned*:/disconnect | set %bot.ERROR.msg $1- | /echo $active $readini database\mircstorm.ini Variables Logo2 8I Have Been Banned From This Server ( %bot.ERROR.msg ) $readini database\mircstorm.ini Variables Logo
on 1:ERROR:*server full*:/echo $active $readini database\mircstorm.ini Variables Logo2 8Server Is FULL, Attempting To Connect To Next Server In List. $readini database\mircstorm.ini Variables Logo | /getconnected
on 1:ERROR:*:/amsg I Have Recived An Error From The Server, Moving Servers. Please Op Your Self. $readini database\mircstorm.ini Variables Logo | .timer 1 3 /getconnected
ctcp *:*PING*:/notice $nick 7PONG! $readini database\mircstorm.ini Variables Logo
ctcp *:TIME:{
  /notice $nick The Time On My Computer is: $time $+ . $readini database\mircstorm.ini Variables Logo 
  set %bot.dcc.command Time Request |  set %bot.dcc.command.nick $nick | /dcctalk | halt
}
ctcp *:VERSION:{
  /raw -q NOTICE $nick : $+ $chr(01) $+ VERSION $readini database\mircstorm.ini Variables Logo by 7Evil_Dave $+ $chr(01) 
  set %bot.dcc.command Version Request |  set %bot.dcc.command.nick $nick | /dcctalk | halt
}
;on *:TEXT:*:?:/close -m
on *:PLAYEND:{
  if ( PerformBefore isin $filename ) {
    /join %bot.home 
    /echo $active  | /echo $active $readini database\mircstorm.ini Variables Logo2 7 Bot Responding To [ %bot.shortcut.1 ] $+ , [ %bot.shortcut.2 ] $+ , [ %bot.shortcut.3 ] $+ , [ %bot.shortcut.5 ] 
    /botreponse | /bot.chan 
  }
}
on *:ctcpreply:*ping*:{
  set %pr1 $ctime - $2
  set %pr2 $round(%pr1,0)
  set %pr3 $round(%pr1,0)
  set %pr4 20 - %pr2
  if ((%pr2 == 1) || (%pr2 == 0)) { notice %bot.ctcp.ping PING reply: %pr3
    $seconds second from $server ( %bot.nick Using $readini
  Database\mircstorm.ini Variables Logo  ) | halt }
  if ((%pr2 > 1) || (%pr2 <= 20)) { notice %bot.ctcp.ping PING reply: %pr3
    $seconds seconds from $server ( %bot.nick Using $readini
  Database\mircstorm.ini Variables Logo  ) | halt }
  if (%pr2 isnum 21-500) { notice %bot.ctcp.ping PING reply: %pr3 seconds
    from $server ( %bot.nick Using $readini Database\mircstorm.ini Variables
  Logo ) | halt }
}
;Above ctcpreply by Oyr79 (oyr79@mircstorm.co.uk)
ON *:signal:SZIP: { 
  echo 10 -ts SZIP SIGNAL :: $1-
}

;========================================================
;=====================Socket Code========================
;========================================================
on *:sockopen:update:{
  unset %bot.update.connection
  if ($sockerr > 0) { did -v updates 5 | did -v updates 1 | did -h updates 4 | halt }
  /sockwrite update GET http://mircstorm.co.uk/Updates2.txt HTTP/1.0 $+ $crlf $+ host: mIRCStorm.co.uk $+ :80 $+ $crlf $+ $crlf 
}
on *:sockread:update:{
  did -h updates 4 | did -v updates 6
  unset %bot.update.connection | unset %bot.update.temp
  sockread -f %bot.update.temp
  write Database\mircstorm.updates %bot.update.temp
  if (End of update isin %bot.update.temp) { did -h updates 6 | did -v updates 7 | .timer 1 1 /update | halt }
}
on *:sockopen:google:{
  if ($sockerr > 0) { .msg %bot.google.chan An Error Has Occurred Connecting To http://www.Google.com | halt }
  /sockwrite google GET http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q= $+ %bot.google $+ &btnI=I%27m+Feeling+Lucky HTTP/1.0 $+ $crlf $+ host: google.com $+ :80 $+ $crlf $+ $crlf  
}
on *:sockread:google:{
  :googlesock
  /sockread -f %bot.google  
  if ($sockbr == 0) { return }
  if ( Location: isin %bot.google ) {
    .msg %bot.google.chan Google Search Results: $right(%bot.google,-10) 
    sockclose google | return
  }
  if ( did not match any documents isin %bot.google ) {
    .msg %bot.google.chan $readini Personality\ $+ %bot.Personality.file Google FoundNoSites
    sockclose google | return
  }
  goto googlesock
}
on *:sockopen:upgrade:{
  if ($sockerr > 0) { ./echo $active 7An Error Has Occurred Connecting To http://www.mIRCStorm.co.uk | halt }
  /sockwrite upgrade GET http://mIRCStorm.co.uk/Downloads/Updates/autoupdates.zip HTTP/1.0 $+ $crlf $+ host: mIRCStorm.co.uk $+ :80 $+ $crlf $+ $crlf  
}
on *:sockread:upgrade:{
  unset %bot.upgrade.done
  :upgradesock
  /sockread -f &upgrade.file  
  if ($sockbr == 0) { return }
  /bwrite autoupdates.zip -1 &upgrade.file
  goto upgradesock
}
on *:sockclose:upgrade:{
  did -h updates 12 | did -v updates 13 
  if ($exists($mircdir\autoupdates.zip $+ )) {
    /dll Scripts\SZip.dll SUnZipFile autoupdates.zip > $mircdir
    .timer 1 2 .remove autoupdates.zip
    did -h updates 13 |  did -h updates 16 |  did -h updates 17 | did -v updates 14 | did -v updates 19
  }
}