mIRC Home    About    Download    Register    News    Help

Print Thread
whats wrong with this #86952 15/06/04 08:45 AM
Joined: Feb 2003
Posts: 20
F
fallen248 Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2003
Posts: 20
on *:TEXT:.request*:?:{
/write -i requests.txt $2
}
on *:TEXT:!requests:#:{
if ($nick isop #request) || ($nick isvoice #request) {
/msg #requests Requests: $read(requests.txt $2)


This works, but i want it to post seperate lines of the requests.txt file on seperate lines in the chan

Re: whats wrong with this #86953 15/06/04 11:33 AM
Joined: Apr 2004
Posts: 45
V
Venoman Offline
Ameglian cow
Offline
Ameglian cow
V
Joined: Apr 2004
Posts: 45
on *:TEXT:!requests:#:{
^ first of all, there IS no $2 allowed with that. I'm guessing you want them to do something like !requests 1 to read the first request in the file? If so you'd want to use:
on *:TEXT:!requests *:#:{

"..but i want it to post seperate lines of the requests.txt file on seperate lines in the chan"

Not following completely. If you want to display ALL requests in the file, just use:
/play #request requests.txt

that'd message ALL the lines in requests.txt to the chan, with a one second delay between each line. Check /help /play for more info.

Hope that answers your question.

-Venoman

Re: whats wrong with this #86954 15/06/04 01:33 PM
Joined: Feb 2003
Posts: 20
F
fallen248 Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Feb 2003
Posts: 20
thank you very much, this was very helpful..a quick question tho, is there a way to make sure that the same request isnt repeated such as having it check to see if its already in requests.txt also how would i add a command to delete a request after it is checked such as "!delrequest blah" how would i go about coding it to remove a line from requests.txt

Re: whats wrong with this #86955 15/06/04 04:19 PM
Joined: Apr 2004
Posts: 45
V
Venoman Offline
Ameglian cow
Offline
Ameglian cow
V
Joined: Apr 2004
Posts: 45
Code:
; only add requests that aren't in there yet
on *:TEXT:.request*:?:{
  if ($read(requests.txt, w, $2-) == $null) {
    /write -i requests.txt $2
  }
  else { msg $nick That has already been requested. }
}

; delete requests
on *:TEXT:!delrequest *:?:{
  if ($read(requests.txt, w, $2-) != $null) {
    var %blah = $read(requests.txt, w, $2-)
    .write -d $+ $readn requests.txt
  }
  else { msg $nick There is no request on file for $2- }
}


haven't tested it, just came up with it in my head, but it should work.

-Venoman