Script Loader

By Cold_Fussion on Jan 09, 2011

Screenshots

This is a Script Loaded/Unloader/Editor...

I made this when mirc misteriously unloaded all my scripts... 56 of them :)
i made this for myself but decided to share it with the rest of u...
hope u like this...
i have tested this and it works 100%
if u want things added to it... let me know... if u can make the code shorter please do post updates...
Load to remotes and then right click > Script Loader to start it
Example: BINARY.mrc >> Renamed to Binary.mud << if mud extension isnt in the list, it will be added and then the dialog will scan for that file type and load them into the dialog ***
EDIT: took out haltdef... no idea y it was in there... sorry
EDIT: redid most of the code to allow adding/deleting custom file extensions...
EDIT: made code shorter, took out the double code where it could have been used once... hopefully made it faster... this is the last edit till more ppl reply
EDIT: Updated Dialog Spacing to show full date of creation time... < was minor but now its perfect
Please Report Any Bugs To me thanks :D

;Script Loader By Hyperion (Cold_Fussion on Hawkee.com)
menu * {
  Script Loader:/Sloader
}
alias SLoader {
  if !%Sloader.x { %Sloader.x = -1 | %Sloader.y = -1 }
  if !%ScriptLoader.filetypes { %ScriptLoader.filetypes = mrc mud }
  if !$dialog(Sloader) { dialog -m Sloader Sloader }
}
dialog SLoader {
  title "Script Loader - By Hyperion"
  size %Sloader.x %Sloader.y 275 278
  option dbu
  list 1, 1 38 122 186, size
  list 2, 152 38 122 186, size
  button "Load", 3, 126 43 23 12
  button "Unload", 4, 126 61 23 12
  text "Scripts Not Loaded", 5, 2 6 120 8, center
  text "Loaded Scripts", 6, 153 6 120 8, center
  button "Edit File", 7, 126 124 23 12
  button "Reload Everthing", 8, 114 22 46 12
  text "Path of Script:", 9, 4 230 39 8
  text "Rename Script:", 10, 4 241 40 8
  text "-", 11, 54 230 180 8, center
  edit "", 12, 54 240 145 10
  button "Rename", 13, 203 240 28 10
  text "File Size:", 14, 4 257 69 8
  text "Lines of Code:", 15, 4 267 60 8
  text "File Attr:", 16, 76 257 78 8
  text "Created:", 17, 67 267 94 8
  button "Delete", 18, 126 192 23 12
  text "Total Lines:", 19, 162 17 103 8, center
  text "Total Lines:", 20, 8 17 103 8, center
  text "Total Size:", 21, 8 28 103 8, center
  text "Total Size:", 22, 162 28 103 8, center
  text "Extension:", 23, 157 257 36 8
  text "-", 24, 198 257 22 8, center
  text "Extension:", 25, 165 267 28 8
  button "Add", 26, 231 267 20 8
  edit "", 27, 197 266 33 10, center
  button "Del", 28, 253 267 20 8
}
on *:dialog:SLoader:*:*: {
  if $devent == close {
    unset %load.suf %unload.suf
  }
  if $devent == mouse {
    %Sloader.x = $dialog($dname).x
    %Sloader.y = $dialog($dname).y
  }
  if $devent == init {
    if $did == 0 {
      reload
    }
  }
  if $devent == sclick {
    if $did == 1 {
      did -e $dname 3,7,12,18
      did -b $dname 4,13
      did -u $dname 2
      did -r $dname 12
      did -ra $dname 11 $remove($findfile($mircdir,$did($dname,1).seltext,1),$did($dname,1).seltext)
      did -ra $dname 16 File Attr: $replace($file($+($did($dname,11),$did($dname,1).seltext)).attr,a,Archive)
      did -ra $dname 15 Lines of Code: $bytes($lines($+($did($dname,11),$did($dname,1).seltext)),b)
      did -ra $dname 14 File Size: $bytes($file($+($did($dname,11),$did($dname,1).seltext)).size).suf
      did -ra $dname 17 Created: $asctime($file($+($did($dname,11),$did($dname,1).seltext)).ctime)
      did -ra $dname 24 $gettok($did($dname,1).seltext,2,46)
    }
    if $did == 2 {
      did -e $dname 4,7,12,18
      did -b $dname 3,13
      did -u $dname 1
      did -r $dname 12
      did -ra $dname 11 $remove($script($did($dname,2).seltext),$did($dname,2).seltext)
      did -ra $dname 16 File Attr: $replace($file($script($did($dname,2).seltext)).attr,a,Archive)
      did -ra $dname 15 Lines of Code: $bytes($lines($script($did($dname,2).seltext)),b)
      did -ra $dname 14 File Size: $bytes($file($script($did($dname,2).seltext)).size).suf
      did -ra $dname 17 Created: $asctime($file($script($did($dname,2).seltext)).ctime)
      if $+($did($dname,11),$did($dname,2).seltext) == $script { did -b $dname 4,7,12,18 }
      did -ra $dname 24 $gettok($did($dname,2).seltext,2,46)
    }
    if $did == 3 {
      did -ra $dname 21 Total Size: $bytes($calc(%unload.suf - $file($+($did($dname,11),$did($dname,1).seltext).suf))).suf
      did -ra $dname 22 Total Size: $bytes($calc(%load.suf + $file($+($did($dname,11),$did($dname,1).seltext).suf))).suf
      did -ra $dname 19 Total Lines: $bytes($calc($remove($gettok($did($dname,19),3,32),$chr(44)) + $gettok($did($dname,15),4,32)),b)
      did -ra $dname 20 Total Lines: $bytes($calc($remove($gettok($did($dname,20),3,32),$chr(44)) - $gettok($did($dname,15),4,32)),b)
      did -a $dname 2 $did($dname,1).seltext
      did -ra $dname 5 UnLoaded Scripts: $calc($gettok($did($dname,5),3,32) - 1)
      did -ra $dname 6 Loaded Scripts: $calc($gettok($did($dname,6),3,32) + 1)
      load -rs $+(",$did($dname,11),$did($dname,1).seltext,")
      did -d $dname 1 $did($dname,1).sel
      did -b $dname 3,4,7,13,12,18
      did -ra $dname 14 File Size: -
      did -ra $dname 15 Lines of Code: -
      did -ra $dname 16 File Attr: -
      did -ra $dname 17 Created: -
      did -ra $dname 11,24 -
    }
    if $did == 4 {
      did -ra $dname 21 Total Size: $bytes($calc(%unload.suf + $file($+($did($dname,11),$did($dname,1).seltext).suf))).suf
      did -ra $dname 22 Total Size: $bytes($calc(%load.suf - $file($+($did($dname,11),$did($dname,1).seltext).suf))).suf
      did -ra $dname 19 Total Lines: $bytes($calc($remove($gettok($did($dname,19),3,32),$chr(44)) - $gettok($did($dname,15),4,32)),b)
      did -ra $dname 20 Total Lines: $bytes($calc($remove($gettok($did($dname,20),3,32),$chr(44)) + $gettok($did($dname,15),4,32)),b)
      did -a $dname 1 $did($dname,2).seltext
      did -ra $dname 5 UnLoaded Scripts: $calc($gettok($did($dname,5),3,32) + 1)
      did -ra $dname 6 Loaded Scripts: $calc($gettok($did($dname,6),3,32) - 1)
      unload -rs $+(",$did($dname,11),$did($dname,2).seltext,")
      did -d $dname 2 $did($dname,2).sel
      did -b $dname 3,4,7,13,12,18
      did -ra $dname 14 File Size: -
      did -ra $dname 15 Lines of Code: -
      did -ra $dname 16 File Attr: -
      did -ra $dname 17 Created: -
      did -ra $dname 11,24 -
    }
    if $did == 7 {
      if $did($dname,1).seltext {
        run notepad.exe $+(",$did($dname,11),$did($dname,1).seltext,")
      }
      else {
        run notepad.exe $+(",$script($did($dname,2).seltext),")
      }
    }
    if $did == 8 {
      did -r $dname 1,2,5,6
      unset %unload.suf %load.suf
      reload
    }
    if $did == 13 {
      if $did($dname,1).seltext {
        rename $+(",$did($dname,11),$did($dname,1).seltext,") $+(",$did($dname,11),$did($dname,12),")
        did -o $dname 1 $did($dname,1).sel $did($dname,12)
      }
      else {
        unload -rs $+(",$did($dname,11),$did($dname,2).seltext,")
        rename $+(",$did($dname,11),$did($dname,2).seltext,") $+(",$did($dname,11),$did($dname,12),")
        did -o $dname 2 $did($dname,2).sel $did($dname,12)
        load -rs $+(",$did($dname,11),$did($dname,12),")
      }
      did -b $dname 3,4,7,13,12,18
      did -ra $dname 14 File Size: -
      did -ra $dname 15 Lines of Code: -
      did -ra $dname 16 File Attr: -
      did -ra $dname 17 Created: -
      if $filesleft($did($dname,24)) == 0 { set %ScriptLoader.filetypes $remove(%ScriptLoader.filetypes,$did($dname,24)) }
      did -ra $dname 11,24 -
      var %x = 1
      while %x <= $numtok(%ScriptLoader.filetypes,32) {
        if $gettok(%ScriptLoader.filetypes,%x,32) == $gettok($did($dname,12),2,46) {
          goto sloaderend
        }
        inc %x
      }
      %ScriptLoader.filetypes = %ScriptLoader.filetypes $gettok($did($dname,12),2,46)
      did -r $dname 1,2,5,6
      unset %unload.suf %load.suf
      reload
      :sloaderend
      did -r $dname 12
    }
    if $did == 18 {
      if $did($dname,1).seltext {
        did -ra $dname 21 Total Size: $bytes($calc(%unload.suf - $file($+($did($dname,11),$did($dname,1).seltext).suf))).suf
        remove $+(",$did($dname,11),$did($dname,1).seltext,")
        did -d $dname 1 $did($dname,1).sel
        did -ra $dname 5 UnLoaded Scripts: $calc($gettok($did($dname,5),3,32) - 1)
        did -u $dname 1
      }
      else {
        did -ra $dname 22 Total Size: $bytes($calc(%load.suf - $file($+($did($dname,11),$did($dname,2).seltext).suf))).suf
        unload -rs $+(",$did($dname,11),$did($dname,2).seltext,")
        remove $+(",$did($dname,11),$did($dname,2).seltext,")
        did -d $dname 2 $did($dname,2).sel
        did -ra $dname 6 Loaded Scripts: $calc($gettok($did($dname,6),3,32) - 1)
        did -u $dname 2
      }
      did -b $dname 3,4,7,13,12,18
      did -ra $dname 14 File Size: -
      did -ra $dname 15 Lines of Code: -
      did -ra $dname 16 File Attr: -
      did -ra $dname 17 Created: -
      if $filesleft($did($dname,24)) == 0 { set %ScriptLoader.filetypes $remove(%ScriptLoader.filetypes,$did($dname,24)) }
      did -ra $dname 11,24 -
    }
    if $did == 26 {
      var %x = 1
      while %x <= $numtok(%ScriptLoader.filetypes,32) {
        if $gettok(%ScriptLoader.filetypes,%x,32) == $did($dname,27) {
          goto sloaderend3
        }
        inc %x
      }
      %ScriptLoader.filetypes = %ScriptLoader.filetypes $did($dname,27)
      did -r $dname 1,2,5,6
      unset %unload.suf %load.suf
      reload
      :sloaderend3
      did -r $dname 27
    }
    if $did == 28 {
      %ScriptLoader.filetypes = $remove(%ScriptLoader.filetypes,$did($dname,27))
      did -r $dname 27
      did -r $dname 1,2,5,6
      unset %unload.suf %load.suf
      reload
    }
  }
  if $devent == edit {
    if $did == 12 {
      if $exists($+(",$did($dname,11),$did($dname,12),")) || $gettok($did($dname,12),0,46) != 2 {
        did -b $dname 13
      }
      if !$exists($+(",$did($dname,11),$did($dname,12),")) && $gettok($did($dname,12),0,46) == 2 {
        did -e $dname 13
      }
    }
    if $did == 27 {
      if $len($did($dname,27)) > 0 { did -e $dname 26,28 }
      else { did -b $dname 26,28 }
      if $did($dname,27) !isalpha {
        did -ra $dname 27 $left($did($dname,27),$calc($len($did($dname,27))-1))
      }
    }
  }
}
alias -l reload {
  var %x = 1
  while %x <= $numtok(%ScriptLoader.filetypes,32) {
    loading $gettok(%ScriptLoader.filetypes,%x,32)
    inc %x
  }
  did -ra $dname 5 UnLoaded Scripts: %unload
  did -ra $dname 20 Total Lines: $bytes(%unload.lines,b)
  did -ra $dname 6 Loaded Scripts: %load
  did -ra $dname 19 Total Lines: $bytes(%load.lines,b)
  did -ra $dname 21 Total Size: $bytes(%unload.suf).suf
  did -ra $dname 22 Total Size: $bytes(%load.suf).suf
  unset %load %load.lines %unload %unload.lines
  did -b $dname 3,4,7,13,12,18,26,28
  did -ra $dname 14 File Size: -
  did -ra $dname 15 Lines of Code: -
  did -ra $dname 16 File Attr: -
  did -ra $dname 17 Created: -
}
alias -l FilesLeft {
  return $findfile($mircdir,$+(*.,$1),0)
}
alias -l Loading {
  var %xx = $findfile($mircdir,*. $+ $1,0)
  var %x = 1
  while %x <= %xx {
    var %script = $findfile($mircdir,*. $+ $1,%x)
    if $script($gettok($findfile($mircdir,*. $+ $1,%x),$gettok($findfile($mircdir,*. $+ $1,%x),0,92),92)) {
      did -a $dname 2 $nopath(%script)
      inc %load.lines $lines(%script)
      inc %load
      inc %load.suf $file(%script).size
    }
    else {
      did -a $dname 1 $nopath(%script)
      inc %unload
      inc %unload.lines $lines(%script)
      inc %unload.suf $file(%script).size
    }
    inc %x
  }
}

