mIRC Home    About    Download    Register    News    Help

Print Thread
Search ini file for a name #255017 14/09/15 08:37 PM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Now I know this is simple
Code:
$readini(derp.ini, herps, $2/$nick)
However I know you can search for $null but how do you search if there IS a name IE return if there is a name there but else continue, Here is the code I am working on.

Code:
/////////////////
///Head Admin///
///////////////
on *:text:!hadmin:#: {
var %permstat = $readini(adminlist.ini, HeadAdmin)
  if (%permstat == $null) {
    msg $chan No Head Admin is set!
  }
  elseif (%permstat =)


As you can see I am stuck at that last part, How do I set it so that it's the opposite of null, IE not caring if his name is timmy or bob, if there is a HeadAdmin it will not continue, Any help?

Re: Search ini file for a name [Re: michaelukz] #255018 14/09/15 09:02 PM
Joined: Jul 2006
Posts: 3,726
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,726
That would be if (%permstat != $null), however, there is a concrete keyword to express the opposite of the condition you just made, 'else'
Code:
  if (%permstat == $null) {
    msg $chan No Head Admin is set!
  }
  else {
   msg $chan whatever %permstat
  }


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Search ini file for a name [Re: Wims] #255020 14/09/15 11:42 PM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Appreciate that, Hey Can you try and help with my code, I can't seem to get it to work,

Here:
Code:
/////////////////
///Head Admin///
///////////////
on *:text:!hadmin:#: {
  var %permstat = $readini(adminlist.ini, #Michaelukz, HeadAdmin)
  if (%permstat == $null) {
    msg $chan No Head Admin is set!
    if ($2 == $null) {
      msg $chan Error: Invalid use. !help hadmin
    }
    elseif (set isin $2) { 
      if ($3 == $null) { 
        msg $chan Error: No user selected
      }
      else {
        writeini adminlist.ini #Michaelukz HeadAdmin $3
      }
    }
  }
  else {
    msg $chan Error: There is already a Head-Admin
    .timer 1 2 msg $chan To continue to set an admin do /hadrem
  }
}


After this section it doesn't work:
Code:
on *:text:!hadmin:#: {
  var %permstat = $readini(adminlist.ini, #Michaelukz, HeadAdmin)
  if (%permstat == $null) {
    msg $chan No Head Admin is set!
    if ($2 == $null) {
      msg $chan Error: Invalid use. !help hadmin
    }


That all works fine. but after that... I just can't seem to debug it. smirk frown.

Re: Search ini file for a name [Re: michaelukz] #255040 16/09/15 03:41 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
on *:text:*:#: {
msg $chan /me BUMP!
}

Re: Search ini file for a name [Re: michaelukz] #255042 16/09/15 02:44 PM
Joined: Jul 2006
Posts: 3,726
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,726
You can't bump a post after a day only lol, give people some times...

Your first on text event has a wildcard match on "!hadmin", this means the whole sentence must be "!hadmin", if that event trigger, there can't possibly be a second word, so $2 will always be $null, if you want to allow for an optional second word, well it can't be done with one wildcard match, it's nicely done with a regular expression:
Code:
on $*:text:/^!hadmin( .+)?/:#:{
now you can use $2..
If you want to check that $2 is stricly "set", you should use the '==' operator, not the 'isin' operator.


I think that should resolve all your issues, unsure though.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net