mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2015
Posts: 7
dash Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Sep 2015
Posts: 7
Ok, this is basicly the idea.
User come in and writes "!checkin <NameOfTeam>" and their nick and team will be saved in a .txt named "checkins.txt"


txt example :
Nick1 - Team1
Nick2 - Team2
Nick3 - Team3

Also if they type !checked they'll get a complete read of the checkins.txt.

Now to the bigger question.
Is there anyway to complie the teams and just list out the players if someone typed "!checked" ?

Example
User writes "!checked"
Bot outputs (in channel) :
"Teams checked in : Team 1 - Nick1 - Nick11 - Nick 111"

Would be really greatful if someone could help me with this smile
P.S. Complete noob in mIRC scripting smirk


I'm just here to get help and learn smile
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on $*:text:/!check(in|ed|out|clear)/Si:#: { 
  var %command $regml(1)
  var %file checkins.ini
  if (%command == in) { 
    var %team $$2
    writeini %file %team $nick 1
    msg # Checked $nick in to team %team
  }
  elseif (%command == out) { 
    var %team $$2 
    if (!$readini(%file,%team,$nick)) msg # You're currently not checked in to team %team $+ . | return
    remini %file %team $nick
  }
  elseif (%command == ed) {
    var %teams $ini(%file,0) 
    msg # There are %teams teams entered. 
    var %i 1 
    while (%i <= %teams) { 
      var %l 1
      var %team $ini(%file,%i)
      var %members $ini(%file,%team,0)
      while (%l <= %members) { 
        var %member $ini(%file,%team,%l)
        var %teammembers $addtok(%teammembers,%member,32)
        inc %l
      }
      msg # Team: %team - %teammembers
      inc %i
      unset %teammembers
    }
  }
  elseif (%command == clear) {
    remove %file 
    msg # Cleared all checkins. 
  }
}
Untested but should work.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Sep 2015
Posts: 7
dash Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Sep 2015
Posts: 7
Didnt get any reply from the bot when testing ....
Inserted my channel after all the "#" in the code, not sure if this was supposed to be done...



Code:
on $*:text:/!check(in|ed|out|clear)/Si:#Arena.no: { 
  var %command $regml(1)
  var %file checkins.ini
  if (%command == in) { 
    var %team $$2
    writeini %file %team $nick 1
    msg #arena.no Checked $nick in to team %team
  }
  elseif (%command == out) { 
    var %team $$2 
    if (!$readini(%file,%team,$nick)) msg #arena.no You're currently not checked in to team %team $+ . | return
    remini %file %team $nick
  }
  elseif (%command == ed) {
    var %teams $ini(%file,0) 
    msg #arena.no There are %teams teams entered. 
    var %i 1 
    while (%i <= %teams) { 
      var %l 1
      var %team $ini(%file,%i)
      var %members $ini(%file,%team,0)
      while (%l <= %members) { 
        var %member $ini(%file,%team,%l)
        var %teammembers $addtok(%teammembers,%member,32)
        inc %l
      }
      msg #Arena.no Team: %team - %teammembers
      inc %i
      unset %teammembers
    }
  }
  elseif (%command == clear) {
    remove %file 
    msg #Arena.no Cleared all checkins. 
  }
}


I'm just here to get help and learn smile
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
It's not required to add Arena.no after the #, but it doesn't break it. Are you typing from the same mIRC client where the script is? You can not trigger text events on your own text. It worked fine for me when I tested. Added one line of confirmation to the script though.
Code:
on $*:text:/!check(in|ed|out|clear)/Si:#: { 
  var %command $regml(1)
  var %file checkins.ini
  if (%command == in) { 
    var %team $$2
    writeini %file %team $nick 1
    msg # Checked $nick in to team %team
  }
  elseif (%command == out) { 
    var %team $$2 
    if (!$readini(%file,%team,$nick)) { msg # You're currently not checked in to team %team $+ . | return }
    remini %file %team $nick
    msg # Checked $nick out of team %team
  }
  elseif (%command == ed) {
    var %teams $ini(%file,0) 
    msg # There are %teams teams entered. 
    var %i 1 
    while (%i <= %teams) { 
      var %l 1
      var %team $ini(%file,%i)
      var %members $ini(%file,%team,0)
      while (%l <= %members) { 
        var %member $ini(%file,%team,%l)
        var %teammembers $addtok(%teammembers,%member,32)
        inc %l
      }
      msg # Team: %team - %teammembers
      inc %i
      unset %teammembers
    }
  }
  elseif (%command == clear) {
    remove %file 
    msg # Cleared all checkins. 
  }
}

Basic syntax and expected response:
Quote:
[13:20] <@nillens> !checkin test
[13:20] <@nillensbot> Checked nillens in to team test
[13:20] <@nillens> !checked
[13:20] <@nillensbot> There are 1 teams entered.
[13:20] <@nillensbot> Team: test - nillens
[13:20] <@nillens> !checkout test2
[13:20] <@nillensbot> You're currently not checked in to team test2.
[13:20] <@nillens> !checkout test
[13:20] <@nillensbot> Checked nillens out of team test
[13:20] <@nillens> !checkclear
[13:20] <@nillensbot> Cleared all checkins.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Sep 2015
Posts: 7
dash Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Sep 2015
Posts: 7
Placed it in both my CTRL+R & the scripts folder inside mIRC, but still nothing .... Where am i supposed to insert the file and does it matter if it's .txt or .ini ?


I'm just here to get help and learn smile
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Press ALT + R inside mIRC.
Go to File > New
Paste the code there.
Go to File > Rename
Rename the file to Check, press OK to confirm
Press OK to save file and leave script editor
Paste this line to your editbox: //echo -a $iif($script(check.ini),Yes,No)
If this returns Yes, you script is loaded and you should be fine.

The extension doesn't matter.
If you place it in a folder, you can load the scripts by using /load -rs path/to/script

If you however use my step by step above, it will by default be saved as an .ini file. Hence why checking if $script(check.ini) returns a value is valid.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Sep 2015
Posts: 7
dash Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Sep 2015
Posts: 7
got it to work but , now i have a new problem.

Everyone can accsess the !checkclear command...
This needs to be a OP only command... Any idea on how to do this ?

Last edited by dash; 11/09/15 02:14 PM.

I'm just here to get help and learn smile
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
I didn't include that for the reason that this may or may not be the case.
Simple knowledge in the mIRC language would tell you that adding
Code:
if ($nick !isop #) return
would do exactly that. Add this on the line under elseif (%command == clear) {


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Link Copied to Clipboard