Comments

Sign in to comment.
Vegitha   -  Mar 08, 2011

awesome code, keep up the good work :D

 Respond  
FangBanger   -  Jan 24, 2011

Kingc44 i can't kill your ant!! :) Anyways Very nice Cold_Fussion not to mention your so cute! :) I'm trying to Work on a Decent Blackjack, VideoPoker, Card game that does not flood channels and sends all the nick playing's cards etc in /onotice Plus to set a timer so each player can only play like 2 games per 3 minutes er so but my channel is a lil more laid back than that. But if It was to go to a big channel, i need to let it set there own timers. Anyhoo my nick is Sookie, im on Dalnet and on the channel #TrueBlood of coarse :D HAppy coding all :D

Cold_Fussion  -  Jul 29, 2017

You still on here?

Sign in to comment

Cold_Fussion   -  Jan 20, 2011

Firstmate... thanks for the input, sorry just had family shit this side.... flew back from Cape Town aswell... but i will look into making the code faster now... thanks again...

im sure 100 ticks isnt alot on fast machines, but not everyone has a fast machine, will post the update as im done :D

Sorry about my shit reply earlier

 Respond  
Firstmate   -  Jan 20, 2011

Actually I benchmarked it myself, they are about the same ticks (my method being on average faster)

But hey, your code. Do what you want.

 Respond  
