mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2008
Posts: 167
S
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.

Joined: Jun 2007
Posts: 933
5
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 }
  }
}

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Alternatively you could use
Code:
/write -ds $+ $chan enabled.txt

Joined: Oct 2008
Posts: 167
S
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.

Joined: Jun 2007
Posts: 933
5
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.

Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
oh, thanks smile

Joined: Oct 2008
Posts: 167
S
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...
  }
}



Joined: Aug 2004
Posts: 7,252
R
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

Joined: Oct 2008
Posts: 167
S
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?

Joined: Aug 2004
Posts: 7,252
R
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.

Joined: Oct 2008
Posts: 167
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Oct 2008
Posts: 167
ok thanks smile


Link Copied to Clipboard