mIRC Home    About    Download    Register    News    Help

Print Thread
#248487 10/10/14 01:46 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
I need to list all the commands in a channel from a ini file so it would display commands when someone types !commands "The commands are !help, !thanks, !bots, !slap." I am new to scripting and I can not figure it out. Any help would be thankful smile

[#fire]
help=type !commands for help.
thanks=Thanks for idling!
bots=for a bot in your channel join #bots
slap=slaps $nick

Last edited by CEG; 10/10/14 02:41 AM.
CEG #248488 10/10/14 07:23 AM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:!commands:#: { 
var %i 1
while (%i <= $ini(file.ini,#,0)) {
var %command $ini(file.ini,#,%i)
var %commands $addtok(%commands,$chr(32) ! $+ %command,44)
inc %i
}
msg # The commands are: %commands $+ .
}

untested


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #248490 10/10/14 09:30 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
Awesome it works! one other thing though.

on *:text:!coms:#: {
var %i 1
while (%i <= $ini(commands.ini,#,0)) {
var %command $ini(commands.ini,#,%i)
var %commands $addtok(%commands,$chr(32) ! $+ %command,44)
inc %i
}
if (%commands = $null) { msg # there are no channel commands. try !addcom <!com> <msg> }
msg # The commands are: %commands $+ .
}

CEG #248492 10/10/14 09:50 AM
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You broke it. %commands will never be $null as I'm adding , and ! to it no matter what. And
Code:
if (%commands = $null)
is not valid. You need two ==. Here's how I would do it.
Code:
on *:text:!coms:#: { 
var %l $ini(commands.ini,#,0)
if (!%l) { msg # there are no channel commands. try !addcom <!com> <msg> | return }
var %i 1
while (%i <= %l) {
var %command $ini(commands.ini,#,%i)
var %commands $addtok(%commands,$chr(32) ! $+ %command,44)
inc %i
}
msg # The commands are: %commands $+ .
}
Do note however, that if you are using twitch's irc, you're not allowed to use any < or > in your messages as they won't be accepted by the server. So I suggest removing those as well.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #248494 10/10/14 10:04 AM
Joined: Oct 2014
Posts: 12
C
CEG Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2014
Posts: 12
Awesome thank you so much!


Link Copied to Clipboard