Firstmate   -  Jan 16, 2011

Version 6.21 did not do anything to your $mircdir directory path. There is no need for that code you wrote (/help $qt by the way).

And you still are making the code longer than it needs to be. $findfile can accept multiple file extensions. Rather the code should be re-written to allow multiple directories.

 Respond  
Cold_Fussion   -  Jan 15, 2011

could be something i'm doing....but, it doesn't work for me! :( for some reason it doesn't show all of the scripts..it only shows 3. (2 unloaded and 1 loaded - of hundreds) These scripts are located in the same place as all my other scripts
and yes, i read comments and noticed that all scripts need to be in the $mircdir* so I made sure that is where they are. any idea as to why it would do this?

[i]concur...... as i said its cos or ur $mircdir.........
if u use mirc higher than 6.21 i think it changes ur mirc directory to something hectic like: /users/so forth...... get all ur scripts to where ur mirc.exe is and this code could help u change ur default folder for $mircdir

;MAKING DEFAULT FOLDER FOR MIRC
on *:START: {
  if !$exists($+($remove($gettok($mircexe,1-,92),mIRC.exe),Sounds)) {
    run $+(",$mircexe,") -r" $+ $remove($gettok($mircexe,1-,92),mIRC.exe) $+ "
    exit -n
  }
}

that code needs ur mirc.ini and servers.ini file in with ur mirc.exe or else it will create new ones and u would need to config mirc again.......
*NB also i take no responsibility to change ur mirc directory for $mircdir...

 Respond  
Firstmate   -  Jan 14, 2011

/help $findfile

You can specify multiple wildcards by separating them with semi-colons, eg. .exe;.txt;*.hlp.

 Respond  
[i]concur   -  Jan 14, 2011

could be something i'm doing....but, it doesn't work for me! :( for some reason it doesn't show all of the scripts..it only shows 3. (2 unloaded and 1 loaded - of hundreds) These scripts are located in the same place as all my other scripts
and yes, i read comments and noticed that all scripts need to be in the $mircdir* so I made sure that is where they are. any idea as to why it would do this?

 Respond  
Cold_Fussion   -  Jan 12, 2011

lol... napa i dnt use it though... when i do its for testing my servers security...

 Respond  
napa182   -  Jan 12, 2011

lmao @ having Clonesxs in there ffs

 Respond  
Kingc44   -  Jan 11, 2011

nice indeed 10/10

 Respond  
chorao   -  Jan 10, 2011

good ideia! =)

 Respond  
eNkIL   -  Jan 10, 2011

9/10 :)

 Respond  
