mIRC Home    About    Download    Register    News    Help

Print Thread
#252842 13/05/15 07:57 PM
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Ok so here is my code,
Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn commands.txt
    msg $chan /me - Command $2- has been deleted from the database!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn commands.txt $2-
    msg $chan /me -> Command $2 has been updated!
  }
}
ON *:TEXT:*:#: { tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan  | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}

on *:text:!so &:#: {
  if ($nick isop #) { 
    msg # $2 is awesome go view them at twitch.tv/ $+ $2
  }
}


on *:text:!raid &:#: {
  if ($nick isop #) { 
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
    msg # We are raiding $2 twitch.tv/ $+ $2
  }
}


on *:TEXT:!ban &:#: {
  if ($nick isop #) { 
    msg # $2 has been banned for 12 hours, you will be reviewed by a high ranking mod. If this is fair, you will be banned. If not, see ya tomorrow!
    msg # /timeout $2 43200
  }
}
on *:TEXT:!b &:#: {
  if ($nick isop #) { 
    msg # /timeout $2 43200
  }
}

on *:text:!mods:#: {
  if (!%twitchmodlst.delay) {
    var %t = 1
    while (%t <= $nick(#,0,o)) {
      var %tmod = $iif(%tmod,%tmod $nick(#,%t,o),$nick(#,%t,o))
      inc %t
    }
    set -eu60 %twitchmodlst.delay 1
    msg # Mods Online: $iif(%tmod,%tmod,None)
  }
}

on *:TEXT:!rc:#: {
  if ($nick isop #) { 
    msg # raffle {start|end}, winner, ticket #(50 or less, cost 50 each), entries
  }
}
on *:text:!cost:#: {
  if ($nick isop #) {
    msg # The cost of the raffle is 50 points per ticket, you want more tickets so you win!!!!!
  }
}


======POINTS======



on *:TEXT:!top10:#:{
  { top10 # } 

}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.

}



alias -l addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
  var %topic $+($chan,.,$nick)
  var %points $calc($readini(Points.ini,%topic,Points) + $1)
  writeini -n Points.ini %topic Points %points
  return %points
}

alias -l lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,%topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points %points
  echo -a Added points for %topic
}

alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}

on *:text:!bal:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

on $*:text:/!bal (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points.
  }
  else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 60 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}



========RAFFLE========


on *:TEXT:!ticket &:#:{
  if (%open == 1) {
    if ($2 > 50) {
      msg $chan $nick $+ , you cannot buy that many tickets!
    }
    if ($2 < 51) {
      var %i = 0
      var %count = $2
      var %topic = $+(#,.,$nick)
      var %user = $readini(Points.ini,%topic,Points)
      var %final = 50 * %count
      var %remove = %user - %final
      if (%remove > 0) {
        writeini -n Points.ini %topic Points %remove
        while (%i < %count) {
          write Raffle.txt $nick
          %i = %i + 1
        }
        msg $chan $nick $+ , has bought %count tickets spending %final points!
      }
      if (%remove < 0) {
        msg $chan Sorry $nick but you don't have enough points to buy %count tickets!
      }
    }
  }
}
on *:TEXT:*:#:{
  if ($nick == dailyproblem)  {
    if ($1 == !raffle) {
      if ($2 == start) {
        msg $chan /me [RAFFLE STARTED]
        set %open 1
        write -c Raffle.txt
        echo -a Raffle Started
      }
      if ($2 == end) {
        msg $chan /me [RAFFLE CLOSED]
        set %open 0
        write -c Raffle.txt
        echo -a Raffle Closed
      }
    }
    if ($1 == !winner) {

      if (%open == 1) {

        var %user = $read(Raffle.txt,n)
        write -c Raffle.txt
        set %open 0
        msg $chan /me And the winner is... %user $+ !!! Well Done!
        echo -a Raffle Closed
      }
    }
  }
  if ($1 == !Entries) {
    if (%open == 1) {
      msg $chan There are currently $lines(Raffle.txt) tickets entered into the raffle!
    }
  }
}

And right after the tokenize spot, it stops working, Ive changed the order of stuff and only the first parts work, what am i doing wrong?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Only a single text event is ever triggered per file.

Code:
ON *:TEXT:*:#:{
  tokenize 32 $strip($1-,burci)


This captures all text and stops any text events below it from running. You will need to combine this with the other catch-all text event (below your other events) or move them to different files.

Also, don't put commands on the same line as an opening brace unless you're going to close the brace on the same line. And don't use braces where they aren't needed, like here:
Code:
{ top10 # }

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Ninjad

Last edited by Belhifet; 13/05/15 08:10 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: Belhifet
Ninjad

If you're going to edit out your post you can just delete it.

Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
I put it at the bottom and did everything else you have said, the entire !addcom,editcom,delcom script does not work at all now.
Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn commands.txt
    msg $chan /me - Command $2- has been deleted from the database!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn commands.txt $2-
    msg $chan /me -> Command $2 has been updated!
  }
}
ON *:TEXT:*:#: { 
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan  | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}



Correction, The main problem I am having is it will not repeat the command back to me, I have it now as all the !addcom !editcom !delcom script is at the top, and the tokenize is at the bottom, it will let me edit add and delete, but it will not repeat it back to me. What did I do wrong?
Code:
ON *:TEXT:*:#: { tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan  | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}

Last edited by dailyproblem; 13/05/15 09:33 PM.
Joined: Dec 2014
Posts: 18
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
It used to work, but in the last few days it stopped.

Joined: Jan 2014
Posts: 107
M
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
anyone know why the addcom, delcom, editcom stuff stopped working?

and if there is a workaround for it?

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Do you use this new /membership stuff?


Dont give a fish - teach to fish!

Link Copied to Clipboard