mIRC Home    About    Download    Register    News    Help

Print Thread
#240741 24/02/13 09:00 AM
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
How could I split up some text so that I only get a part of it?

Earlier I asked if I could replace [N] with someones name, for a script I'm distributing, and this is linked in, as I also want to add functionality for their ingame IDs. Only problem is, that the echo channel always says their ID's like this (ID:36) or [36]. I only want the 36 so I can add that to the copy and paste script I discussed in my last thread

Last thread(if you want to know what i'm trying to do exactly): https://forums.mirc.com/ubbthreads.php/topics/240725/Converting_text#Post240725

Joined: Mar 2010
Posts: 146
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 146
Code:
/help $gettok


Nothing...
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
i thought tokkens only really worked with full stops shocked? sorry i don't really understand tokkens frown

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You shuld be able to use $remove() to, if you remove ( [ : from the text, then you end up with the numbers

$gettok() is also a way to do it.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Tokens work with any form of separator. You select the character that is the separator as part of the identifier.

//echo -a $gettok(some text here,1,32) will display "some" because it's separating on $chr(32), which is a space and you're asking for the first token. The first token is the text leading up to the first separator character.

//echo -a $gettok(ID:32,2,58) will display "32" because it's separating on $chr(58), which is a colon. The second token is the text after the first separator and before the second separator, if there is one.

So tokens work in a wide variety of ways and can be used in this situation. However, you can just use $remove as sparta mentioned and that will probably be far easier.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
okay thanks smile


Link Copied to Clipboard