mIRC Home    About    Download    Register    News    Help

Print Thread
#254662 23/08/15 07:22 PM
Joined: May 2014
Posts: 13
O
Pikka bird
OP Offline
Pikka bird
O
Joined: May 2014
Posts: 13
I'm having some trouble making a command that shows other created commands in a channel. Here's what I have so far
Code:
on *:TEXT:!cmd*:#: {
  if ($nick isop #) {
    if ($2 == add) {
      write -c txt\ $+ $+(#,.,$3,.txt) $$4-
      write txt\ $+ $+(#,.,commandlist.txt) $3
      msg $chan Command added.
    }
    if ($2 == remove) {
      remove txt\ $+ $+(#,.,$3,.txt)
      msg $chan Command removed
    }
  }
}
on *:TEXT:!*:#: {
  msg $chan $read(txt\ $+ $+(#,.,$1,.txt))
}


With this I can add and remove commands, and write the command names into a txt file for use for the command list. Problem is I can't figure out how to actually get the list to work. I need all the commands to show in one message, and the ability to delete commands in the list. I've tried putting all commands in the list on different lines which makes it easy to delete them, but then I don't know how to make it so all of them are displayed in one message, and I've tried appending commands to the first line, but then I can't delete them when they're removed naturally. Would anyone be able to help?

Joined: Sep 2015
Posts: 18
R
Pikka bird
Offline
Pikka bird
R
Joined: Sep 2015
Posts: 18
You are better off just doing a simple command and then adding the commands in the script itself. For example if you had this
Code:
 
on *:TEXT:!cmd:#: {
msg $chan YOUR COMMANDS HERE
}

That way all you have to do is go into the script and type the command. It will save a lot of time smile

Last edited by REDxPHOEN; 08/09/15 09:46 PM.

Code:
 $I.am.REDxPHOEN 

Code:
 $I.am.THE.one.AND.only 

Code:
 $I.am.THE.best 
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
You can use a while loop to loop through the text file. When looping through the text file you can add the content to a dynamic variable using $addtok. Then paste the variable when you're done looping to the channel.

/help while loops
Example:
Code:
var %textfile PathToFile.txt
var %i 1
var %lines $lines(%textfile)
while (%i <= %lines) { 
var %line $read(%file,%i)
set %variable $addtok(%variable,%line,32) 
inc %i
}
msg # %variable


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 13
O
Pikka bird
OP Offline
Pikka bird
O
Joined: May 2014
Posts: 13
Ahh, thank you so much. I couldn't quite figure out how to get everything in one message, but $addtok worked perfectly.


Link Copied to Clipboard