mIRC Home    About    Download    Register    News    Help

Print Thread
#191062 01/12/07 04:06 PM
O
ots654685
ots654685
O
I was wondering if it was possible to have multiple ontext events in different channels that need to perform same events?

Example:
on :TEXT:*Join*:#channel1: || on :TEXT:*Joined*:#channel2: {
{ perform.join }
}

It didn't work here

Joined: Feb 2003
Posts: 3,412
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,412
Code:
on *:JOIN:#: {
 if ($chan == #channel) { do stuff }
 else if ($chan == #channel2) { do more stuff }
 if ($nick == $me) { perform.join }

Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
If you really mean 'on text':
You can group the conditions, but you cannot use the || && etc operators in the event definition.
Try something like (pseudocode):
on text in some channel {
if ([color:#990000]([color:#CC9933](the channel is channel1) AND (*join* matches the text))[/color] OR ([color:#cc6600](the channel is channel2) AND (*joined* matches the text))[/color])[/color] { stuff }
}

Code:
on *:TEXT:*:#: {
  if ((($chan == #chan1) && (*join* iswm $1-)) || (($chan == #chan2) && (*joined* iswm $1-))) { perform.join }
}


N
nomer2007
nomer2007
N
Code:
on :TEXT:*Join*:#channel1,#channe2:{ perform.join }


O
ots654685
ots654685
O
@Horstl, with your example i'm getting "* /if: insufficient parameters (line 2, script.mrc)"
Your code looks more usable as nomer2007 example is more limited for me but i'm gonna try to get it working

Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
Alternatively, if you get problems with the brackets, spread the 'pairs of conditions' to multiple lines, e.g.:
Code:
on *:TEXT:*:#: {
  if (($chan == #SomeChannel) && (*sometext* iswm $1-)) { perform.join }
  elseif (($chan == #AnotherChannel) && (*some other text* iswm $1-)) { perform.join }
}


N
nomer2007
nomer2007
N
or to make it shorter
Code:
on *:text:*:#chan1,#chan2:{
  if *sometext* iswm $1-  { perform }
  elseif *anothertext* iswm $1- { perform }
}

Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
Again (refering to both posts you wrote), this is not exactly the same: he wanted to perform two (or more) different text comparisons on two (or more) chans in one event (or a "group" of events)...

O
ots654685
ots654685
O
@Horstl, your correct.
2 different text comparisons on 2 different channels in 1 event.

I don't know what was wrong with first version.
I guess it's not possible to use || in such script lines, anyway learned another thing today, thanks.

N
nomer2007
nomer2007
N
Code:
Example:
on :TEXT:*Join*:#channel1: || on :TEXT:*Joined*:#channel2: {
{ perform.join }
}

That's your first sample of question

*join* and *joined* texts will be triggered on a simple *join* text right?

T
TTSpazmo
TTSpazmo
T
Originally Posted By: nomer2007
Code:
Example:
on :TEXT:*Join*:#channel1: || on :TEXT:*Joined*:#channel2: {
{ perform.join }
}

That's your first sample of question

*join* and *joined* texts will be triggered on a simple *join* text right?


Sort of.

"Joined" would trigger *Join*, but "Join" would not trigger *Joined*.

Also, he/she is trying to trigger *Join* on #channel1. Then *Joined* on #channel2. So I'm not sure if it would conflict anyway. Although from what I can see, Ots is trying to trigger the same event from both conditions. (Can't remember what i mean, lol)

Personally I would use Horstl's Script/Code for this purpose, although I havt tried it, so I cant work out what would be wrong with it. (Referring to Ots saying they got an 'if' error.)

Anyway, correct me if I'm wrong on anything smile

Last edited by TTSpazmo; 04/12/07 07:25 PM.
N
nomer2007
nomer2007
N
Quote:
"Joined" would trigger *Join*, but "Join" would not trigger *Joined*.


Code:
on *:text:*join*:#:


is the same as

Code:
if *join* iswm $1-


re-join , joining , join or joined text will be triggered

Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
Well (not stressing the theory of sets too much), now imagine he wants to match *apples* on chan 1 and *pineapples* on chan 2... the OP asked for two different comparisons, so imho we should provide for this.

O
ots654685
ots654685
O
Originally Posted By: Horstl
Well (not stressing the theory of sets too much), now imagine he wants to match *apples* on chan 1 and *pineapples* on chan 2... the OP asked for two different comparisons, so imho we should provide for this.
Every1 thanks for helping out, learned a lot.

ow it's not my intention to do script request but more learning from it.

Btw @Horstl, your first version works out fine, it seems some other addon in my version running here is bugging some commands, did a clean install on diff system and everything works fine.

R
r34dm4n
r34dm4n
R
Originally Posted By: nomer2007
Quote:
"Joined" would trigger *Join*, but "Join" would not trigger *Joined*.


Code:
on *:text:*join*:#:


is the same as

Code:
if *join* iswm $1-


re-join , joining , join or joined text will be triggered


yea thats where i would do on *:text:joined:#:{ code }

text matches if only contains this word
text* matches if text starts with this word
*text matches if text ends with this word
*text* matches if text contains this word anywhere

or... if ($1 == joined)
or... if (joined isin $1) which is the basically same

Last edited by r34dm4n; 06/12/07 09:34 AM.

Link Copied to Clipboard