mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
How do I go about taking the results shown by a /trace and putting (redirecting) them into a variable?


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

You would have to use raw events. Check out the numerics (low 200's) at the link below.

http://www.mishscript.de/reference/raw.numidx.htm

200-210,261-262

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Thanks for your responce. It looks like possibly raw 203 is what I need. How do I put that in a variable?

Last edited by AWEstun; 02/05/08 04:32 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

/help raw events

$1- is the replied information.

raw 203:*:echo -a $1-

Paste that in your remotes and figure which part you need.

If you only needed $2 from the reply, you could do this...
Code:

raw 203:*: {
  set %var $2
}



or if you only needed $3 from the reply, you could do this...
Code:

raw 203:*: {
  set %var $3
}



or if you wanted to keep all of the information...
Code:

raw 203:*: {
  set %var $2-
}



Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Thanks.

Last edited by AWEstun; 02/05/08 04:48 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Most welcome. grin

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
I put 'raw 203:*: echo -a $1-' on a line by itself, but it isn't doing anything. What triggers it?

Last edited by AWEstun; 02/05/08 04:52 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

You would have to do a /trace and that will echo the reply. Then you figure out which part of the reply you need and set it to a variable like I showed above.

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
So that 'I put 'raw 203:*: echo -a $1-' in the remotes and I typed /trace name and it showed all of it. Then I changed '$1-' to just '$1', but it still showed the whole trace.


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

You're still seeing the original reply because we didn't halt it. If you changed $1- to just $1 then you should see your nick echoed on a line by itself because $1 in a raw reply is always your nick so try this...

Code:

raw 203:*: {
  echo -a $2
  haltdef
}



I can't pick out exactly what you need because I'm not an oper, all I see when I try a trace is this 481 reply...

RoCk Permission Denied: Insufficient privileges

$1 = RoCk
$2 = Permission
$3 = Denied:
$4 = Insufficient
$5 = privileges

wink

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
I'm still seeing the whole thing when I type /trace name


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Do you have another raw event in the same script file that could be catching the 203 event?

raw *:

raw 203:

Either of those would prevent another raw 203 from being triggered. Also try typing /raw on

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
The only line in the remote.ini file is

raw 203:*: { echo -a $1 | haltdef }

and raw is on

EDIT: It appears as it isn't even triggering.

Last edited by AWEstun; 02/05/08 05:25 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Maybe the numeric is different on the server you're on? Try this and see if you can find out the numeric...

/debug @debug

Then do a trace and watch the @debug window and see what the numeric(s) is for the trace reply.

* RoCk heads out to lunch

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Yep. yep! That is it - server is modified. It's 205 instead of 203! So, now knowing this, how do I go about writing a lil script that executes this when a user joins the channel and I want to save this info to a file?

EDIT: something I noticed is that it still shows the servers above, but only the $4 info I echo'd.

Last edited by AWEstun; 02/05/08 05:57 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

If you don't want to see the raw output of the trace replies, you could make a raw event for each trace numeric and haltdef it.

raw 200:*:haltdef
raw 201:*:haltdef
raw 202:*:haltdef

etc.

If you want to trace each user that joins the channel, you could do this...

Code:

on *:JOIN:#: {
  if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
  set -eu60 $+(%,didtrace.,$nick) $true
  !trace $nick
}


...and then catch the reply with your raw 205 event and do with it what you want from there.

You could replace the # with your channel name(s) if you only want it to work on a certain channel(s).

on *:JOIN:#chan1,#chan2,#chan3: {

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
The raw haltdef's worked.

As for:

on *:JOIN:#: {
if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
set -eu60 $+(%,didtrace.,$nick) $true
!trace $nick
}

I dont understand the $eval string on the second line or any of the third line. Can you explain?


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

If someone with the nick JACK joined the channel, it would set a variable named %didtrace.JACK to $true so if JACK joins more than one of your channels, you will still only do one trace on JACK instead of one for each channel. The variable is automatically unset in 60 seconds. You can remove it if you want, it's a flood protection.

Code:

on *:JOIN:#: {
  if ($nick != $me) !trace $nick
}


Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
It wont work for me. Following is the exact remote.ini file:

;raw 200:*:haltdef
;raw 262:*:haltdef
raw 205:*: { %vname = $4 | haltdef }

;on ^*:JOIN:#: {
!trace $nick
/msg $nick Hello %vname and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
}
; this is my original script, but the trace was lagging? and it is showing the previous traced user.