Cold_Fussion   -  Jan 10, 2011

that's the way it should be... coding is passion... without the need to want to code, its not worth it... :D glad u doing ur thing

 Respond  
xdesoto   -  Jan 10, 2011

you got me trying to make my own Scriptloader

 Respond  
Cold_Fussion   -  Jan 10, 2011

:) the all out war script is a script i made to auto play All out War irc game for me... but thats the old one, i made a proper dialog version aswell...... with custom sounds and so on... but thats another story

 Respond  
xdesoto   -  Jan 10, 2011

eh that's where all my mrc's anyways, So I have no problem with that.
I like your theme though..
And you have a lot of mrc's
I have only 20 :/
Oh and loL @ ALL OUT WAR SCRIPT.mrc

 Respond  
Cold_Fussion   -  Jan 10, 2011

sweet man, glad i could help.... remember the scripts it scans for atm is in ur $mircdir* but ill add in functionality for other folders 2...

 Respond  
xdesoto   -  Jan 10, 2011

Ah, A lifesaver... for some reason my script on my thumbdrive doesn't like to load the mrc's
so yeah *uses and votes 10/10

 Respond  
Cold_Fussion   -  Jan 10, 2011

thanks Clayton... this feedback makes me want to code new scripts for here...

 Respond  
Clayton   -  Jan 10, 2011

Very nice snippet.

10/10 :)

 Respond  
Cold_Fussion   -  Jan 09, 2011

Firstmate - this script allows for loading of scripts in ur $mircdir directory... maybe later on ill add what u asked for...

 Respond  
Firstmate   -  Jan 09, 2011

The ability to load scripts from multiple locations would be better.

 Respond  
Cold_Fussion   -  Jan 09, 2011

sunslayer its a theme i used in windows 7...
this is the full image and info on what u are requesting > http://www.hawkee.com/profile/img/284201/

 Respond  
cupcake   -  Jan 09, 2011

very nice snippet impressive :)

 Respond  
sunslayer   -  Jan 09, 2011

what theme is that in your screen shot?

 Respond  
Cold_Fussion   -  Jan 09, 2011

thanks man... will add in a place where u can add user defined extensions for loading different types of scripts... and an alias tab....

 Respond  
_Teen_   -  Jan 09, 2011

nice script, 8/10

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.