mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm in the process of creating a special set of menus.
The network has many services installed, and I have a text file with the base commands for each service. What I'd like to do, is be able to issue a single command, which would then read from the text file the name of the service and the command, then send a help request for that command to the service.

Eg: Text file
ChanServ REGISTER Register a channel
ChanServ IDENTIFY Identify yourself with your password
ChanServ SET Set channel options and information
ChanServ SOP Modify the list of SOP users
ChanServ AOP Modify the list of AOP users
ChanServ HOP Maintains the HOP (HalfOP) list for a channel
ChanServ VOP Maintains the VOP (VOicePeople) list for a channel

I issue the command (ie: /update), then it reads the first line and sends the command /msg chanserv help register

Next I want the information that is returned placed with the command that was sent in the text file (or another text file if necessary)

Responses from the services come across in the status window.

Any suggestions, or do I have to end up doing them one at a time (I hope not, since there's about 120 items in the text file)

P.S.: If possible, for things like the SET commands, where there's probably going to be multiple options and help available for each of those options, have them sent out and the responses recorded automatically

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Well this is a cheap shot @ it for you your pretty smart youll see what theory im using... reading from file with gettok and insertting the help token between so the cfommand is performed

Code:
alias updt {
  %open.up = 1
  var %x = 1
  while (%x <= $lines(help.txt)) {
    .timer 1 5 /.msg $instok($gettok($read(help.txt,%x),1-2,32),help,2,32)
    inc %x
  }
}

on *:NOTICE:*:?:{
  if (%open.up) { write newfile.txt $1- $crlf }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
OOPS i clicked on reply instead of edit..

i forgot to include an unset var after last active timer for the %open.up


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I tried your code, and it didn't work, so I took a better look at it, trying to decipher just exactly what was hppening at what points, and came up with this
Code:
 alias updt {
  var %open.up = 1
  while (%open.up <= $lines(Maximum-IRC_Services.txt)) {
    var %message = $read(Maximum-IRC_Services.txt,%open.up)
    %service = $gettok(%message,1,32)
    %message = $gettok(%message,2,32)
    .timer 1 5 .msg %service help %message
    inc %open.up
  }
}

on *:NOTICE:*:*:{
  if (%open.up) { write Maximum-IRC_Services2.txt $1- $crlf }
  echo -a $1-
  if %open.up == $lines(Maximum-IRC_Services.txt) {
    unset %open.up
  }
}
 
thinking that it might work better. Unfortunately it still isn't working. The weird thing (I think) is that with both your code & mine, occasionally the error * /echo: insufficient parameters (line 14, script105.mrc) shows up, and sometimes the information is echoed (and I can confirm this since the same information is being sent to my status window), however, the second text file never gets created.

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Im not sure why your creating the extra vars and code the $instok into the $gettok routine works perfectly.

The reaosn you get tha techo error is because on line 14 you got echo -a $1-

now the error of a ECHO is when theres a $CRLF present it will give you that error unless you loop through so if your script sees a $crlf in other words it would write it to a file... just not echo a $crlf

example type //echo -a $crlf youll see 2 [][] appear or something similar making it an illegal chr to echo during a notice call I suppose I might be wrong but yeah... so thats the reason I had no issue with my code for what you wanted done so im not sure why it didnt work I tried it 2 times..

my code works.. taking in conscience that your file is...

ChanServ REGISTER Register a channel
ChanServ IDENTIFY Identify yourself with your password
ChanServ SET Set channel options and information
ChanServ SOP Modify the list of SOP users
ChanServ AOP Modify the list of AOP users
ChanServ HOP Maintains the HOP (HalfOP) list for a channel
ChanServ VOP Maintains the VOP (VOicePeople) list for a channel

this is what I wrote to help.txt

then when it writes to NEWFILE.txt

my output is...

Code:
Syntax: REGISTER channel password description 



Registers a channel in the ChanServ database. In order 

to use this command, you must first be a channel operator 

on the channel you're trying to register. The password 

is used with the IDENTIFY command to allow others to 

make changes to the channel settings at a later time. 

The last parameter, which must be included, is a 

general description of the channel's purpose. 



When you register a channel, you are recorded as the 

"founder" of the channel. The channel founder is allowed 

to change all of the channel settings for the channel; 

ChanServ will also automatically give the founder 

channel-operator privileges when s/he enters the channel. 

See the ACCESS command (/msg ChanServ HELP ACCESS) for 

information on giving a subset of these privileges to 

other channel users. 



NOTICE: In order to register a channel, you must have 

first registered your nickname. If you haven't, 

/msg NickServ HELP for information on how to do so. 

Syntax: IDENTIFY channel password 



Authenticates you to ChanServ as the founder of the given 

channel. Many commands require you to use this command 

before using them. The password should be the same one 

you sent with the REGISTER command. 

Syntax: SET channel option parameters 



Allows the channel founder to set various channel options 

and other information. 



Available options: 



FOUNDER Set the founder of a channel 

SUCCESSOR Set the successor for a channel 

PASSWORD Set the founder password 

DESC Set the channel description 

URL Associate a URL with the channel 

EMAIL Associate an E-mail address with the channel 

ENTRYMSG Set a message to be sent to users when they 

enter the channel 

BANTYPE Set how Services make bans on the channel 

MLOCK Lock channel modes on or off 

KEEPTOPIC Retain topic when channel is not in use 

OPNOTICE Send a notice when OP/DEOP commands are used 

PEACE Regulate the use of critical commands 

PRIVATE Hide channel from LIST command 

RESTRICTED Restrict access to the channel 

SECURE Activate ChanServ security features 

SECUREOPS Stricter control of chanop status 

SECUREFOUNDER Stricter control of channel founder status 

SIGNKICK Sign kicks that are done with KICK command 

TOPICLOCK Topic can only be changed with TOPIC 

XOP Toggle the user privilege system 



Type /msg ChanServ HELP SET option for more information on a 

particular option. 

Syntax: SOP channel ADD nick 

SOP channel DEL {nick | entry-num | list} 

SOP channel LIST [mask | list] 

SOP channel CLEAR 



Maintains the SOP (SuperOP) list for a channel. The SOP 

list gives users all rights given by the AOP list, and adds 

those needed to use the AutoKick and the BadWords lists, 

to send and read channel memos, and so on. 



The SOP ADD command adds the given nickname to the 

SOP list. 



The SOP DEL command removes the given nick from the 

SOP list. If a list of entry numbers is given, those 

entries are deleted. (See the example for LIST below.) 



The SOP LIST command displays the SOP list. If 

a wildcard mask is given, only those entries matching the 

mask are displayed. If a list of entry numbers is given, 

only those entries are shown; for example: 

SOP #channel LIST 2-5,7-9 

Lists AOP entries numbered 2 through 5 and 

7 through 9. 



The SOP CLEAR command clears all entries of the 

SOP list. 



The SOP ADD, SOP DEL and SOP CLEAR commands are 

limited to the channel founder. However, any user on the 

AOP list may use the SOP LIST command. 



This command may have been disabled for your channel, and 

in that case you need to use the access list. See 

/msg ChanServ HELP ACCESS for information about the access list, 

and /msg ChanServ HELP SET XOP to know how to toggle between 

the access list and xOP list systems. 

Syntax: AOP channel ADD nick 

AOP channel DEL {nick | entry-num | list} 

AOP channel LIST [mask | list] 

AOP channel CLEAR 



Maintains the AOP (AutoOP) list for a channel. The AOP 

list gives users the right to be auto-opped on your channel, 

to unban or invite themselves if needed, to have their 

greet message showed on join, and so on. 



The AOP ADD command adds the given nickname to the 

AOP list. 



The AOP DEL command removes the given nick from the 

AOP list. If a list of entry numbers is given, those 

entries are deleted. (See the example for LIST below.) 



The AOP LIST command displays the AOP list. If 

a wildcard mask is given, only those entries matching the 

mask are displayed. If a list of entry numbers is given, 

only those entries are shown; for example: 

AOP #channel LIST 2-5,7-9 

Lists AOP entries numbered 2 through 5 and 

7 through 9. 



The AOP CLEAR command clears all entries of the 

AOP list. 



The AOP ADD and AOP DEL commands are limited to 

SOPs or above, while the AOP CLEAR command can only 

be used by the channel founder. However, any user on the 

AOP list may use the AOP LIST command. 



This command may have been disabled for your channel, and 

in that case you need to use the access list. See 

/msg ChanServ HELP ACCESS for information about the access list, 

and /msg ChanServ HELP SET XOP to know how to toggle between 

the access list and xOP list systems. 

Syntax: HOP channel ADD nick 

HOP channel DEL {nick | entry-num | list} 

HOP channel LIST [mask | list] 

HOP channel CLEAR 



Maintains the HOP (HalfOP) list for a channel. The HOP 

list gives users the right to be auto-halfopped on your 

channel. 



The HOP ADD command adds the given nickname to the 

HOP list. 



The HOP DEL command removes the given nick from the 

HOP list. If a list of entry numbers is given, those 

entries are deleted. (See the example for LIST below.) 



The HOP LIST command displays the HOP list. If 

a wildcard mask is given, only those entries matching the 

mask are displayed. If a list of entry numbers is given, 

only those entries are shown; for example: 

HOP #channel LIST 2-5,7-9 

Lists HOP entries numbered 2 through 5 and 

7 through 9. 



The HOP CLEAR command clears all entries of the 

HOP list. 



The HOP ADD, HOP DEL and HOP LIST commands are 

limited to AOPs or above, while the HOP CLEAR command 

can only be used by the channel founder. 



This command may have been disabled for your channel, and 

in that case you need to use the access list. See 

/msg ChanServ HELP ACCESS for information about the access list, 

and /msg ChanServ HELP SET XOP to know how to toggle between 

the access list and xOP list systems. 

Syntax: VOP channel ADD nick 

VOP channel DEL {nick | entry-num | list} 

VOP channel LIST [mask | list] 

VOP channel CLEAR 



Maintains the VOP (VOicePeople) list for a channel. 

The VOP list allows users to be auto-voiced and to voice 

themselves if they aren't. 



The VOP ADD command adds the given nickname to the 

VOP list. 



The VOP DEL command removes the given nick from the 

VOP list. If a list of entry numbers is given, those 

entries are deleted. (See the example for LIST below.) 



The VOP LIST command displays the VOP list. If 

a wildcard mask is given, only those entries matching the 

mask are displayed. If a list of entry numbers is given, 

only those entries are shown; for example: 

VOP #channel LIST 2-5,7-9 

Lists VOP entries numbered 2 through 5 and 

7 through 9. 



The VOP CLEAR command clears all entries of the 

VOP list. 



The VOP ADD, VOP DEL and VOP LIST commands are 

limited to AOPs or above, while the VOP CLEAR command 

can only be used by the channel founder. 



This command may have been disabled for your channel, and 

in that case you need to use the access list. See 

/msg ChanServ HELP ACCESS for information about the access list, 

and /msg ChanServ HELP SET XOP to know how to toggle between 

the access list and xOP list systems. 


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The reason I created the extra variables was so I could check to ensure that the information was being sent correctly.
I just re-copied your original code, changed the filenames, and ran it, and it worked great. I don't have a clue as to why it didn't work the first time.

Thanks for your help.

Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
your welcome, i c thats a good way of testing the info sent/received. I've played with text files since I started scripting my first script was based on reading info on a txt file over the years I learned some neat tricks as $XXXtok commands came into play, im not sure if they were or not available back then but I found em over 2 years ago in the help file

Glad it works, if you want to make a seperate txt file upon read info you can set a start if statement of the currently line being read from help.txt then put a if end statement to it. for the example of "Help Register" then the next one and so forth, you can script it in the the script itself so you dont have to write specific if statements

LOL wow i can't understand myself to read that... anyhoo what I mean is basically you can have the info that was read in the txt file in the if statement once for every line instead of writting a seperate statement for each addiontional lines in your txt file making the script fully auto.

If cut tons of corners using mIRC for example often if I need to remove spaces I created such a auto small script like

alias sp { return $remove($1-,$chr(32)) }

just that small script ive used like 100+ times by now just to show you that mIRC allows us to write simple stuff to make auto stuff all in one instead of making seperate programs in C


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }

Link Copied to Clipboard