It basically stores the work/reminder you want to do later and shows it up all with the !ToDo list command.
Works without errors as of 17/01/2013.
; Made By Hammer
; Commands Available : !ToDo List, !ToDo Add <Work>, !ToDo Del <ID>
ON *:LOAD:{ $iif($readini(ToDo.ini,n,IDs,CID) != $null,halt,writeini ToDo.ini IDs CID 1) }
ON *:TEXT:!ToDo*:#:{
if ($2 == $null) { .notice $nick Syntax : !ToDo [List|Add|Del] | halt }
if ($2 == List) { var %x = 1
var %y = $ini(ToDo.ini,$nick,0)
if (%y < 1 || %y == $null) { .notice $nick Your ToDo List is empty. | halt }
if (%y != 0) {
.notice $nick Total ToDos : %y
while ($calc(%y + 1) > %x) { var %z $ini(ToDo.ini,$nick,%x) | var %l = 1 | .notice $nick 7-[ToDo 1]15 9 $+ $readini(ToDo.ini,n,$nick,%z) 7[ID %z $+ ]-15 | inc %x }
halt
}
}
if ($2 == Add) {
if ($3 == $null) { .notice $nick Syntax : !ToDo Add <Work> | halt }
else { var %cid = $readini(ToDo.ini,n,IDs,CID) | writeini ToDo.ini $nick %cid $3- | inc %cid | writeini ToDo.ini IDs CID %cid
.notice $nick -[ $+ $3- $+ ]- Has Been Added With ID $calc(%cid - 1)
.notice $nick Use this ID to delete this ToDo by using !ToDo del
halt
}
}
if ($2 == Del) {
if ($3 == $null) { .notice $nick Syntax : !ToDo Del <ID> | halt }
if ($readini(ToDo.ini,n,$nick,$3) == $null) { .notice $nick There's no ToDo with that ID in the database. | halt }
else { remini ToDo.ini $nick $3 | .notice $nick The ToDo with ID $3 has been deleted. | halt }
}
}
;Alias For Yourself
alias ToDo {
if ($1 == $null) { echo -a Syntax : /ToDo [List|Add|Del] | halt }
if ($1 == List) { var %x = 1
var %y = $ini(ToDo.ini,$me,0)
if (%y < 1 || %y == $null) { .echo -a Your ToDo List is empty. | halt }
if (%y != 0) {
echo -a Total ToDos : %y
while ($calc(%y + 1) > %x) { var %z $ini(ToDo.ini,$me,%x) | var %l = 1 | echo -a 7-[ToDo 1]15 9 $+ $readini(ToDo.ini,n,$me,%z) 7[ID %z $+ ]-15 | inc %x }
halt
}
}
if ($1 == Add) {
if ($2 == $null) { echo -a Syntax : /ToDo Add <Work> | halt }
else { var %cid = $readini(ToDo.ini,n,IDs,CID) | writeini ToDo.ini $me %cid $2- | inc %cid | writeini ToDo.ini IDs CID %cid
echo -a -[9 $+ $2- $+ 15]- Has Been Added With ID $calc(%cid - 1)
echo -a Use this ID to delete this ToDo by using /ToDo del
halt
}
}
if ($1 == Del) {
if ($2 == $null) { echo -a Syntax : /ToDo Del <ID> | halt }
if ($readini(ToDo.ini,n,$me,$2) == $null) { echo -a There's no ToDo with that ID in the database. | halt }
else { remini ToDo.ini $me $2 | echo -a The ToDo with ID $2 has been deleted. | halt }
}
}
I personally prefer small quantity of code in an event so when i have to change something i can easily see the function of the code and not get confused.
I used an alias for personal preference as well.