mIRC Home    About    Download    Register    News    Help

Print Thread
Wildcards on readini #252518 22/04/15 07:36 PM
Joined: Nov 2014
Posts: 79
N
Newbie Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Is it possible to have a wildcard on writeini and readini? I want to incorporate a rank system without having to make a separate file, however I also don't want to look up the rank system every time I need to change the points.

For example,
Code:
  writeini -n Points.ini $nick * %points
  
  readini -n Points.ini $nick * %points


So the * is the rank of the individual and the %points would be their points.

Re: Wildcards on readini [Re: Newbie] #252521 22/04/15 09:34 PM
Joined: Jan 2004
Posts: 1,276
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,276
No, there is no /inc or /dec functionality working with files.

You must keep these values available in variables or hash tables which do have /inc and /hinc commands respectively; these can then be written to file.

Re: Wildcards on readini [Re: Loki12583] #252522 23/04/15 02:00 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
But I don't want to use /inc or /dec. Instead what I want to do is retrieve the value from the file... using readini and then calculate additions or subtractions using writeini.

The file would be written as

file_name

[Username]
Rank = Points

so I would retrieve the points using the readini command but I'm wondering if I can use a wildcard to skip reading the rank.

So to retrieve the points above I would use

$readini file_name username * points

* being the wildcard value in this example.

Re: Wildcards on readini [Re: Newbie] #252523 23/04/15 02:09 AM
Joined: Jan 2004
Posts: 1,276
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,276
Wildcard makes no sense in this context. If you need the rank, you need to read it or have it stored in a variable to avoid the read.

If you have two entities, a "rank" and "points" then the correct way to store this is not "rank = points".

If rank is determined solely by points there's no reason to read it back when updating rank anyway.

Last edited by Loki12583; 23/04/15 02:14 AM.
Re: Wildcards on readini [Re: Loki12583] #252529 23/04/15 02:53 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Rank is a variable so points do not determine the variable. So I'm assuming I would have to use $ini to retrieve the rank and then use that in order to read the file. Then use that same variable to edit the points using writeini. I kinda figured that it wouldn't work I was just making sure.

Re: Wildcards on readini [Re: Newbie] #253803 07/07/15 07:04 AM
Joined: Feb 2015
Posts: 16
L
logan_671 Offline
Pikka bird
Offline
Pikka bird
L
Joined: Feb 2015
Posts: 16
Code:
on *:text:!mypoints:#: {
if ((%floodmypoints) || ($($+(%,floodmypoints.,$nick),2))) { return }
set -u10 %floodmypoints On
set -u30 %floodmypoints. $+ $nick On
if ($readini(Points.ini,$+(#,.,$nick),Points) > 0) {
msg # $nick has a total of $readini(Points.ini,$+(#,.,$nick),Points) exp points!



is this what you mean?