mIRC Home    About    Download    Register    News    Help

Print Thread
#255017 14/09/15 08:37 PM
Joined: Dec 2014
Posts: 68
M
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?

Joined: Jul 2006
Posts: 4,146
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,146
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
  }


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2014
Posts: 68
M
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.

Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
on *:text:*:#: {
msg $chan /me BUMP!
}

Joined: Jul 2006
Posts: 4,146
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,146
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard