FILE LOADER

By Lucius on Aug 18, 2010

It's all there below, I made this for a friend and thought I'd add it here too.

It's built to work when loaded multiple times.

This is most useful if you have many trigger games which sometimes conflict.

add your own
if ($nick isop) { etc to the trigger if you wish.
right now it will work for anyone.

;################################################################################################################LUCIUS
;###############       READ ME           READ ME           READ ME            READ ME        ####################LUCIUS
;################################################################################################################LUCIUS
;#### IF YOU HAVE ANY PROBLEMS, try typing /unset %currentgame*                                        ##########LUCIUS
;#### That will unset the extra files memory as well as the first one.                                 ##########LUCIUS
;#### This Script is made to be used multiple times so copy/paste everything with each new trigger     ##########LUCIUS
;#### this Script will load any file that is your MAIN irc folder so long as it is there.              ##########LUCIUS
;#### I have added info lines with ;####  so read each one, as you are changing the lines below them.  ##########LUCIUS
;################################################################################################################LUCIUS

;#### change the trigger name below here
on $*:TEXT:/\B!enable gamename\b/iS:#: {
  if ( [ $chr(33) $+ enable ] == $1) && (!%floodcheck) {
    set -u2 %floodcheck ON

   ;####  edit the var  below to the file you wish to load.
    var %SCRIPTname  whatever_your_file_is_called

   ;#### edit the var below to the name of the game
   var %GAMEname whatever_game_is_called

    if (%currentgame) {
      if (%SCRIPTname !isin %currentgame) {
        var %check 1
        while (%currentgame $+ [ %check ] ) {
          [ un [ $+ %currentgame $+ [ %check ] ] ]
          unset %currentgame $+ [ %check ] 
          inc %check
        }
        [ un [ $+ %currentgame ] ]
        if (%check > 1) { var %unloadcount Total sections disabled ( $calc(%check - 1) ) }
        msg $chan $remove(%currentgame,load -rs,.mrc) is disabled. %unloadcount
        unset %currentgame
      }

      else { msg $chan %GAMEname is already enabled!
    }   
    if (!%currentgame) {
      set %currentgame load -rs [ %SCRIPTname ]

      ;#### The lines below are for loading more scripts on the one trigger.  
      ;#### Just remove the ;#### and rename SCRIPTname to the other files you wish to load at the same time
      ;#### If you need more scripts loaded, copy paste and continue to raise the number by 1   (%currentgame6 etc)

      ;#### set %currentgame1 load -rs SCRIPTname 
      ;#### set %currentgame2 load -rs SCRIPTname 
      ;#### set %currentgame3 load -rs SCRIPTname 
      ;#### set %currentgame4 load -rs SCRIPTname 
      ;#### set %currentgame5 load -rs SCRIPTname 

      msg $chan You have enabled the %GAMEname triggers! (add trigger help info here if you wish)
      [ %currentgame ] 
      var %checkload 1
      while (%currentgame $+ [ %checkload ] ) {
        [ %currentgame $+ [ %checkload ] ]
        inc %checkload
      }
    } 
  }
}

Comments

Sign in to comment.
Lucius   -  Aug 18, 2010

Thanks Jethro_, and you are right Serpentsounds, as I said I just threw it together for a friend. I'll make the changes here.

edited. I was going to put the multiple load script vars at the top but decided that:
a) if you want to load multiples at once, you are better off having some skill in looking at scripts
b) I couldn't be bothered lol

 Respond  
Serpentsounds   -  Aug 18, 2010

Having people replace things in the middle of the script is not a very good practice, especially when they appear multiple times. Rather, you should make local identifiers at the top of script to be editable. It's much cleaner and easier on the user that way. :]

 Respond  
Jethro   -  Aug 18, 2010

You should strip out the control codes. The current text event trigger you have won't respond to those who use them, be that colors, bold or underline...especially if you don't have the mirc set to strip them out in the first place. This is best done using regex:

on $*:TEXT:/\B!enable gamename\b/iS:#: {
 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.