mIRC Homepage
Posted By: bapplander Reverse $2 $3 for one chan only - 14/11/05 07:22 PM
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?
Posted By: Kelder Re: Reverse $2 $3 for one chan only - 14/11/05 07:31 PM
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
Posted By: FiberOPtics Re: Reverse $2 $3 for one chan only - 14/11/05 08:18 PM
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

Posted By: benjy355 Re: Reverse $2 $3 for one chan only - 16/11/05 07:21 PM
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
Posted By: SladeKraven Re: Reverse $2 $3 for one chan only - 16/11/05 08:08 PM
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
Posted By: FiberOPtics Re: Reverse $2 $3 for one chan only - 16/11/05 11:16 PM
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.
Posted By: SladeKraven Re: Reverse $2 $3 for one chan only - 16/11/05 11:26 PM
Ya for sure I was going to say I preferred your method, I thought I had done oh well.. smile

-Andy
© mIRC Discussion Forums