mIRC Home    About    Download    Register    News    Help

Print Thread
#225580 05/09/10 11:28 AM
Joined: Sep 2010
Posts: 1
L
lclhst Offline OP
Mostly harmless
OP Offline
Mostly harmless
L
Joined: Sep 2010
Posts: 1
In my script I want to check if the first character of a parameter is the command prefix.

You can configure the command prefix under "other" in settings. It must be saved as some variable right?

I can define my own and then use %commandprefix but I'd rather use the one mIRC also uses.

My alias is like this:
Code:
alias np {
  me now playing: $dde(mPlug,format,"%s")
  if ($1 != $null) {
    if ($left($1, 1) == VARIABLE) {
      $1-
    }
    else {
      say $1-
    }
  }
}


Can anyone help me with this? smile

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
I believe you're looking for $readini(mirc.ini,n,text,commandchar)

Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Do keep in mind that / stays working as a command variable, even if you specify a different one.

So you should check something like:

Code:
if $left($1, 1) != / && $left($1, 1) != $readini($mircini, text, commandchar) {


Learning something new every day.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
And you should normally also check for $ctrlenter and $inpaste.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Why exactly would one want to check for $inpaste? I'm a little clueless as to what difference it makes, since it seems like mIRC treats a bunch of lines pasted at once the same as when each line is entered individually.


Learning something new every day.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Normally, if you're pasting many lines (such as a script), you don't want to change the output from what the original is. $inpaste only works for single line edit boxes and *maybe* automatic edit boxes. It doesn't work in multi-line edit boxes. It's just like if you're using Ctrl-Enter or using a command... You don't usually want the output changed, so you'd want to ignore the script at that point. Depending on what you're doing in the script, maybe it won't hurt to have the script run even on Ctrl-Enter or when pasted. If that's the case, then you don't have to check for those.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
You need to press enter separately for automatic editboxes, so $inpaste won't work there either.

I see the point in $ctrlenter. I just don't see the point in $inpaste, but that could just be me.


Learning something new every day.

Link Copied to Clipboard