mIRC Homepage

How would I make a queue in mIRC

Posted By: Netct25

How would I make a queue in mIRC - 10/04/16 02:46 PM

So what I am looking to do is make script that will allow me to add specific items to a queue that can be queried later. Also is it possible to instead of only be able to list the items, it lists one at a time instead a full list. Any help with this would be much appreciated. Thanks

Code:
on *:text:!addqueue *:#: {
set %queue $+ $2
msg $chan $2 has been added to the queue
}

on *:text:!listqueue:#: {
msg $chan The following items in the queue are: $2
}



Posted By: pball

Re: How would I make a queue in mIRC - 10/04/16 07:14 PM

Look into using tokenized strings. You can build a list using $addtoken and you get the individual items using $gettoken. For listing them one at a time you can do a while loop and loop through the tokens in your list. If the list is going to get large and don't want to spam a lot of messages at once a timer could be added also.

Take a look at the token commands and see what you can figure out yourself. Post back if you need more help.
Posted By: Netct25

Re: How would I make a queue in mIRC - 11/04/16 09:50 AM

What am I doing wrong? This should work shouldn't it?

Code:

on *:text:!trackrequest *:#: {
  $addtok($2-, #, 32)
  msg $chan $2 is now added to the queue. 
}

on *:text:!tracklist:#: {
  msg $chan This is the returned token: $gettok($2-, #, 32) 
}


Posted By: Netct25

Re: How would I make a queue in mIRC - 16/04/16 09:40 AM

Does anyone have any idea how to do this? I am at a loss here.
Posted By: JB_uk

Re: How would I make a queue in mIRC - 18/04/16 04:03 PM

Instead of using tokens, you could simply write to a txt then recall line 1 every time but after doing so it deletes line 1 meaning the queue moves up the txt. If you're after doing it one at a time.
Or message me @JB_IRL
Posted By: Netct25

Re: How would I make a queue in mIRC - 18/04/16 04:16 PM

What I am eventually looking to do is populate every track in the list. That's what the !tracklist is for. With that in mind I guess I could delete the line if I wanted to remove a track.
Posted By: Netct25

Re: How would I make a queue in mIRC - 18/04/16 04:30 PM

This is sorta what I am looking for, if this makes sense. As previously, I modified your code. I am not sure if it will work this way, but I am wanting !list to list everything in that entire file. Is this possible to do in mIRC?

Code:

on *:text:!trackrequest *:#: {
write -c trackrequest $+ $chan $+ .txt
write trackrequest $+ $chan $+ .txt $2-
  msg $chan $2- is now added to the queue. 
}

on *:text:!tracklist:#: {
 msg $chan Next in line is: $read(trackrequest $+ $chan $+ .txt ,1) 
}

on *:text:!list:#: { 
msg $chan $(read trackrequest $+ $chan $+ .txt ,0)
}

Posted By: JB_uk

Re: How would I make a queue in mIRC - 18/04/16 04:43 PM

I will rewrite that in a moment and edit it into this post.

Do you want it to delete the "request" when it has read it into the chat?

EDIT:

Below is the edited code, it will respond "There is nothing in the queue.2 if there is nothing in the text file
it will delete line 1 when you have used !trackrequest whilst also reading it into the chat. No way of retrieving this if not log is held.
[Note: might be worth adding a second .write but instead of writing to:
Code:
write trackrequest $+ $chan $+ .txt $2-
do this alongside
Code:
write trackrequestBACKUP $+ $chan $+ .txt $2-



So that you will have a file of every request submitted just in case you need to refer back to it without it being fully deleted.


Code:
on *:text:!trackrequest *:#: {
  write trackrequest $+ $chan $+ .txt $2-
  msg $chan $qt($2-) is now added to the queue. 
}

on *:text:!tracklist:#: {
  if ($read(trackrequest $+ $chan $+ .txt ,1) == $null) { msg # There is nothing in the queue. | return }
  else {  
    msg $chan Next in line is: $read(trackrequest $+ $chan $+ .txt ,1) 
    .write -dl1 trackrequest $+ $chan $+ .txt 
  }
}


Will work on it listing everything into chat when I get back later.
Posted By: Netct25

Re: How would I make a queue in mIRC - 18/04/16 04:51 PM

Yeah that would be awesome. Thanks again!
Posted By: JB_uk

Re: How would I make a queue in mIRC - 18/04/16 05:03 PM

See edited post.
Posted By: Netct25

Re: How would I make a queue in mIRC - 18/04/16 05:44 PM

Where is the !list command? How would I do that? This script works great. Thanks again!
Posted By: JB_uk

Re: How would I make a queue in mIRC - 18/04/16 08:25 PM

Originally Posted By: JB_uk
Will work on it listing everything into chat when I get back later.
Posted By: Netct25

Re: How would I make a queue in mIRC - 18/04/16 09:44 PM

Alright. I appreciate your help!
Posted By: JB_uk

Re: How would I make a queue in mIRC - 19/04/16 02:16 PM

Code:
on *:TEXT:!list:#: {
  var %li $lines(trackrequest $+ $chan $+.txt)
  msg # Starting to list all requests:
  .timerNo %li 3 Linksall #
} 



alias Linksall { 
  set %chan $1
  var %lines $lines(trackrequest $+ $chan $+.txt)
  if (!%counter) || (%counter > %lines) set %counter 1
  var %msg $read(trackrequest $+ $chan $+.txt,%counter)
  msg %chan %msg
  inc %counter 
}


Give this a go
Posted By: Netct25

Re: How would I make a queue in mIRC - 19/04/16 05:14 PM

Sadly this did not work. It starts the timer, but it seems to me like there is something wrong with msg %chan %msg. It throws up an insufficient parameters error in the status window on that specific line. Tried changing msg %chan to $chan to no avail as well.
Posted By: hixxy

Re: How would I make a queue in mIRC - 22/04/16 09:39 PM

JB_uk is using $chan when he should be using %chan in part of his script. Try this:

Code:
on *:TEXT:!list:#: {
  var %li $lines(trackrequest $+ $chan $+.txt)
  msg # Starting to list all requests:
  .timerNo %li 3 Linksall #
} 



alias Linksall { 
  set %chan $1
  var %lines $lines(trackrequest $+ %chan $+.txt)
  if (!%counter) || (%counter > %lines) set %counter 1
  var %msg $read(trackrequest $+ %chan $+.txt,%counter)
  msg %chan %msg
  inc %counter 
}
Posted By: Netct25

Re: How would I make a queue in mIRC - 24/04/16 09:28 PM

This did not work either, sorry.
© 2020 mIRC Discussion Forums