mIRC Homepage
Posted By: Artiiz Help about Identifiers - 12/09/15 07:34 PM
Hello,

I was just wondering..
Is there some Identifier which makes you able to target an viewer with a command I've added?

Like if someone asks for resolution in a stream, I can type !res <nick>, and then the bot says @"nick" 1920x1080.

I've done this so far, but I can't find the right Identifier for taget, or if there even is one.

Code:
on 1:text:*!res*:#artiiz:{
  msg $chan @ $+ $+ 1920x1080. $+
}
Posted By: MattiSony Re: Help about Identifiers - 12/09/15 07:38 PM
You can use $2

/help $1 for more info
Posted By: Nillen Re: Help about Identifiers - 12/09/15 07:39 PM
In an on text event, the second word you type will be the $2 identifier.

Using @ $+ $2 will in in this case turn to @nillen assuming $2 == nillen.
Posted By: Artiiz Re: Help about Identifiers - 12/09/15 09:30 PM
Thanks alot smile

Also, is there a way of making the commmand not being able to trigger in a message?
I've tried doing like this:
Code:
on 1:text:*!res*:#artiiz:{
  msg $chan @ $+ $2 1920x1080. $+
}

But that doesn't seem to work, I need to put *!res* for it to work, but the problem is that then the command will trigger if you have !res in a text message, and will be fucked up.
Posted By: Wims Re: Help about Identifiers - 12/09/15 09:44 PM
There is no difference in the trigger you used and in your first post, probably a typo.
Although it's probably obvious you want it to start with it, you only stated you didn't want it to appear anywhere in the text.
The matchtext !res* would trigger for any message starting with !res, while this is better than anywhere in the message, it still would match on !responsabilities for example, where $2 doesn't even exist.
To make sure it only trigger with the first word = !res and that you want a second word, use "!res &". The & indicate a full word
Posted By: Artiiz Re: Help about Identifiers - 13/09/15 07:08 PM
Originally Posted By: Wims
There is no difference in the trigger you used and in your first post, probably a typo.
Although it's probably obvious you want it to start with it, you only stated you didn't want it to appear anywhere in the text.
The matchtext !res* would trigger for any message starting with !res, while this is better than anywhere in the message, it still would match on !responsabilities for example, where $2 doesn't even exist.
To make sure it only trigger with the first word = !res and that you want a second word, use "!res &". The & indicate a full word


Thanks, that made it work smile

Just one more question before this thread can be locked.
Code:
alias todate {
  var %month = 09
  var %day = 14
  var %year = 2015

  var %todate = $calc($ctime($+(%day,-,%month,-,%year) 14:0:0) - $ctime)
  if (%todate < 0) {
    inc %year
    %todate = $calc($ctime($+(%day,-,%month,-,%year) 14:0:0) - $ctime)
  }
  return %todate
}
on 1:TEXT:!test:#artiiz:{
  msg $chan @ $+ $nick live in about $duration($todate($2,$3),2)) $+
}


On this picture below,

Is there a way in the script (in the Code above), to make it show 16h 53m instead of "hrs" and "mins"?
Posted By: Wims Re: Help about Identifiers - 13/09/15 07:18 PM
Of course!

$duration($todate($2,$3),2)) is returning that result, since $duration() will only ever return a duration, we can safely replace "hrs" by "h" and "mins" by "m", with $replace:

Code:
$replace($duration($todate($2,$3),2)),hrs,h,mins,h)
Posted By: Artiiz Re: Help about Identifiers - 13/09/15 07:31 PM
Thanks <3
© mIRC Discussion Forums