mIRC Home    About    Download    Register    News    Help

Print Thread
#216472 16/11/09 10:42 PM
Joined: Sep 2009
Posts: 20
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2009
Posts: 20
I have a .txt file in c:\bot.txt
I want to know the script when someone in the channel types !topicset and if they are op then it writes to the .txt file.
Also if their not op then it says that they arent. I know how to do the $read part. Thank you for your help.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Code:
on *:text:*!topicset *:#:{
  if ($nick isop #) {
    if ($2) write bot.txt $2-
  }
  else msg # $nick you are not an op.
}


This will write whatever they say after !topicset to a file called bot.txt in your $scriptdir.

Joined: Sep 2009
Posts: 20
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2009
Posts: 20
Originally Posted By: DJ_Sol
Code:
on *:text:*!topicset *:#:{
  if ($nick isop #) {
    if ($2) write bot.txt $2-
  }
  else msg # $nick you are not an op.
}


This will write whatever they say after !topicset to a file called bot.txt in your $scriptdir.

thank you so much it worked

Joined: Sep 2009
Posts: 20
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Sep 2009
Posts: 20
i hope you read this. but i just want to know if you know how to make it overwrite each time so theres only one line of txt so it says to right topic. thanks

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
There are much better ways to do what you are asking. I personally would use an ini file. This would allow you to save a topic for each channel.

But here is what you are asking for.

Change /write bot.txt $2-

to ...


/write -c bot.txt $2-


Joined: Jul 2009
Posts: 5
I
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
I
Joined: Jul 2009
Posts: 5
I don't know the follow up on the script but this is an example of what you could do to learn a little about ini files wich are pretty useful.

Code:
on $*:text:/^[!.@]topicset/Si:#:{ 
  if ($nick(#,$nick,o) { 
    if ($2) {
      writeini -n bot.ini Topic $chan $$2- 
      notice $nick You've added $readini(bot.ini,n,topic,$chan) to the Topic List.
    }
  }
  else { 
    notice $nick You do not have the access required to trigger the Topic List.
  }
}


If an Op (@) writes !topicset it will write to an .ini file as for example:
[Topic]
#Channel=What ever went after the trigger

If you want to see more about .ini files just do /help /writeini


Money is a fool's grasp at felicity.

Link Copied to Clipboard