mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 14
N
Pikka bird
OP Offline
Pikka bird
N
Joined: Jan 2004
Posts: 14
How to get the "blabla" and the "this" ? ^^

Last edited by no_brain; 15/01/04 05:23 PM.
Joined: Feb 2003
Posts: 282
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
on 1:TEXT:!add*:*: {
set %b $2
set %c $3
}



Now %b = blabla and %c= this

Joined: Feb 2003
Posts: 282
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
I don't really understand what you want... You want only the second and the third word, and each one of them will be added to a seperate variable??

Or do you want to take the whole text from the second word and put it in a variable??

For the second option you will need:
set %b $2-

Joined: Jan 2004
Posts: 14
N
Pikka bird
OP Offline
Pikka bird
N
Joined: Jan 2004
Posts: 14
Sorry, I have forgotten this

with a ,

So the users can add questions and answers

Joined: Feb 2003
Posts: 282
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
Ok, would you mind explaning??
I didn't get the last part.

Joined: Jan 2004
Posts: 14
N
Pikka bird
OP Offline
Pikka bird
N
Joined: Jan 2004
Posts: 14
!add question,answer

and I like to have the question and the answer ^^

Joined: Feb 2003
Posts: 282
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
Ok....
Then do this:

on 1:TEXT:!add*:*: {
tokenize 44 $2-
set %question $1
set %answer $2
}

Joined: Jan 2004
Posts: 3
Z
Self-satisified door
Offline
Self-satisified door
Z
Joined: Jan 2004
Posts: 3
/tokenize isn't very good idea in all scripts
I think "Teh Thing" you were looking for is $gettok
Code:
 $gettok(Hi! My name is John,3,32) 

returns "name"
First parameter is text
Second parameter is "which token"
Third parameter is ASC code for character you want to separte all tokens

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on *:TEXT:!add*:*: {
set %before.the.comma $mid($gettok(. $2-,1,44),3)
set %after.the.comma $gettok(. $2-,2-,44)
}


i use $mid($gettok(. $2-,1,44),3) and not $gettok($2-,1,44) as a line begining with comma well have that comma ignored.


Link Copied to Clipboard