mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
I have this string:
LethPhaos: Level 2 Ugly Dwarf; Status: Online; TTL: 0 days, 00:08:17; Idled: 0 days, 00:26:50; Item sum: 4
and I want my script to echoe the information given in it on different lines.
Therefore I need to get parts of the string out of it. How to do that?
Let's say I need the 'Online' part, how to find it? And how to get it out?
Just $left and $right isn't enough, because the level is not always 1 digit, it could be more.

Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
There are two possibilities, depends really on which you prefer, you either use;

tokenize [color:red]59
LethPhaos: Level 2 Ugly Dwarf; Status: Online; TTL: 0 days, 00:08:17; Idled: 0 days, 00:26:50; Item sum: 4
[/color]
and then immediately after you can use, $1, $2, ect, to grab the different sections, seperated by a ';' (character, 59)

or;

var %t = LethPhaos: Level 2 Ugly Dwarf; Status: Online; TTL: 0 days, 00:08:17; Idled: 0 days, 00:26:50; Item sum: 4
echo - $gettok(%t,[color:red]N
,59)
[/color]
replacing N with the section you wish to grab.

iEamonn.

Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Ok I made this:
on *:text:*:?:{
if ( $nick == IdleRPG ) { tokenize 59 $1- | echo -t $1 | echo -t $2 | echo -t $3 | echo -t $4 | echo -t $5 | close -m $nick }
}
How could I improve the script that it doesn't repeat all the echoes?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019

on *:TEXT:*:?: if ($nick == IdleRPG) { tokenize 59 $1- | echo -t $* | close -m $nick }


Gone.
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Thanx to both of you!

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
No problem.

You could consider using the on OPEN event instead, and after echoing the info, just putting "halt", so that close -m $nick is obsolete, and the window is never visibly open.

Greets


Gone.
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
is the on open event only triggered in private messages?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
on OPEN/CLOSE

The on OPEN and on CLOSE events trigger for various events relating to the opening and closing of a window of different types of windows. In the case of dcc sessions, they trigger when a dcc connection has opened or closed.

Format: on <level>:OPEN|CLOSE:<?|@|=|!|*>:<matchtext>:<commands>

If you specify the question mark, then yes it will only trigger for the opening of query windows.

Greets


Gone.
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
Thanks!

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
No problem.

That came straight from the help file actually, /help on open

Might want to check out the help file from time to time, it's a pool of knowledge just waiting for you to swim in grin

Greets


Gone.

Link Copied to Clipboard