mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 37
R
rbhibbs Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2003
Posts: 37
I have a script that displays help to a remote user by playing a specific section of a text file. An example of a help request is:

!help security

...and the relevant snippet of the script file is:

if ($ulevel >= %level.operator) {
.play -cq9m3t $+ $2 $nick txt\operators.txt 1000
}

The section of the text file, operators.txt, looks like this:

[security]
//msg $nick %setcolor $+ %orange $+ %bold $+ .getpass %setcolor $+ %blue $+ <operator> $+ %bold $+ %setcolor $+ %brown Retrieves the Password for the operator you specify.

...where the variables %setcolor, %orange, %blue, and %brown are defined globally to produce the desired text highlighting.

I have two problems:

(1) the '-c' switch not only treats the lines read from the text file as commands to be interpreted by mIRC, it also echos them to the status window -- a considerable nuisance when there are several users requesting help text

(2) the interpreter somehow misses the '$nick' parameter in the text file (I imagine assigning it a $null value), treating the first token after it as a channel or nickname

Now, if I replace the $nick in the text file with an actual nickname, the script works exactly as desired.

Any suggestions/solutions?

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
for the two things you listed
Code:
1) prefix the command play with a "." 
.play -c %security.nick file.name

2) when the user requests the section, use a global variable with the nick

so in the on text
first error checking
if (%security.nick) {  .notice nick that section is in use, please try again later }
elseif (!%security.nick) { set %security.nick $nick .play -c %security.nick security.txt 1234 }

in the file where you want the nick to be then use %security.nick

and be sure to add at the bottom of that text
/unset %security.nick
so this global is cleared after use

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
1) prefix the command play with a "." , the . tells the command to be run silently
2) replace $nick in the file with $pnick , $nick has no value becuase each line being done is a local timer event being run , $pnick is the nick mentioned in the /play command.

Joined: Aug 2003
Posts: 37
R
rbhibbs Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2003
Posts: 37
Thanks, Mike...

that's an interesting solution to preventing too many simultaneous plays, and I'll keep it in mind if I ever experience sufficient requests to overwhelm the script.

Joined: Aug 2003
Posts: 37
R
rbhibbs Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Aug 2003
Posts: 37
Thanks, Dave,

The play command was already prefixed by "." but that got me to thinking that maybe the problem lay within the text file being played -- sure enough, changing "//msg $nick" to ".msg $pnick" (incorporating your second suggestion) did the trick neatly.


Link Copied to Clipboard