mIRC Home    About    Download    Register    News    Help

Print Thread
Reverse $2 $3 for one chan only #135623 14/11/05 07:22 PM
Joined: Mar 2005
Posts: 39
B
bapplander Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
Yet another small problem.

I am geting data from diffrent chans, which are done by [/i]!input Jegermaister 42[/i]. This works great with script below, BUT there's one chan, #c-chan, that adds it in diffrent order (!input 420 Jegermaister).
How could reverse %input and %data for this chan only?

Code:
on *:TEXT:!input *:#a-chan,#b-chan,#c-chan: {

var %input = $2
var %data = $3
..
write c:\stuff.txt %2 %3


Could i use something like if ($chan = #c-chan) { %input = $3 | %data = $2 } ..huh?

Re: Reverse $2 $3 for one chan only #135624 14/11/05 07:31 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
if ($chan == #c-chan) { %input = $3 | %data = $2 }

Maybe you should try such things first, they might just work smile This one is somewhat nicer, but really the same...


if ($chan == #c-chan) var %input = $3, %data = $2

Re: Reverse $2 $3 for one chan only #135625 14/11/05 08:18 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You can also use /tokenize to fill the $n params as you please it.



  • if ($chan == #c-chan) tokenize 32 $1 $3 $2
    write c:\stuff.txt $2-3


In other words: $2 is always input, $3 is always data

Example of tokenize switching values:

//tokenize 32 1 2 3 4 5 | tokenize 32 $1 $3 $2 $4- | echo -a $1-

Result: 1 3 2 4 5



Gone.
Re: Reverse $2 $3 for one chan only #135626 16/11/05 07:21 PM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline
Babel fish
Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
Alrighty the problems in the
Code:
on *:TEXT:!input *:#a-chan,#b-chan,#c-chan: {
var %input [color:red]=[/color] $2
var %data [color:red]=[/color] $3
[color:red]..[/color] (unless thats stating the script goes on before that....)
write c:\stuff.txt [color:red]%2 %3[/color]

Recommended
Code:
on *:TEXT:!input *:#a-chan,#b-chan,#c-chan: {
var %txt $2
var %data $3
;omg break
write stuff.txt %data %txt
}

That way the code would write
say "!input omg wtf?"
it would come on the txt file as "wtf? omg"

...i hope i explained that right =P
i haven't scripted in mirc for a week 'er so frown


Chat NSN
My Server: sleepystickman.ircxpro.com
Re: Reverse $2 $3 for one chan only #135627 16/11/05 08:08 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
The problem isn't the ='s in his code.

Try it:

Code:
//var %input = lol, %data = Laughing Out Loud | echo -a %input = %data


It's simply just an error in var names.

Code:
On *:Text:!input & &:#a-chan,#b-chan,#c-chan: {
  if ($chan == #c-chan) var %input = $3, %data = $2
  write C:\stuff.txt %input %data
}


-Andy

Re: Reverse $2 $3 for one chan only #135628 16/11/05 11:16 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That would only actually write something if the channel was #c-chan, since in other occasions %input, and %data aren't initialized. That's why I used the /tokenize method, as $1- exist allready, so putting $2-3 will always put token 2 and 3, wether they've been reversed or not.


Gone.
Re: Reverse $2 $3 for one chan only #135629 16/11/05 11:26 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ya for sure I was going to say I preferred your method, I thought I had done oh well.. smile

-Andy