mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
A
AWEstun
AWEstun
A
How do I go about taking the results shown by a /trace and putting (redirecting) them into a variable?

Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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

A
AWEstun
AWEstun
A
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.
Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

/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-
}



A
AWEstun
AWEstun
A
Thanks.

Last edited by AWEstun; 02/05/08 04:48 PM.
Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

Most welcome. grin

A
AWEstun
AWEstun
A
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.
Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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.

A
AWEstun
AWEstun
A
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.

Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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

A
AWEstun
AWEstun
A
I'm still seeing the whole thing when I type /trace name

Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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

A
AWEstun
AWEstun
A
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.
Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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

A
AWEstun
AWEstun
A
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.
Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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: {

A
AWEstun
AWEstun
A
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?

Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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
}


A
AWEstun
AWEstun
A
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.

Joined: Dec 2002
Posts: 2,002
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,002

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.

Page 1 of 2 1 2

Link Copied to Clipboard