mIRC Home    About    Download    Register    News    Help

Print Thread
Help with remote scripts and color codes #5950 10/01/03 07:18 PM
Joined: Jan 2003
Posts: 2
_
_jazzy_ Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
_
Joined: Jan 2003
Posts: 2
I am pretty new to this, i am trying to test some simple scripts on different servers to see if anything works. But so far none of the scripts ever worked for me.

I have to deal with lines like this.

// this is a normal copy
<bumrap>  [Hello World] Here

// this is with the ctrl key pressed
<bumrap> 0113,01 06,01[07,01Hello World06,01] 00,01Here

What do i have to do to detect this line and then send a message to the channel? I have tried the following lines, but again it never works.

on *:TEXT:*:#testdb1: {
if (([Hello World] isin $1-) && (Here isin $1-)) {
/msg $chan hey dood whats up
}
}

Can someone give me an example that i can try that will work, i think the color codes is killing me. Actually maybe not, this will be my first script.


Thanks.

Re: Help with remote scripts and color codes #5951 10/01/03 09:10 PM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
It's not too surprising that you're having difficulty "catching" that line. It's not a "normal line" in many senses. That leading  is a $chr(127) followed by a space colored the same way. That's your $1, and that's one of the reasons you're having problems. Of course, you might not have known about $strip() as well. I'll break down exactly what's happening on his line for you, substituting ^k for that $chr(3) you actually see in here on his "real" message line, and separating things out just a bit so you can see exactly what's what.

In ^k##,##, the first two digits (before the comma) are the foreground text color and the second two digits are the background color.
Code:

[color:#006600];  To detect this literal line:
;    &lt;bumrap&gt; 0113,01 06,01[07,01Hello World06,01] 00,01Here
;
;    &lt;bumrap&gt; ^k01^k13,01 $chr(127) &lt;space&gt; ^k06,01 [ ^k07,01 Hello &lt;space&gt; World ^k06,01 ] &lt;space&gt; ^k00,01 Here
;
;    $1 is ^k01^k13,01 $chr(127)
;    $2 is ^k06,01 [ ^k07,01 Hello
;    $3 is World ^k06,01 ]
;    $4 is ^k00,01 Here
;
;  When you apply $strip() to each of those, you get this:
;
;    $strip($1) is $chr(127)
;    $strip($2) is [Hello
;    $strip($3) is World]
;    $strip($4) is Here
;[/color]
on *:TEXT:*:#testdb1:{
  if (($strip($1) == $chr(127) &amp;&amp; ($strip($2-3) == [Hello World]) &amp;&amp; ($strip($4) == Here)) {
    msg $chan Hey $nick - what's up, dood?
  }
}
[color:#006600];
;  Or you might prefer the simpler version of the exact same line:
;[/color]
on *:TEXT:*:testdb1: if ($strip($1) == $+($chr(127) [Hello World] Here)) msg $chan Hey $nick - what's up, dood?

I'm not too sure why he has a leading ^k01 on there since it doesn't affect anything.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Re: Help with remote scripts and color codes #5952 10/01/03 11:41 PM
Joined: Jan 2003
Posts: 2
_
_jazzy_ Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
_
Joined: Jan 2003
Posts: 2
Thanks a lot for this response, this definitely does clear it up and give me an idea on how its done.

I have one more simple question, i was looking at the variables to see how i can assign a bool value. This way after i send the message it will not send it over and over again.

What do i need to do to get it to send the message, set the variable and when it cheks the script again; it will realize that the message has already been posted and will not do it again.

I need to learn about posting multiple items for different users, this scripting is not going to be easy.

Thanks again

Re: Help with remote scripts and color codes #5953 11/01/03 12:25 AM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
set %variablename $true

But you will have to decide when to unset it; otherwise, the next time you WANT it to send the message again, it won't send it. smile For instance, you might want to unset the variable when they part the channel or quit IRC. If you have variables named %greet.Hammer.#mIRC you might unset them like this:

on *:PART:#: .unset $+(%,greet.,$nick,.,$chan)
on !*:QUIT: .unset $+(%,greet.,$nick,.*)


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C