mIRC Home    About    Download    Register    News    Help

Print Thread
#252781 11/05/15 02:10 AM
Joined: Mar 2015
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 10
Currently running a raffle script that ended up looking like this.
Code:
    if (%rafflestatus) { 
      .timer 1 1 msg $chan /me $read(Raffle.txt,n) won!
      .timer 1 6 msg $chan /me $read(Raffle.txt,n) has won too!
      .timer 1 9 msg $chan /me $read(Raffle.txt,n) is the third winner!
      .timer 1 12 msg $chan /me Congrats, $read(Raffle.txt,n) you won!
      .timer 1 15 msg $chan /me Last but not least, we have $read(Raffle.txt,n) $+ !
      unset %rafflekey
      unset %rafflestatus
    }


Obvious problem is that this might result in the same name getting drawn twice or more. How do I clear the line of text after it has been used? The only way of clearing a .txt I know of is write -c (.txt) which cleares the entire file..

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
/write -dl $readn raffle.txt

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Belhifet
/write -dl $readn raffle.txt


Propably you mean: /write -dl $+ $readn raffle.txt


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You actually don't need $+ here smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
o_O i read into the help file and it says the example that the number must be near the -dl .

Help file example: /write -dl5 c:\info.txt


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
The help file is incomplete, there is a support for /write (and maybe others commands with the same situation) where the parameter of a switch can be space seperated as it does not interfere with the general parsing scheme.

The same way, for example, all of the token number parameters can be space seperated

$gettok(a b c, 2 - 3,32)
$gettok(a b c,2- 3,32)
$gettok(a b c,2 -3,32)
if ($1 isnum 50 - 96) echo -a ok etc


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Aha, ok thanks for the definition did not knew that!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Mar 2015
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 10
Okay so, thank you very much this is what i was looking for. Now I have modified it to look like this:

Code:
on *:text:!winner4:#: {
  if (($nick isop $chan) || ($read(Streamers.txt,nw,$nick)))  {
    if (%rafflestatus) {       
      .timer 1 1 msg $chan /me $read(Raffle.txt,n) won!
      .timer 1 2 /write -dl $readn raffle.txt
      .timer 1 4 msg $chan /me $read(Raffle.txt,n) has won too!
      .timer 1 5 /write -dl $readn raffle.txt
      .timer 1 7 msg $chan /me $read(Raffle.txt,n) is the third winner!
      .timer 1 8 /write -dl $readn raffle.txt
      .timer 1 10 msg $chan /me Congrats, $read(Raffle.txt,n) you won!
      .timer 1 11 /write -dl $readn raffle.txt
      .timer 1 13 msg $chan /me Last but not least, we have $read(Raffle.txt,n)
      .timer 1 14 /write -dl $readn raffle.txt
      unset %rafflekey
      unset %rafflestatus
    }
  }
}


However, none of these work properly:
Code:
      .timer 1 8 /write -dl $readn raffle.txt

Code:
      .timer 1 11 /write -dl $readn raffle.txt
      .timer 1 13 msg $chan /me Last but not least, we have $read(Raffle.txt,n)
      .timer 1 14 /write -dl $readn raffle.txt


Any idea why and if there is a better way of writing this script?


Link Copied to Clipboard