mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
Code:
on *:input:*: {
  if ( $1 == .php ) {
    <?php
    require rawr.txt
    ?>
  }
}

alias <?php {
  set %php true
}

alias ?> {
  unset %php
}

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

alias require {
  if ( %php == true ) {
    if ( $exists($1) != $true ) {
      echo -a * /require: error loading $1 $+ , halting script...
      halt
    }
    elseif ( $exists($1) == $true ) {
      if ( $right($1,4) != .ini ) {
        var %lines = 1
        while ( %lines <= $lines($1) ) {
          $read($1,%lines) $+ $crlf
          inc %lines
        }
      }
      else {
        halt
      }
    }
  }
  else {
    halt
  }
}



Now, this is all good, but the ?> doesn't unset %php for some reason. I can't figure out why.

Any ideas?

Thanks.


GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Just use /return instead of /halt, /halt, see /help /return and /help /halt


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2007
Posts: 65
X
Babel fish
OP Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
Quote:
The /return command halts a currently executing script and allows the calling routine to continue processing.


So if I use that instead of halt in my /require, it will still continue down to the ?> and unset %php?


GamerzWoW
The Official GamerzPlanet WoW Server
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Yes.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard