I'm trying to see if there is a entry in a ini-file with a user's nick as the key or not. If not; make an entry. If it exists; post a error message.
var %previous = $readini(numbers.ini,Number,$nick)
if(%previous != $null) {
msg $chan $nick , you have already written %previous .
}
else {
writeini numbers.ini Number $nick $2
msg $chan $nick has written $2.
}
What's happening with the script above is that it is never $null
, and I can't find anywhere what is returned from $readini
if a key is not found.
$ini(numbers.ini, Numbers, $nick)
will return number N (indicating that the item is the Nth item in that section) if it exists. If it does not exist, it will return$null
.In your case, you'll want something along the lines of