mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2013
Posts: 2
M
moi Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Jun 2013
Posts: 2
Hey I am new to scripting with mIRC, I want a script that when activated by command would raise a number in a txt file.

I already know I can write and replace the first line with
Code:
on *:TEXT:!add:#: {
  write -l1 number.txt 1
}

But I want that number to rise by 1 every time someone uses the command.
Thanks for the help.

Joined: Jan 2004
Posts: 1,352
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,352
Code:
on *:TEXT:!add:#: {
  write -l1 number.txt $calc($read(number.txt,1) + 1)
}

Joined: Jun 2013
Posts: 2
M
moi Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
M
Joined: Jun 2013
Posts: 2
Originally Posted By: Loki12583
Code:
on *:TEXT:!add:#: {
  write -l1 number.txt $calc($read(number.txt,1) + 1)
}

This doesn't seem to do anything for me.

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
This fails due to how mIRC handles the first line in a text file when this line is a number. See /help $read
You'll need to circumvent this by using:
Code:
on *:TEXT:!add:#:{
  write -l1 number.txt $calc($read(number.txt,0) +1)
}

Joined: Jun 2013
Posts: 14
M
Pikka bird
Offline
Pikka bird
M
Joined: Jun 2013
Posts: 14
Why do this in a text file and not make a variable for it?


Link Copied to Clipboard