ScriptLoader V2.0

By knoeki on Dec 01, 2008

useful for bots when you want to load a file from another client.

supports error checking, check if files exist and also if files are actually loaded.

you may need to change some stuff to get it to work for you, such as your default script directory and the access level. I might add a setup trigger for this if people really want that.

how to use:

!load foo.bar
will load file 'foo.bar' and outputs status to the current channel

!load -s foo.bar
will load file 'foo.bar' and notices the status to you instead of sending it to the channel.

If you find any problems, please let me know. telling me on IRC is always faster.

;############## SCRIPTLOADER V2 #############  
;#                                          #
;#          (C) Knoeki/zOWB 2008            #
;#                                          #
;#               Visit us at                #
;#                                          #
;#         http://zomgwtfbbq.info           #
;#                  -OR-                    #
;#    irc.p2p-network.net / #zomgwtfbbq     #
;#                                          #
;############################################

on 1600:text:!load*:#: {
   if ($2 == $null) {
      msg $chan Syntax: !load [-s] foobar.mrc
   }
   elseif ($2 == -s) {
      notice $nick Searching for " $+ $3 $+ "... o.o
      if ($exists(scripts\ $+ $3) == $true) {
         notice $nick Loading... ^^
         /load -rs scripts\ $+ $3
         if ($script($3) == $null) {
            notice $nick Failed to load file. x.x;
         }
         else {
            notice $nick Ready. ^_^
         }
      }
      else {
         notice $nick File not found... >.>;
         halt
      }
   }
   else {
      msg $chan Searching for " $+ $2 $+ "... .. . o.o
      if ($exists(scripts\ $+ $2 $+) == $true) {
         msg $chan Loading... ^^
         /load -rs scripts\ $+ $2
         if ($script($2) == $null) {
            msg $chan Failed to load file. (x.x);
         }
         else {
            msg $chan Ready. ^_^
         }
      }
      else {
         msg $chan File not found... >.>
      }
   }
}

Comments

Sign in to comment.
zainul   -  Dec 16, 2008

ah ok thanks wanted to know how to add it as a code hehe and by the way i wanted to ask is there a way to check if the script is already loaded ?

 Respond  
Bullet_Dodger   -  Dec 16, 2008

Zainul Put [.Code] Code here [./code] without the dots when pasting codes lolol

Eg.

on 1600:text:*:#: {
if ($1 == !load) && (!$2) {
msg $chan Syntax: !load script-name.mrc
}
elseif ($1 == !load) && ($2) {
msg $chan Searching for " $+ $2 $+ "... .. . o.o
if ($exists(scripts\ $+ $2 $+) == $true) {
msg $chan Loading...
timer 1 3 msg $chan Ready ^_^
/load -rs scripts\ $+ $2
}
else {
msg $chan File not found... >.>
}
}
if ($1 == !unload) && (!$2) {
msg $chan Syntax: !Unload script-name.mrc
}
elseif ($1 == !unload) && ($2) {
msg $chan Searching for " $+ $2 $+ "... .. . o.o
if ($exists(scripts\ $+ $2 $+) == $true) {
msg $chan Unloading...
timer 1 3 msg $chan Unloaded
/unload -rs scripts\ $+ $2
}
else {
msg $chan File not found... >.>
}
}
} 
 Respond  
zainul   -  Dec 13, 2008

Try this i would say it might be more helpfull
syntax for use !load script-name.mrc or !unload script-name.mrc

on 1600:text:*:#: {
  if ($1 == !load) && (!$2) {
    msg $chan Syntax: !load script-name.mrc
  }
  elseif ($1 == !load) && ($2) {
    msg $chan Searching for " $+ $2 $+ "... .. . o.o
    if ($exists(scripts\ $+ $2 $+) == $true) {
      msg $chan Loading...
      timer 1 3 msg $chan Ready ^_^
      /load -rs scripts\ $+ $2
    }
    else {
      msg $chan File not found... >.>
    }
  }
  if ($1 == !unload) && (!$2) {
    msg $chan Syntax: !Unload script-name.mrc
  }
  elseif ($1 == !unload) && ($2) {
    msg $chan Searching for " $+ $2 $+ "... .. . o.o
    if ($exists(scripts\ $+ $2 $+) == $true) {
      msg $chan Unloading...
      timer 1 3 msg $chan Unloaded
      /unload -rs scripts\ $+ $2
    }
    else {
      msg $chan File not found... >.>
    }
  }
}
 Respond  
napa182   -  Dec 04, 2008

you would have to edit ur old one then pm hawkee to delete this one.

 Respond  
knoeki   -  Dec 04, 2008

whoops. I'm sorry for that, completely forgot I even put the old one on here... I'll just delete that one as it's obsolete now...

EDIT: I seem to be only able to edit the entry, not delete it. could one of the mods be so friendly? :_)

 Respond  
chadbdurham   -  Dec 02, 2008

napa182, from what I see. You do quite a good job at moderating and helping Hawkee. Thanks for the consideration O.O

 Respond  
napa182   -  Dec 01, 2008

why not update ur old one instead of posting it again
[b]Your snippet will be deleted if you break any of the following rules:

  • DO NOT post new versions as new snippets. You must edit your previous snippet.
    (If you add Snippet v1.0 and Snippet v2.0 as two snippets Snippet v2.0 will be deleted.) [/b]
 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.