mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 16
S
saxorr Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Oct 2005
Posts: 16
Hey there,

I'm making a score keeper script for a tournament we're running, basically, the scores will be kept like this in a txt file:

TeamA-vs-TeamB 10/09/2005 13:12:14 10-4

4 words per line, 1st word is the team names, 2nd word is the match date, 3rd is match time, 4th word is the score - now, the script is meant for people to type !matchinfo <match> and the $read function will search the line for the teams they searched for, except I want to set %matchdate as the 2nd word on that line, %matchtime as the 3rd word on that line etc etc

I just cant figure out how to set aliases for seperate words on whatever line the $read function picks up, any info/tips will be appreciated

thanks in advance.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
$read(match.txt,w,%matchteams %matchdate %matchtime %score)

By using the w in the $read command, it won't matter if one or more of those variables is missing, but it will matter if someone tries to use %matchteams %matchdate %scrore (omitting %matchtime)

Joined: Oct 2005
Posts: 16
S
saxorr Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Oct 2005
Posts: 16
Sorry mate, I think you understood me wrong smile (or I explained it wrong most likley)

The users will be typing "!matchinfo TeamA-vs-TeamB" and my script will search down the file for it, but I dont want it to just reply whatever is written on that line, I want it to reply something neat like:

"Match info for TeamA-vs-TeamB - Date: xx/xx/xxxx - Time: xx/xx/xxxx - Final Score: xx-xx"

So I want to alias the first word it finds on that line as %matchteams, the 2nd word it finds as %matchdate etc etc, that way I can just go:

/msg #chan Match info for %matchteams - Date:%matchdate - Time:%matchtime - Final Score: %matchscore

I hope that clears it up

Joined: Jun 2005
Posts: 9
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2005
Posts: 9
you can use $gettok

msg # Match info for $gettok(%tmp,1,32) - Date: $+ $gettok(%tmp,2,32) - Time: $+ $gettok(%tmp,3,32) - Final Score: $+ $gettok(%tmp,4,32)

so part of code could be:
Code:
var %tmp = $read(match.txt,w,%matchteams )
msg #chan Match info for $gettok(%tmp,1,32) - Date: $+ $gettok(%tmp,2,32) - Time: $+ $gettok(%tmp,3,32) - Final Score: $+ $gettok(%tmp,4,32)  

On Date, Time and final score I used $+ to put words near if you want space between them just don't use it.

Last edited by BeYonD_Me; 10/10/05 10:58 AM.
Joined: Oct 2005
Posts: 16
S
saxorr Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Oct 2005
Posts: 16
That works laugh

Thanks a million.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
You could use /tokenize as well:

Code:
tokenize 32 $read(match.txt,nw,%matchteams)
msg #chan Match info for $1 - Date: $2 - Time: $3 - Final Score: $4


Gone.

Link Copied to Clipboard