mIRC Home    About    Download    Register    News    Help

Print Thread
Dynamic Triggers Script #245284
15/04/14 12:47 PM
15/04/14 12:47 PM
Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
bl968  Offline OP
Ameglian cow
B

Joined: Apr 2014
Posts: 33
This script relies on a ops hash table to verify if someone is a channel moderator or not. This was done due to Twitch.tv not returning a channel users list breaking isop.

Example usage

set trigger popcorn Pull up a chair and grab some popcorn
Remove trigger popcorn

To call the trigger you use !popcorn

The Trigger supports 4 responses for one !command you do that by setting trigger..4

set trigger popcorn This is line 1
set trigger popcorn2 This is line 2
set trigger popcorn3 This is line 3
set trigger popcorn4 This is line 4

!popcorn would then show "This is Line 1" etc

;===========================================================
; Dynamic triggers - newtriggers.mrc
;===========================================================
; Author : Bill Larson (blarson@compu.net)
; bl968 on twitch.tv
; Revision: 1.0
; FileName: newtriggers.mrc
;===========================================================

on 1:TEXT:set trigger*:#:{
if !$hget(ops,$nick) { /halt }

if !$3 || !$4 {
/notice $nick Format: set trigger <triggername> <info>
/halt
}
/hadd triggers $$3 $4-
/msg $chan trigger for $3 set to
/msg $chan $4-

/hsave -o triggers triggers.hsh
/halt
}

on 1:TEXT:remove trigger*:#:{
if !$hget(ops,$nick) { /halt }

if $3 {
if !$hget(triggers, $3) {
/msg $chan no trigger info is set for $3 sorry.
/msg $chan Try using set trigger first.
/halt
} else {
/hdel triggers $$3
/msg $chan Trigger info was removed for $3
/hsave -o triggers triggers.hsh
/halt
}
} else {
/msg $chan Format: remove trigger Triggername
}
}

on 1:TEXT:!*:#:{
/var %command $remove($1,!)
if $hget(triggers, %command) {
/msg $chan $hget(triggers, %command)
}
if $hget(triggers, %command $+ 2) {
/msg $chan $hget(triggers, %command $+ 2)
}
if $hget(triggers, %command $+ 3) {
/msg $chan $hget(triggers, %command $+ 3)
}
if $hget(triggers, %command $+ 4) {
/msg $chan $hget(triggers, %command $+ 4)
}
/halt
}

alias dumptrigs {
/var %t 1
/var %ttotal $hget(triggers,0).item
while (%t <= %ttotal) {
/echo -s set trigger $hget(triggers,%t).item $hget(triggers,$hget(triggers,%t).item)
/inc %t
}
}

on 1:disconnect:{
/hsave -o triggers triggers.hsh
}

on 1:connect:{
/hmake triggers 100
/hload -o triggers triggers.hsh
}



Re: Dynamic Triggers Script [Re: bl968] #245289
15/04/14 03:18 PM
15/04/14 03:18 PM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
blessing  Offline
Vogon poet
B

Joined: Apr 2014
Posts: 191
Just a suggestion.

As you've stated early that the code relies on ops hashtable for checking trigger, it would be nice if you also provide the code to manage it. For example: code to add/remove a user to/from ops hashtable.
Without that, the script will simply not working especially for newbie in scripting.


Re: Dynamic Triggers Script [Re: blessing] #245310
16/04/14 07:06 AM
16/04/14 07:06 AM
Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
bl968  Offline OP
Ameglian cow
B

Joined: Apr 2014
Posts: 33
I use a dynamic system that is refreshed in the perform settings on connection. twitchclient 2 has to be set.

/raw twitchclient 2

in the perform I have /msg [your channel name here] .mods

Then this remote captures it and sets the mod table.

on *:text:The moderators of this room are*:?:{
if ($nick != jtv) return
/hfree ops
/hmake ops
/hadd -m ops [put your Broadcaster name here] $ctime
/var %count = $numtok($remove( $7- , $chr(32) ) , 44)
var %i = 1
while (%i <= %count) {
hadd -m ops $gettok($remove( $7- , $chr(32) ) ,%i,44) $ctime
inc %i
}
echo -a The number of ops is %count
}


If a mod is added the bot can be refreshed at any time by restarting or typing .mod in the channel window on the bot.

Tested and working in a channel with 87 mods.

Re: Dynamic Triggers Script [Re: bl968] #245327
16/04/14 12:05 PM
16/04/14 12:05 PM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
blessing  Offline
Vogon poet
B

Joined: Apr 2014
Posts: 191
That's good.
Add some code into it.
Hope it's correct.

Code:
on *:join:#:{
  if $nick == $me {
    .raw twitchclient 2
    .msg #channelnamehere .mods
  }
}

Re: Dynamic Triggers Script [Re: blessing] #245338
16/04/14 11:26 PM
16/04/14 11:26 PM
Joined: Apr 2014
Posts: 33
B
bl968 Offline OP
Ameglian cow
bl968  Offline OP
Ameglian cow
B

Joined: Apr 2014
Posts: 33
I add mine to connect/options/perform

/unset %ops
/raw twitchclient 2
/timerresetsubs 1 86400 /hfree subscribers
/timerannounce 0 600 /msg #zombie_barricades Don't forget to click the follow button! Also subscribe to Zombie Barricade's YouTube channel here: http://www.youtube.com/zombiebarricades
/timercontest 0 120 /entries
/join #zombie_barricades
/timer 1 5 /msg #zombie_barricades .mods