mIRC Home    About    Download    Register    News    Help

Print Thread
#96534 02/09/04 01:57 PM
Joined: Sep 2004
Posts: 3
K
kussie Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Sep 2004
Posts: 3
Basically i have a text file which contains one line of data which i am calling and storing in a var this parts is var. However there is 3 seperate parts to the data i want to seperate. The format is as follows:

data1 data2 data3

So as you can see each piece of individual data is seperated by spaces, basically i want to take those three seperate pieces and write each one to there own varible/

How would i go about doing this?

Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
assuming the one line in your textfile is data1 data2 data3, and none of the data actually contains a space:

Code:
tokenize 32 $read(filename,1)
set %x $1
set %y $2
set %z $3



DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Joined: Sep 2004
Posts: 3
K
kussie Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Sep 2004
Posts: 3
excellent that works great smile


One other question though. The third piece of data is a date say for example 8/8/2004 (dd/mm/yyyy format).

How would i be able to figure the amount of weeks and day left till that day from when the script is run?

Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
Is it the amount of days/weeks UNTIL that day (future date) or SINCE that day (past date)?

Use:
$duration($calc($ctime - $ctime(8/8/2004)))

Check
/help $ctime
/help $ctime(text)
to see how/why this works.

If this returns a negative number in seconds use the opposite. ie:
$duration($calc($ctime(8/8/2004) - $ctime))


Maybe I wake up one day to notice that all my life was just a dream!
Joined: Sep 2004
Posts: 3
K
kussie Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Sep 2004
Posts: 3
It's the amount of days and weeks till that date.

I want it to create two values the number of weeks and days. Which will be displayed like thus: 1wks 3days till 8/8/2004

Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
$calc($ctime(8/9/2004) - $ctime)
This calculates the the number of seconds from now ($ctime) till 8/9/2004 ($ctime(8/9/2004)).

Using $duration makes the seconds appear as weeks and days.

$duration($calc($ctime(8/9/2004) - $ctime))
I think this is what you need. Note though that it doesn't create two values!

Use it with echo, msg, say, me, describe or any command.
Replace 8/9/2004 with any date (or variable containing one) in the form dd/mm/yyyy.

Try typing:
//echo -a $duration($calc($ctime(8/9/2004) - $ctime))
to see the results.

(I used 8/9 which is a future day from today (2/9) rather than 8/8 which is not...)


Maybe I wake up one day to notice that all my life was just a dream!

Link Copied to Clipboard