PHP Commands - /include 1.0

By XTZGZoReX on Jan 19, 2008

This is my first piece of code to add PHP-like commands to mIRC.

I don't know if anyone have done this before, but I'm writing these from scratch.

Command: /include
Version: 1.0
Author: XTZGZoReX

Purpose: To include commands from a script file without loading it up.
Usage: /include filename.mrc
Notes: It parses everything in the included file as commands, so please don't have anything else in the file. Also, it doesn't have any error handlers as of now, and doesn't support INI files.

Enjoy!

alias include {
  if ( $right($1,4) != .ini ) {
    var %lines = 1
    while ( %lines <= $lines($1) ) {
      $read($1,%lines) $+ $crlf
      inc %lines
    }
  }
  else {
    halt
  }
}

Comments

Sign in to comment.
Noutrious   -  Jan 20, 2008

$right($1,3) could return ini not .ini, cause you limited it to 3 symbols!

 Respond  
Noutrious   -  Jan 19, 2008

but btw, if ( $right($1,3) != .ini ) {
could it even be .ini, it could be ini i guess!

 Respond  
Noutrious   -  Jan 19, 2008

oh, now i got the idea, sorry.

 Respond  
Noutrious   -  Jan 19, 2008

This is not php, lol.

 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.