mIRC Home    About    Download    Register    News    Help

Print Thread
#250671 27/01/15 01:03 AM
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Hi, I am trying to get a warn system setup, and I want to do it via writeini and readini, However, I can do basic scripting, so I don't know how to do writeini or readini, and as to tutorials, there aren't any tutorials based on JUST writeini and readini. OK, the script I need is going to have it so that when a OP type for example !warn michaelukz it will do this "warns.ini, $2 , Warnings" then when a player types !wlist it will list their warns and if an op types for example !wlist michaelukz it will list michaelukz' warnings, if a player exceeds 2 warnings and his/her warnings are at 3 it tell's the broadcaster that this person has exceeded his maximum warns, And if anyone knows a good tutorial for readini and writeini only, preferred video but text is ok smile

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Before I answer any questions, I need to know one primary thing:

Do these warnings need to persist between multiple "sessions"?

A session is where you close mIRC and open mIRC again.

To ask in another way: Does mIRC need to remember yesterday's warnings?


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
Yes, It needs to keep a list of ALL, also, Just curious, would it be possible to incorporate a timestamp of when EACH individual warn, and what for.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
I'll open this back up to anyone else who wants to write the script. Fortunately for twitch scripts, nicknames are persistent and can't be changed.

As far as $readini() and /writeini go, they are very simple.

/writeini -n file.ini section item value
/echo -a $readini(file.ini,n,section,item)


In your script, you might take an approach like:

var %file = twitch_warns.ini
; $calc() is used in case of $null return, it becomes the number '0'. Required for if < 3.
var %warns = $calc($readini(%file,n,$nick,warns))
if (%warns < 3) {
  inc %warns 1
  writeini -n %file $nick warns %warns
  writeini -n %file $nick warning $+ %warns $fulldate
  msg $chan $nick $+ : This is your $ord(%warns) warning! Don't let it happen again!
}
else {
  timeout $nick Too many warnings.
}


You can list the warning dates with something like...

var %nick = $$2
var %file = twitch_warns.ini
var %warns = $calc($readini(%file,n,%nick,warns))
var %i = 1
while (%i <= %warns) {
  var %warning = $readini(%file,n,$nick,warning $+ %i)
  msg $chan %nick $+ 's warning %i happened on %warning
  inc %i
}

Last edited by Raccoon; 27/01/15 03:05 AM.

Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard