mIRC Home    About    Download    Register    News    Help

Print Thread
Custom identifiers stop the entire script. #171017 18/02/07 02:32 AM
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?

Re: Custom identifiers stop the entire script. [Re: paalvaa] #171019 18/02/07 02:45 AM
Joined: Dec 2002
Posts: 2,016
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,016
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-
}

Re: Custom identifiers stop the entire script. [Re: RoCk] #171020 18/02/07 02:56 AM
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

Re: Custom identifiers stop the entire script. [Re: paalvaa] #171021 18/02/07 02:58 AM
Joined: Dec 2002
Posts: 2,016
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,016
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.

Re: Custom identifiers stop the entire script. [Re: RoCk] #171022 18/02/07 03:10 AM
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

Re: Custom identifiers stop the entire script. [Re: paalvaa] #171024 18/02/07 04:17 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
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)