mIRC Home    About    Download    Register    News    Help

Print Thread
#242354 06/07/13 10:53 PM
Joined: Jul 2013
Posts: 3
S
Syele Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2013
Posts: 3
hi, I had a script that allowed me to make multiple lists in multiple channels but I have managed to lose it frown

Some guys over at Hawkee had helped me get started on it back in 2009 but the versions there are not working properly.

It worked with these commands:
!addlist list_name - creates new list
!add list_name list_item - adds list_item to list_name
!list_name lists the list to nick if it exists.
!dellist list_name -Deletes entire list
!del list_name list_item# -Deletes single list item

everything works except the deleting parts

I would really appreciate some help fixing it

tia

Syele #242369 08/07/13 04:19 PM
Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
Try this. Mostly it's just a re-write and optimizing of your code on the other site.
Code:
on *:TEXT:!addlist *:#:{
  opchk
  var %f = $+(rules\,$mkfn(#),\,$2.txt)
  if ($file(%f)) { .notice # $nick $+ , there is already a list with that name for this channel. To see it, type $+(!,$2) | return }
  mkdir rules | mkdir rules\ $+ %#
  write $qt(%f) $2 $+(list:,$crlf,~~~~~~~~~)
  .notice $nick List successfully created. To add items to this list, type !add $2 your_item
  describe # announces that $nick created a new list, $qt($2)
}
on *:TEXT:!add & *:#:{
  opchk
  var %f = $+(rules\,$mkfn(#),\,$2.txt)
  if (!$file(%f)) { .notice $nick There is no such list. | describe # announces that $nick tried to add an item to a non-existant list. | return }
  if ($read(%f,nw,$3-)) { .notice $nick This item already exists in this list. | return }
  write $qt(%f) $3-
  .notice # New item has been added to list $qt($2)
}
on *:TEXT:!dellist &:#: {
  opchk
  var %f = $+(rules\,$mkfn(#),\,$2.txt)
  if (!$file(%f)) { .notice $nick List $qt($2) doesn't exist. | describe # announces that $nick tried to delete a non-existant list. | return }
  .remove $qt(%f)
  .notice $nick List $qt($2) successfully deleted.
}
on *:TEXT:!del & *:#: {
  opchk
  var %f = $+(rules\,$mkfn(#),\,$2.txt)
  if (!$file(%f)) { .notice $nick There is no such list. | describe # announces that $nick tried to delete an item from a non-existant list. | return }
  if (!$read(%f,nw,$3-)) { .notice $nick This item doesn't exist in list. | return }
  write -dl $+ $readn $qt(%f)
  .notice # Item $qt($3) has been deleted from list $qt($2)
}
on $*:TEXT:/^!(\S+)$/S:#: {
  var %f = $+(rules\,$mkfn(#),\,$2.txt)
  if ($file(%f)) .play $nick $qt(%f) 2000
  else .notice $nick No such list.
}
alias -l opchk if ($nick !isop #) { .notice $nick You are not allowed to use this command | halt }
Added an opchk local alias to save having 4 copies of the exact same line. wink

Deega #242384 09/07/13 05:07 PM
Joined: Jul 2013
Posts: 3
S
Syele Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2013
Posts: 3
grin thank you very much for helping me with it!

it still has a problem though:


[10:58] <Syele> !add kami test
[10:58] -Psychobot:#computethis- New item has been added to list "kami"
[10:58] <Syele> !kami
[10:58] -Psychobot- No such list.
[10:58] <Syele> !addlist kami
[10:58] -Psychobot:#computethis- Syele, there is already a list with that name for this channel. To see it, type !kami
[11:00] <Syele> !kami
[11:00] -Psychobot- No such list.


So, It looks like it works but it is not listing out the lists now.

Syele #242385 09/07/13 05:15 PM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
One thing that is immediately obvious is that each occurrence of

$+(rules\,$mkfn(#),\,$2.txt)

Should be...

$+(rules\,$mkfn(#),\,$2,.txt)

Syele #242389 09/07/13 09:01 PM
Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
Sorry,this should make it better. smile I wrongly had $2 in this. smile
Code:
on $*:TEXT:/^!(\S+)$/S:#: {
  var %f = $+(rules\,$mkfn(#),\,$regml(1),.txt)
  if ($file(%f)) .play $nick $qt(%f) 2000
  else .notice $nick No such list.
}



P.S. "$+(rules\,$mkfn(#),\,$2.txt)" works fine in the rest of the code. wink

Deega #242393 10/07/13 04:49 AM
Joined: Jul 2013
Posts: 3
S
Syele Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2013
Posts: 3
YAY! Thank you so much! I really really appreciate it.


Link Copied to Clipboard