mIRC Home    About    Download    Register    News    Help

Print Thread
How do delete something from a write file #207359 14/12/08 05:52 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
I currently have:
Code:
on 1:text:*:#: {
  if ( $nick == seanturner70 ) {
    if ($me == no-nick) {
      if ($1 == !enable) && ($2 == beta) { write enabled.txt $chan | msg $chan $chan has been added to the list for my Beta features }
      elseif ($1 == !disable) && ($2 == beta) { ******* enabled.txt $chan | msg $chan $chan has been deleted from the beta fetures }
    }
  }
}


I don't know how to delete the channel from the list... (*******)

I had a look at /help but it doesn't really help.

The reason I want this is becuase I was testing a feature, and it failed pretty misrably, someone when sugested that I do an "opt-in" thing, then I can do:
Code:
[...]
if ( $chan ison enabled.txt) [...]


Is that correct?

thanks.

Re: How do delete something from a write file [Re: seanturner70] #207361 14/12/08 06:12 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Try this:

Code:
on 1:TEXT:*:#:{
  if ($nick == seanturner70) && ($me == no-nick) && ($2 == beta) {
    if ($1 == !enable) && (!$read(enabled.txt,s,$chan)) { write enabled.txt $chan | msg $chan $chan has been added to the list for my Beta features }
    elseif ($1 == !disable) && ($read(enabled.txt,s,$chan)) { write -dl $+ $readn enabled.txt | msg $chan $chan has been deleted from the beta fetures }
  }
}

Re: How do delete something from a write file [Re: seanturner70] #207364 14/12/08 06:50 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Alternatively you could use
Code:
/write -ds $+ $chan enabled.txt

Re: How do delete something from a write file [Re: RusselB] #207381 14/12/08 08:45 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
ok, I am unsure now...

I added a line to a script ( if ( $chan ison enabled.txt ) { )

and it doesn't seam to work.
Code:
on 1:text:!!bar:#: {
  if ($me == no-nick) {
    if ( $chan ison enabled.txt ) {
      msg $chan 4 Hello $nick Welcome To Bullets Bar! <text..>
    }
  }
}


I don't know why it isn't working.

Re: How do delete something from a write file [Re: seanturner70] #207384 14/12/08 08:57 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Code:
$chan ison enabled.txt

is an invalid statement. You need to use...
Code:
if ($read(enabled.txt,s,$chan))

...as mentioned above.

See /help $read for more info.

Re: How do delete something from a write file [Re: 5618] #207385 14/12/08 08:59 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
oh, thanks smile

Re: How do delete something from a write file [Re: 5618] #207389 14/12/08 09:45 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
ok... I tried that, and it still doesn't seem to work
Code:
on 1:text:!!bar:#: {
  if ($me == no-nick) && ($read(enabled.txt,s,$chan)) {
    msg $chan 4 Hello $nick W...
  }
}



Re: How do delete something from a write file [Re: seanturner70] #207391 14/12/08 10:05 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
When you wrote the channel name to the text file, did you use something like
Code:
/write enabled.txt $chan more text here

or
Code:
/write enabled.txt $chan


If the first, then I don't see why it's not working.
If the second, then change the s switch in the $read to a w

Re: How do delete something from a write file [Re: RusselB] #207393 14/12/08 10:24 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
Thanks, changing it to w worked...

If you don't mind, what is the difference between w,s, etc?

Re: How do delete something from a write file [Re: seanturner70] #207394 14/12/08 11:52 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
From the help file
Quote:
//echo $read(info.txt, s, mirc)
Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.
//echo $read(help.txt, w, *help*)
Scans the file help.txt for a line matching the wildcard text *help*.

The w switch returns the full line, not just the text following, so by using the w with a non-wildcarded search term, it will return the first line that has the search term.

Re: How do delete something from a write file [Re: RusselB] #207395 14/12/08 11:55 PM
Joined: Oct 2008
Posts: 167
S
seanturner70 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
ok thanks smile