|
|
Joined: Sep 2014
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Sep 2014
Posts: 16 |
So yeah Hi everyone I today made some scripts that doesnt appear to work for some odd reason. Now I dont know if this is supposed to work or not, but heres what I want it to do. I'm thinking to have the commands in seperate text files. - Edit commands with !editcommand Heres my code: on *:TEXT:!downs2:#: {
if ((%flooddowns2) || ($($+(%,flooddowns2.,$nick),2))) { return false }
set -u1 %flooddowns2 On
set -u1 %flooddowns2. $+ $nick On
msg $chan $read(downs2.txt, 1)
}
on *:TEXT:!editcommand :#: {
if ($nick isOp) {
if ($2 = downs2) {
/write -c downs2.txt 0 downs.
msg $chan Successfully updated command !downs2.
}
}
}
Last edited by Codingskill404; 27/09/14 01:06 PM.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Try use this code:
ON !*:TEXT:!downs2:#: {
if ((%flooddowns2) || ($($+(%,flooddowns2.,$nick),2))) { return false }
set -u1 %flooddowns2 On
set -u1 %flooddowns2. $+ $nick On
var %f = downs2.txt
if (!$isfile(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) does NOT exist! | return }
if (!$lines(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) is currently empty! | return }
msg $chan $read(%f,n,1)
}
ON !*:TEXT:!editcommand *:#: {
if ($nick isop $chan) {
if ($2 = downs2) {
write -c downs2.txt 0 downs.
msg $chan Successfully updated command !downs2.
}
}
else { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! }
}
|
|
|
|
Joined: Sep 2014
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Sep 2014
Posts: 16 |
I dont think you got what I meant. It displays the message that is in the file, but it doesn't edit whats inside it. And also when I update it, it just gives me a sound error. EDIT: Made it work by tweaking a little. Heres the code: ON !*:TEXT:!downs:#: {
if ((%flooddowns) || ($($+(%,flooddowns.,$nick),2))) { return false }
set -u1 %flooddowns On
set -u1 %flooddowns. $+ $nick On
var %f = downs.txt
if (!$isfile(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) does NOT exist! | return }
if (!$lines(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) is currently empty! | return }
msg $chan $read(%f,n,1)
}
ON !*:TEXT:!editcommand *:#: {
if ($nick isop $chan) {
if ($2 = downs) {
tokenize 8 $3 $4 $5 $6 $7 $8
write -c downs.txt $*
msg $chan Successfully updated command !downs.
}
else if ($2 = )
}
else { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! } }
Last edited by Codingskill404; 27/09/14 05:53 PM.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
You did not tell me that you want to add your CUSTOM command. Try use this:
ON !*:TEXT:!downs:#: {
if (%flooddowns_ [ $+ [ $nick ] ]) { return }
set -eu6 %flooddowns_ $+ $nick On
var %f = downs.txt
if (!$isfile(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) does NOT exist! | return }
if (!$lines(%f)) { msg $chan [ $+ $nick $+ ]: Error, The $qt(%f) is currently empty! | return }
msg $chan $read(%f,n,1)
}
ON !*:TEXT:!editcommand *:#: {
if ($nick isop $chan) {
if ($2 == downs) {
if (!$3-) { msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter the command that you want to add! | return }
write -c downs.txt $3-
msg $chan [ $+ $nick $+ ]: Successfully updated command !downs. - (New command: $+ $3- $+ )
}
else { msg $chan [ $+ $nick $+ ]: Error, The $qt($2) editcommand option does NOT exist! }
}
else { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! }
}
|
|
|
|
Joined: Sep 2014
Posts: 16
Pikka bird
|
OP
Pikka bird
Joined: Sep 2014
Posts: 16 |
Nope, wrong again, I meant editing a commands output. I found it out myself though. The code is sort of messy, but it will do for now. BTW do you know how to stop a timer from running if a channel is offline? (twitch)
|
|
|
|
|
|