mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2005
Posts: 14
P
paalvaa Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: Sep 2005
Posts: 14
I have two custom identifiers. While they're in the script, the script won't react to anything it's supposed to, but when I take them out it works fine. That's a problem, as much of the script is built around them.

Code:
alias dic {
  %dic = $readini(c:\mirc\bots\tradebot\languages\ $+ %lang $+ .ini,Dictionary, $+ $1 $+ )
  return %dic
}

alias msg {
  %msg = $readini(c:\mirc\bots\tradebot\languages\ $+ %lang $+ .ini,Messages,Msg $+ $1 $+ )
  return %msg
}


The identifiers are used as $dic() and $msg(). $dic() should find a word in a small dictionary in an ini file and return the corresponding word in another language. $msg() should call a longer message, which is why I differentiate between them. At the moment, this has never happened.

I've tried to use both /var and /set instead of the current method to set the variables. I've tried skipping the variable part and returning the $readini(). I've tried removing the "alias" in front of the codes. I've tried all of these in all combinations I could think of. The help files weren't much help either, as the example given failed as miserably as these two. I've been trying to figure this out for the last 2 hours, and I've pretty much given up. Could you please help me?

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Try this.

Code:
alias dic {
  var %dic = $readini(c:\mirc\bots\tradebot\languages\ $+ %lang $+ .ini,Dictionary, $+ $1 $+ )
  return %dic
}

alias msg {
  if ($isid) {
    var %msg = $readini(c:\mirc\bots\tradebot\languages\ $+ %lang $+ .ini,Messages,Msg $+ $1 $+ )
    return %msg
  }
  else $iif($show,msg,.msg) $1-
}

Joined: Sep 2005
Posts: 14
P
paalvaa Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: Sep 2005
Posts: 14
Hey, I think it works... I'll be testing it for a while smile

Thanks.

By the way, mind telling me what you did? And, if possible, what I did wrong? :3

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
You created an alias with the same name of an internal command.
All I did was to add in a check for identifier, if it's not used as an
identifier, it passes the command along to the internal command.

As a rule I avoid overriding mIRC commands.

Joined: Sep 2005
Posts: 14
P
paalvaa Offline OP
Pikka bird
OP Offline
Pikka bird
P
Joined: Sep 2005
Posts: 14
Ah... but I thought... identifiers... >_<

I see. I should've realized the problem. Thanks for your help smile

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
smile Out of curiosity and good will, is there a need to create the variable first?

Why Not:

alias dic return $readini(c:\mirc\bots\tradebot\languages\ $+ %lang $+ .ini,Dictionary,$1)



Link Copied to Clipboard