mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2015
Posts: 26
A
Anti Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2015
Posts: 26
Hello all,

I'm looking for some idea to send only one time a automatic
answer on a query.

If I use the classic :

on *:TEXT:*:?:msg $nick excuse me , I'm busy ; for example

The trigger start every time $nick send me something.

I want send the answer only one time , eventually with
different answers for different nicks.
How may I do this ?

Thanks all.

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Code:
on *:text:*:?: {
if (!$($+(%,private,$nick),2)) {
set -u100 $+(%,private,$nick) 1
msg $nick excuse me im busy...
}
}

this will send only one reply. What you do in such situation is checking if there is a variable with $nick in it. (which would exist only if you had set it) So.. if there's not a variable you set it and msg. Next time $nick messages you there will be a variable that will stop the script from replying.
P.S i've set the variable to exist for 100 seconds. After that it will reply one more time. If you want different reply each time try adding lines in a .txt file and them put them in the msg with use of $read(filename.txt)

Last edited by OrFeAsGr; 07/03/15 01:10 AM.
Joined: Mar 2015
Posts: 26
A
Anti Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2015
Posts: 26

Overall thanks for you answer.

I don't understand this test :

if (!$($+(%,private,$nick),2)) {

I thing the test is :

if (!$(%privatenickname),2)) {

What's statement is this ?
What's the comparision ?

Besides I didn't know the construction :

$+(%,private,$nick)

to create the variable %privatenickname.


Thanks

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Anti

Overall thanks for you answer.

I don't understand this test :

if (!$($+(%,private,$nick),2)) {

I thing the test is :

if (!$(%privatenickname),2)) {

What's statement is this ?
What's the comparision ?

Besides I didn't know the construction :

$+(%,private,$nick)

to create the variable %privatenickname.


Thanks


Try to give an look into the help file: /help if then else

or if you want an better mirc doc check here: http://en.wikichip.org/wiki/mirc


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Mar 2015
Posts: 26
A
Anti Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Mar 2015
Posts: 26

I read many times before and now the help of
/help if then else inside mirc and http://en.wikichip.org/wiki/mirc , but I didn't found trace of this
costruction.

The costruction is :

if (!$($+(%,private,$nick),2)) ;

Sorry , but I don't understand the expansion of this
expression, and I don't found nothing to understand it.

Thanks

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
$+(n1,...,nN)
Combines all of the specified parameters, the same as using $+ in between each item.
If you try to set a variable like this: set % $+ test $+ $nick it wont be set right. To set a dynamic variable right you use $+( . Which is the same as $+ but with a little difference. you seperate and "connect" an identifier from plain text with the use of a comma.
In this case you wanted to reply to private messages only once.
ill try to break down the code and explain.. im not the best tutor
Code:
on *:text:*:?: {
;;Here I need to check if the variable %private$nick exists. To get the value of a dynamic variable you use $+( and $( . So... you take $+(%,private,$nick) and use $( like this: $($+(%,private,$nick),2)
if ($($+(%,private,$nick),2)) {
;; ,2 belongs to $( and not to $+( . let's suppose OrFeAsGr is messsaging you for the 1st time. This: $($+(%,private,$nick),2) would return $null so the script would do the following
set $+(%,private,$nick) 1
;; to set a dynamic variable you dont need to use $($+(%,...,...),2) <- this is used only to get the value if there is one. To set/inc/dec you use only $+(
msg $nick Im busy now...
;;msges $nick
}
}

Now If OrFeAsGr would message you again there would be %privateOrFeAsGr 1 in the vars.ini
which would return 1 in the if statement so the msg wouldn't be sent.
I hope i helped you understand this. Good Luck! laugh Let me know if you need more help..!


Link Copied to Clipboard