mIRC Home    About    Download    Register    News    Help

Print Thread
Twitch warn system (Need fixing) #250800 31/01/15 08:07 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Ok, I am currently stuck on a little thing I am working on, As the title entails, its a 'warning' system, Basically when someone types !warn <user> it will either warn them or say you need to input a name if you have set it to null, another feature !rwarn you can add a reason for warning someone, it can go up to as many words as you wish, if you want to copy, by default it has 10 words max this feature also has a timestamp with date. (thanks to sakana) The final feature is !listwarns <user> where it tell you how many warnings the user has.

Here is my main problem which I don't see what's going wrong. In the 'console' it inputs this

Code:
/writeini: insufficient parameters (line 21, script3.ini)


Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings $calc(%val + %add)
  if (%val($2) == 3) {
    msg $chan %user has had the maximum warnings!  Timing out the %user
    msg $chan /timeout 600 $2
  }
  else (%user)
  msg $chan %user has been warned
  writeini -n warns.ini %user warnings $calc(%val + %add)
  timeout 1
}

// On join load warnings
ON *:JOIN:#: {
  var %user = $nick
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings %val
}

// Add warning reason plus time
ON 4:TEXT:!rwarn*:#: { 
  var %user = $2
  var %date = Day: $day Date: $date Time: $time 
  var %reason = $3 $4 $5 $6 $7 $8 $9 $10
  writeini -n rwarn.ini %user timestamp %date Reason %reason
}


That is my full code (discluding the !listwarns), I have several issues (Keep in mind, most thing's I have made is with help.), For starters when someone types for example "!warnlist michaelukz" it outputs '
michaelukz has been warned'

This is what I wish for main help with >

Code:
// On join load warnings
ON *:JOIN:#: {
  var %user = $nick
  var %val = $readini(warns.ini, %user, warnings)
  writeini -n warns.ini %user warnings %val
}
< That outputs the first error
Code:
/writeini: insufficient parameters (line 21, script3.ini)


The other problem with this batch is the else's do not seem to work at all.

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250801 31/01/15 08:09 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Here is my !listwarns commands

Code:
// Checks warnings
ON 3:TEXT:!listwarns $:#: {
  var %user = $2
  var %warns = $readini(warns.ini, %user, warnings)
  if (%user) == null {
    msg $chan Please type a users name!
  }
  else { 
    msg $chan /me $2 has %warns warnings!
  }
}


Currently it seems to do nothing also, I had it working but I wished to add the if and else, and it seemed to break, Again this is my first time with if and else statements

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250805 31/01/15 09:08 AM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Try this guide

http://en.wikichip.org/wiki/mirc/commands/writeini

Also seems like you have some wrong syntax.

For example
Code:
else (%user)


Do you mean
Code:
elseif (%user) {
?

Re: Twitch warn system (Need fixing) [Re: Sakana] #250837 01/02/15 02:01 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Everything works except the alert

Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini( warns.ini, %user, warnings )
  writeini -n warns.ini %user warnings $calc(%val + 1)
  if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250839 01/02/15 02:25 AM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Code:
  if (%val == $3) { msg $chan %user has had the maximum warnings! }

maybe that's supossed to be 3?
Code:
  if (%val == 3) { msg $chan %user has had the maximum warnings! }


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: Twitch warn system (Need fixing) [Re: judge2020] #250844 01/02/15 02:48 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
I had had it at 3 and yet it still did nothing so was testing if it was similiar to $null not null

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250858 01/02/15 07:05 PM
Joined: Jun 2014
Posts: 248
B
Belhifet Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Originally Posted By: michaelukz
Everything works except the alert

Code:
// Add warnings to a player
ON 5:TEXT:!warn*:#: {
  var %user = $2
  var %add = 1
  var %val = $readini( warns.ini, %user, warnings )
  writeini -n warns.ini %user warnings $calc(%val + 1)
  if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}

Its worth noting that you are setting %val before incriminating the number of warns that the person has received.

Also the if/elseif are weird. What are you actually attempting to do here?

Last edited by Belhifet; 01/02/15 07:05 PM.
Re: Twitch warn system (Need fixing) [Re: Belhifet] #250891 02/02/15 01:19 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Code:
if (%val == $3) { msg $chan %user has had the maximum warnings! }
  elseif (%user) {
    msg $chan %user has been warned
    writeini -n warns.ini %user warnings $calc( %val + 1 )
  }
}


The if being if it has more than 3 warnings message "%user has had the maximum warnings!" else just add one to the warnings.

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250926 03/02/15 03:08 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
*Bump*

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250957 04/02/15 04:39 AM
Joined: Dec 2014
Posts: 68
M
michaelukz Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
*Rebump*

Anyone got a fix?

Re: Twitch warn system (Need fixing) [Re: michaelukz] #250958 04/02/15 05:12 AM
Joined: Jun 2014
Posts: 248
B
Belhifet Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
if (%val >= 3) { msg $chan %user has had the maximum warnings! }
else {