mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
maroon helped me set up this bot for my twitch a year ago but now some commands aren't working and i'm not sure if it's because things have changed on twitch's side or something? but i haven't changed any of the code for a while. here it is:




on *:text:!clear:#: {
if (!$istok(,$nick,32)) return
{ write -c list.txt
msg $chan queue reset. }
}

------------------------------------------------------------------------------------------------
; new line of text



on *:text:!join:#: {
if (%list.status == closed) { msg $chan sorry $nick the queue is closed :c | return }
if ($read(list.txt,nw,$nick)) { msg $chan $nick you're already in the queue c: | return }
else write list.txt $nick
msg $chan $nick hopped on the queue! position: $ord($calc($lines(list.txt)))
}





on @*:text:!open:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
if (%list.status != closed) { msg $chan the queue is already open | return }
unset %list.status
msg $chan the queue is now open c: !join
}



on @*:text:!close:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
if (%list.status == closed) { msg $chan the queue is already closed. | return }
set %list.status closed
msg $chan the queue is now closed :c
}





on *:text:!findme:#: {
if ($read(list.txt,nw,$nick)) { msg $chan $nick you are in queue position $readn $+ . | return }
else msg $chan sorry $nick you're not in the queue. you can add yourself by typing: !join
}

on @*:text:!del *:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
if (%list.status == closed) { msg $chan sorry $nick the queue is closed :c | return }
var %name $nick
elseif (($2) && ($2 != $nick)) msg chan sorry $nick you may not remove anyone else.
if ($read(list.txt,nw,%name)) { write -dl $+ $readn list.txt | msg $chan $nick has removed $iif($nick == %name,themself,%name) from the %list.status queue. | return }
else msg $chan sorry $nick you were not in the %list.status queue
}




on @*:text:!del *:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
if (%list.status == closed) { msg $chan sorry $nick the queue is closed :c | return }
var %name $nick
elseif (($2) && ($2 != $nick)) msg chan sorry $nick you may not remove anyone else.
if ($read(list.txt,nw,%name)) { write -dl $+ $readn list.txt | msg $chan $nick has removed $iif($nick == %name,themself,%name) from the %list.status queue. | return }
else msg $chan sorry $nick you were not in the %list.status queue
}



on @*:text:!q:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
msg $chan number of buns in the queue: $calc($lines(list.txt))
}






on *:TEXT:!leave*:#: {
var %name $nick
if (($nick isop $chan) && ($2)) { var %name $2 }
elseif (($2) && ($2 != $nick)) msg chan sorry $nick you may not remove anyone else.
if ($read(list.txt,nw,%name)) { write -dl $+ $readn list.txt | msg $chan $nick has removed $iif($nick == %name,themself,%name) from the %list.status queue. | return }
else msg $chan sorry $nick - $iif(%name == $nick,you were,%name was) not in the %list.status queue
}





------------------------------------------------------------------------------------------------------------
next next codes ----

on @*:TEXT:!next*:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
var %namecount = 0 , %line 1 , %max $int($2) , %names
if (%max !isnum 1-10) { msg $chan must give number 1-10, like !next 1 | return }
while (%namecount < %max) {
var %t $read(list.txt,nt,%line)
;if ((%t != $null) && (%t ison $chan)) { var %names %names %t | inc %namecount }
if (%t != $null) { var %names %names %t | inc %namecount }
if (%t == $null) { break }
else {
if (!next* iswm $1) write -dl $+ %line list.txt
if (!bun* iswm $1) inc %line
}
}
msg $chan up now: %names
}

on @*:TEXT:!bun*:#: {
if ($nick !isop $chan) return
if (!$istok(,$nick,32)) return
var %namecount = 0 , %line 1 , %max $int($2) , %names
if (%max !isnum 1-10) { msg $chan must give number 1-10, like !next 1 | return }
while (%namecount < %max) {
var %t $read(list.txt,nt,%line)
;if ((%t != $null) && (%t ison $chan)) { var %names %names %t | inc %namecount }
if (%t != $null) { var %names %names %t | inc %namecount }
if (%t == $null) { break }
else {
if (!next* iswm $1) write -dl $+ %line list.txt
if (!bun* iswm $1) inc %line
}
}
msg $chan buns in line: %names
}




basically, the commands: !open, !close, !next*, !bun*, !q, all do not want to work anymore for some reason in my twitch chat and i'm not sure why frown can anybody help?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It's hard to read code when it's not pasted inside the 'code' symbols found in the '#' menu of the forum posting editbox.

Just to be clear, are you saying that some do work but the others you did not list are still working? It would help if you added a debug echo to the event handler, to see if it's being seen by mIRC but not working properly. On the first line of the handler, on the row immediately below the one having :TEXT: in it, insert a row containing something like:

echo -s $scriptline $nopath($script) DEBUG: !OPEN nick $nick (1-) $1-

The problem would be fixed depending on whether or not you are seeing these lines echoed to your status window when the relevant message is typed in channel.

If they are echoed, then you might need to insert additional echo commands between more lines of the handler to see where it goes astray.

If the echo is accompanied by an error message, it would be helpful to know what that is.


If the lines are not shown at all, then something has changed to prevent them from triggering.

Perhaps there's another :TEXT: event added above them whose matchtext field is :*:

Perhaps when you type "/remote" it says remote is off, in which case you would turn back on with "/remote on"

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Looks like the events which are not working are the one using the @ prefix event, I bet that the 'change' is that you're no longer an op on the channel, at least not according to mIRC.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
here is an exmaple:



!open is supposed to open it
!close is supposed to close it, even if it is closed it usually would relay a message saying that it's already closed

!findme and !leave a part of the commands that do still work

!q is supposed to display the number of people in the queue

Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
i also just tried inserting echo -s $scriptline $nopath($script) DEBUG: !OPEN nick $nick (1-) $1-

but it still won't work, hm

Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
i thought so too but i'm not sure why, how would i no longer be an op on the channel when nothing has changed? since it's my own channel

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
To be clear, the @ prefix relates to whichever nick is running the script, which looks like the botbun nick.

I'm not familiar with how Twitch handles status. How was it being given Op status before? Was it given a script being run by a different nick, or given by the network due to recognizing it being on a list?

Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
aribun21 and botbun are both separate accounts i made on twitch. botbun is connected to the mIRC program and through there i have it so that botbun is in my aribun21 twitch chat making botbun pretty much just a bot on twitch that you type commands and have it respond back, "bots" are very popular on twitch because they make things easier for everyone.

i'm just confused because in the past, those commands worked just fine and nothing has changed in the script so i'm not sure why those specific commands aren't working anymore. would i need a rewrite of the scripts for those commands to work properly again?

Last edited by kouyachi; 06/03/19 10:45 PM.
Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
okay so i tried taking out the @ prefix as well as the " if ($nick !isop $chan) return " and now it's working, lol..

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
The reason for the @ prefix is that sometimes the bot is doing kicks or bans or giving status that only an OP can do. But in this case it doesn't look like any of these triggers are doing that.

It's probably a good idea to figure out how to give your bot status, to lessen the chance of a trickster imitating your bot by changing their nick to be similar, like changing the one into a small L and becoming aribun2l

Joined: Sep 2017
Posts: 32
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2017
Posts: 32
okay, i'm not sure how i would go about giving my bot status?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
The default right-click menu for the nicklist has a 'control' menu with the option to give/take op status. Whether that works on twitch, i dunno.


Link Copied to Clipboard