on *:JOIN:#: {
if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
set -eu60 $+(%,didtrace.,$nick) $true
!trace $nick
/msg $nick Hello %vname and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
}


It appears that it isn't even getting passed the flood protection, as I'm not even seeing the raw 200 or raw 262, which are servers and trace end.


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Code:

raw 200:*:haltdef
raw 262:*:haltdef
raw 205:*: { set %vname $4 | haltdef }

/*
on ^*:JOIN:#: {
  !trace $nick
  msg $nick Hello %vname and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
}
*/
; this is my original script, but the trace was lagging? and it is showing the previous traced user.

on *:JOIN:#: {
  if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
  set -eu60 $+(%,didtrace.,$nick) $true
  !trace $nick
  msg $nick Hello %vname and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
} 


It's showing the previous traced user because it hasn't yet had time to set %vname to the new name yet before you msg $nick. You could put the message in the raw event...

Code:

raw 200:*:haltdef
raw 262:*:haltdef
raw 205:*: {
  if ($eval($+(%,didtrace.,$4),2)) msg $4 Hello $4 and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
  haltdef
}

on *:JOIN:#: {
  if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
  set -eu60 $+(%,didtrace.,$nick) $true
  !trace $nick
}


Change the first and second $4 in the raw 205 to be what ever token is the users nick.

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
So you have to do a beginning comment out and an ending comment out, instead of just commenting out any on's?

Okay that got it going, but it's still showing the current joining user, the previous user's info, as if it's lagged. Do I need to add some kind of 5-10 second timer delay?

EDIT: okay I tried a timer, but it's still showing the previous user's into to the next user.

Last edited by AWEstun; 02/05/08 11:28 PM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Did you try how I showed you in that last code of my last post?

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
So it would look something like this?

raw 205:*: {
if ($eval($+(%,didtrace.,$nick),2)) msg $nick Hello $4 and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
haltdef
}

It's not showing anything for $nick when it tries to msg $nick.

Would it be possible to 'shave' the $left side of $4 (starting from the very left and going to a [ ) and get that name? E.x. $4 = name[12345678_12345678@1.2.3.4]

If we can do that, then we'll have the exact name we need.

Last edited by AWEstun; 03/05/08 01:10 AM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Nevermind, I see what you mean .. you need $gettok()

Try this out...
Code:

raw 200:*:haltdef
raw 262:*:haltdef
raw 205:*: {
  var %nick = $gettok($4,1,91)
  if ($eval($+(%,didtrace.,%nick),2)) msg %nick Hello $4 and welcome! Today is $date (dd/mm/yyyy) and the time is $time (CST).
  haltdef
}

on *:JOIN:#: {
  if (($nick == $me) || ($eval($+(%,didtrace.,$nick),2))) return
  set -eu60 $+(%,didtrace.,$nick) $true
  !trace $nick
}



Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
OMG it works!!!

Now.. smile

How do I go about saving $4 to a text file.

I want to start out simple and then eventially be able to save same screen names with different IP's and same IP's with different screen names to the file. So I can do something like right click on a name on the room and a list of all the IP's that that name has used will list and a list of all the names that that IP has used.


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

You want them all in one .txt file? Add this to your raw 205 event on the line above the haltdef. Change the file name to whatever you want.

write tracenicks.txt $4

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Where is that file stored?


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

That would store it in the mirc folder or the settings folder. You could use $scriptdir to store it where the script file is...

write $qt($scriptdirtracenicks.txt) $4

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
It must be in a hidden dir under document and settings > applications data > mirc? If so how to I access that folder?

EDIT: Accessed that hidden mirc folder and made a shortcut to the folder. Looks like it's building...

Last edited by AWEstun; 03/05/08 02:23 AM.

I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Use $mircdir

//run $mircdir

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Okay now lets say I want to 'read' back in a 'list' of all the screennames that are the same, how would I go about that?

Format is: screenname[12345678_12345678@1.2.3.4]

Then have it output something like:
screenname is screenname[12345678_12345678]@1.2.3.4 (current) also using IPs: @5.6.7.8, @4.3.2.1, @8.7.6.5, etc.

screenname[12345678_12345678] will always stay the same, but the IP may change, especially if they log in from various locations.

This server is modified and does not let the user change their screenname or account info [12345678_12345678].

Last edited by AWEstun; 03/05/08 02:45 AM.

I registered; you should too.
Page 1 of 2 1 2

Link Copied to Clipboard