mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
I'm working on a script, and I haven't done much lately, but I need to figure out how to have the script send a message from a txt file every ten minutes. I've tried the way I thought would work, but it doesn't.

Also, note that I'm using an alias on/off in it too.

Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
#qb on

timer 0 5 msg $chan $read(quotes.txt)

#qb end

this is what I'm working with.

The 5 seconds was to test it.

Last edited by MaxEvans; 25/02/17 05:38 AM.
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Groups (/enable /disable) do not work like that. It's not a form of top-down code execution, but a way to turn on/off groups events like On Text or On Join.

You want to create an alias.

Code:
ALIAS spamchan {
  var %chan = $iif($1,$1,#defaultchan)
  timerSPAMCHAN 0 5 msg %chan $!read(quotes.txt,n)
}


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
I have an alias from someone who helped me before that is this...


alias qb {
$iif($group(#qb) == off,.enable,.disable) #qb | $iif($group(#qb) == on,echo * Khaos' Quote Script On, echo * Khaos' Quote Script Off)
}


But, even when it's on, it doesn't work... whereas, another script I had written before using the same method did work.

Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
I guess it's worth noting that I'm also working with a dialog I created with it as well.

Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
This is the whole script. It's not completed yet, I'm just trying to get the main script itself to work the way I want it to.



dialog quotebot {
title "Quote Bot Setup"
size -1 -1 160 240
option dbu
box "Quotes", 1, 8 4 145 121
box "Bot Owner", 2, 8 129 69 48
edit %qb-owner, 4, 16 140 50 10, center
button "Set", 5, 15 157 23 9
button "Reset", 6, 43 157 23 9
list 10, 13 13 135 89, size
button "Close", 11, 58 226 40 10, ok
button "Add", 13, 54 108 23 9
button "Delete", 15, 82 108 23 9
text "Quote Bot Script Made By Khaos", 3, 38 206 80 9, center
edit %qb-channel, 9, 94 140 50 10, center
button "Set", 12, 94 158 23 9
button "Reset", 14, 122 158 23 9
box "Quote Channel", 16, 84 129 69 48
text "maxevans.net/projects/msl-downloads", 17, 26 215 104 8, center
box "On/Off", 7, 8 178 145 23
radio "On", 8, 37 185 22 10
radio "Off", 18, 84 184 24 10
}



on 1:dialog:quotebot:init:0:{
$iif($isfile(shoutout.txt),loadbuf -o shoutout 10 quotes.txt)
did $iif(%qb-owner,-m,-n) $dname 4
did $iif(%qb-channel,-m,-n) $dname 9
}


on *:dialog:quotebot:sclick:*: {
if ($did == 13) { write quotes.txt $?="Add New Quote To The List") | did -r quotebot 10 | loadbuf -o quotebot 10 quotes.txt }
if ($did == 15) { write -dl $+ $did(10).sel quotes.txt | did -r quotebot 10 | loadbuf -o quotebot 10 quotes.txt }
if ($did == 5) { %qb-owner = $did(4) | did -m quotebot 4 }
if ($did == 6) { unset %qb-owner | did -n quotebot 4 | did -r quotebot 4 }
if ($did == 12) { %qb-channel = $did(9) | did -m quotebot 9 }
if ($did == 14) { unset %so-channel | did -n quotebot 9 | did -r quotebot 9 }
}


#qb on

timer 0 10 msg $chan $read(quotes.txt)

on !*:TEXT:!quote:%qb-channel: {
msg $chan $read(quotes.txt)
}

#qb end




alias qb {
$iif($group(#qb) == off,.enable,.disable) #qb | $iif($group(#qb) == on,echo * Khaos' Quote Script On, echo * Khaos' Quote Script Off)
}




Doing the quote trigger (!quote) works fine, but the timer itself does nothing.

Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
I know it shouldn't be as hard as it seems. I don't know if it's with the alias or the code.

Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
Originally Posted By: Raccoon
Groups (/enable /disable) do not work like that. It's not a form of top-down code execution, but a way to turn on/off groups events like On Text or On Join.

You want to create an alias.

Code:
ALIAS spamchan {
  var %chan = $iif($1,$1,#defaultchan)
  timerSPAMCHAN 0 5 msg %chan $!read(quotes.txt,n)
}




First, you the Raccoon on Hawkee too?

Also, this alias works. But how can I merge it with the enable/disable script that I have in my code so I can turn it on and off within the dialog I have?

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
I recommend you stop using enable/disable like that. Try a different approach, maybe an INI file or global variable. And yes, that is me.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Feb 2016
Posts: 14
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Feb 2016
Posts: 14
I thought so. Also, how would I do a global variable? It's been so long since I've done anything like that, so a refresh would help. I just really want a way to turn it on and off from the dialog. While the trigger could still function either way.


Link Copied to Clipboard