mIRC Home    About    Download    Register    News    Help

Print Thread
#256660 07/02/16 05:41 PM
Joined: Jul 2015
Posts: 42
J
Joveice Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jul 2015
Posts: 42
So i have a script that gives 1 point/min and i was wondering if there is a "command" to turn a number into
Year/Days/Hours/Min
like some of the clock commands can do.

Joveice #256661 07/02/16 05:44 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
What number you are talking about? paste your code and give a better description of what you need.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #256663 07/02/16 06:02 PM
Joined: Jul 2015
Posts: 42
J
Joveice Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jul 2015
Posts: 42
So this script adds the user to its register so it can follow its tracks
Code:
on *:JOIN:#:{
  if (VoltTechBot isop 12322dd) {
    /halt
  }
  var %cc = $chan
  var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ %cc $+ \database.ini
  var %topicb = Bot.Settings

  if ($chan == #volttechbot) { /halt }
  if ($nick == volttechbot) { /halt }
  if ($nick == moobot) { /halt }
  if ($nick == nightbot) { /halt }
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ %cc $+ \register.txt | var %pointy = C:\Users\server\Documents\mIRCsave\ $+ %cc $+ \Points.ini | var %topic = $nick | var %Group = $readini(%pointy,%topic,Group)
  if ($nick isin $read(%chani)) {
    .timerjp. $+ $chan $+ . $+ $nick 1 60 { tims # $nick }
    /halt
  }
  if ($nick !isin $read(%chani)) {
    var %ify = $chr(035) $+ $nick
    var %grp = Normal
    if (%ify = $chan) { var %grp = Admin }
    write -al1 %chani $chr(124) $nick
    var %topic = $+(#,.,$nick)
    var %user = $readini(%pointy,%topic,Points)
    writeini -n %pointy %topic Points 1
    writeini -n %pointy %topic Group %grp
    writeini -n %pointy %topic Linkperm False
    .timerjp. $+ $chan $+ . $+ $nick 1 60 { tims # $nick }
    /halt
  }
  /halt
  :error
  msg $chan $error
  msg $chan Please report this bug with !reportbug <bug> $chan
  /halt
}
alias tims {
  if ($1 !isin %onchan) { echo * Timers for $2 @ $1 Terminated due channel issued !leave | /halt }
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ $1 $+ \register.txt | var %pointy = C:\Users\server\Documents\mIRCsave\ $+ $1 $+ \Points.ini | var %topic = $+($1,.,$2) | var %Group = $readini(%pointy,%topic,Group) | var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ $1 $+ \database.ini | var %topicb = Bot.Settings | var %Bot = $readini(%BotStatus,%topicb,Bot)
  var %topic = $+($1,.,$2)
  var %user = $readini(%pointy,%topic,Points)
  var %sum = $calc(%user + 1)
  writeini -n %pointy %topic Points %sum
  .timerjp. $+ $1 $+ . $+ $2 1 60 { tims $1 $2 }
  /halt
  :error
  msg $chan $error
  msg $chan Please report this bug with !reportbug <bug>
  /halt
}


It stores it in this formate
Code:
[#channelname.joveice]
Points=26
Group=Normal
Linkperm=False


in this I have watched for 26min.

Code:
on *:TEXT:!me:#:{

  if ($chan == #volttechbot) { /halt }
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ $chan $+ \register.txt | var %pointy = C:\Users\server\Documents\mIRCsave\ $+ $chan $+ \Points.ini | var %topic = $+(#,.,$nick) | var %Group = $readini(%pointy,%topic,Group) | var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ $chan $+ \database.ini | var %topicb = Bot.Settings | var %Bot = $readini(%BotStatus,%topicb,Bot)
  if (%bot == on) {
    if ($nick !isin $read(%chani)) {
      msg $chan $nick register to use this !reg
      /halt
    }
    var %topic = $+(#,.,$nick)
    var %user = $readini(%pointy,%topic,Points)
    var %time = $calc(%user / 60)
    var %time2 = $int(%time)
    if (%time < 1) {
      msg $chan $nick has watched $chan for %user min.
      /halt
    }
    msg $chan $nick has watched $chan for %time2 hour(s).
  }
}

That shows the watch time and iv made it if its under 1 after min is devided on 60 (min to hours)
it shows it in plain numbers
and if its above 1 after it shows that its hours.
Tho i would like it to do this
Name has watched for 0 Years / 0 Days / 0 Hours / 26 Min.

Last edited by Joveice; 07/02/16 06:02 PM.
Joveice #256664 07/02/16 06:06 PM
Joined: Jul 2015
Posts: 42
J
Joveice Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jul 2015
Posts: 42
So basicly transfer a number lets say 525600 and it does some math and says Watched for 1 Year

Joveice #256665 07/02/16 06:23 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Actually your code had some security and some bugs that i fixed them, so try use this code and make sure that i use $duration mIRC identifier that it can only count Weeks,Days,Hours,Mins,Secs (and this is for purpose)

/help $duration

Code:
ON *:TEXT:!me:#:{
  if ($chan == #volttechbot) { return }
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \register.txt 
  var %pointy = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \Points.ini
  var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \database.ini 
  var %topic = $chan $+ . $+ $nick
  var %Group = $readini(%pointy,n,%topic,Group)
  var %Bot = $readini(%BotStatus,n,Bot.Settings,Bot)
  if (%bot == on) {
    if (!$read(%chani,nw,* $+ $nick $+ *)) { msg $chan $nick register to use this !reg | return }
    var %topic = $chan $+ . $+ $nick
    var %user = $readini(%pointy,n,%topic,Points)
    if (%user) { msg $chan $nick has watched $chan for $duration(%user) }
    elseif (!%user) { msg $chan $nick has not watched $chan yet! }
  }
}

ON !*:JOIN:#: {
  if ($chan == #volttechbot) || ($nick == volttechbot) || ($nick == moobot) || ($nick == nightbot) { return }
  var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \database.ini
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \register.txt
  var %pointy = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($chan) $+ \Points.ini
  var %Group = $readini(%pointy,n,$nick,Group)
  if ($read(%chani,nw,* $+ $nick $+ *)) { .timerjp. $+ $chan $+ . $+ $nick 1 60 tims $chan $nick | return }
  var %ify = $chr(35) $+ $nick
  var %grp = Normal
  if (%ify == $chan) { var %grp = Admin }
  write -al1 $qt(%chani) $chr(124) $nick
  var %topic = $chan $+ . $+ $nick
  var %user = $readini(%pointy,n,%topic,Points)
  writeini -n $qt(%pointy) %topic Points 1
  writeini -n $qt(%pointy) %topic Group %grp
  writeini -n $qt(%pointy) %topic Linkperm False
  .timerjp. $+ $chan $+ . $+ $nick 1 60 tims $chan $nick
  return
  :error
  msg $chan $error
  msg $chan Please report this bug with !reportbug <bug> $chan
  reseterror
}

alias tims {
  if ($1 !isin %onchan) { echo * Timers for $2 @ $1 Terminated due channel issued !leave | return }
  var %chani = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($1) $+ \register.txt
  var %pointy = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($1) $+ \Points.ini
  var %BotStatus = C:\Users\server\Documents\mIRCsave\ $+ $mkfn($1) $+ \database.ini
  var %topic = $1 $+ . $+ $2
  var %Group = $readini(%pointy,n,%topic,Group)
  var %Bot = $readini(%BotStatus,n,Bot.Settings,Bot)
  var %user = $readini(%pointy,n,%topic,Points)
  writeini -n $qt(%pointy) %topic Points $calc(%user + 1)
  .timerjp. $+ $1 $+ . $+ $2 1 60 tims $1 $2
  return
  :error
  msg $chan $error
  msg $chan Please report this bug with !reportbug <bug>
  reseterror
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #256666 07/02/16 06:38 PM
Joined: Jul 2015
Posts: 42
J
Joveice Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jul 2015
Posts: 42
Uh what was the bugs and security problems?
and $duration(some number) shows 60 as 1 min when the program logs every min and not every secound so 60 is 1 hour
EDIT
i just did var %newtime $calc(%user * 60)
so i fixed that problem

Last edited by Joveice; 07/02/16 06:39 PM.
Joveice #256674 07/02/16 10:22 PM
Joined: Jul 2015
Posts: 42
J
Joveice Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jul 2015
Posts: 42
I mean my whole bot is based on this type of code. what is the problem with it? becouse i have a few things to change then

Joveice #256675 07/02/16 10:43 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$read should always be used with the 'n' switch to prevent evaluation of its contents, especially if that content comes from an external source. Timers may also be exploited, see this page: http://en.wikichip.org/wiki/mirc/msl_injection

Last edited by Loki12583; 07/02/16 10:44 PM.

Link Copied to Clipboard