mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
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
}




Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
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.


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
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) 
}



Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
Does anyone have any idea how to do this? I am at a loss here.

Joined: Oct 2014
Posts: 49
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
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

Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
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.

Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
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)
}


Last edited by Netct25; 18/04/16 04:32 PM.
Joined: Oct 2014
Posts: 49
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
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.

Last edited by JB_uk; 18/04/16 05:03 PM. Reason: Added edited code
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
Yeah that would be awesome. Thanks again!

Joined: Oct 2014
Posts: 49
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
See edited post.

Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
Where is the !list command? How would I do that? This script works great. Thanks again!

Joined: Oct 2014
Posts: 49
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
Originally Posted By: JB_uk
Will work on it listing everything into chat when I get back later.

Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
Alright. I appreciate your help!

Joined: Oct 2014
Posts: 49
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
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

Last edited by JB_uk; 19/04/16 02:17 PM.
Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
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.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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 
}

Joined: Dec 2015
Posts: 36
N
Netct25 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2015
Posts: 36
This did not work either, sorry.


Link Copied to Clipboard