mIRC Home    About    Download    Register    News    Help

Print Thread
#254991 12/09/15 07:34 PM
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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. $+
}

Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
You can use $2

/help $1 for more info


Matti
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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.

Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
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

Last edited by Wims; 12/09/15 09:45 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
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"?

Last edited by Artiiz; 13/09/15 07:09 PM.
Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
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)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
Thanks <3


Link Copied to Clipboard