mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2015
Posts: 14
N
nanito Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
First at all sorry for my bad english.

Good day, I’m trying to make a rank system over this points system.

Code:
alias rank.pts {
  var %v $+(#,.,$nick)
  if ($readini(rangos.ini,%v,Rank) == 1) return 0
  elseif ($readini(rangos.ini,%v,Rank) == 2) return 0.2
  elseif ($readini(rangos.ini,%v,Rank) == 3) return 0.4
  elseif ($readini(rangos.ini,%v,Rank) == 4) return 0.6
  elseif ($readini(rangos.ini,%v,Rank) == 5) return 0.8
  return 0
}
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + $calc(1 + $rank.pts))
  if ($readini(rangos.ini,$1,Rank) = $null) { writeini -n rangos.ini $1 Rank 1 }
}
; %offline is a global variable from a socket script telling when the channel is online =  120 or offline = 360
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 %offline add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
  if ((%floodjoin) || ($($+(%,floodjoin.,$nick),2))) { return }
  set -u10 %floodjoin On
  set -u30 %floodjoin. $+ $nick On
  /cprivmsg $nick # welcome, blah blah blah... 
}
on !*:QUIT: { $+(.timerpoints.,#azubu.nanito.en,.,$nick) off }


When viewers connect to the channel the script check the points and check if the viewer has a rank data in the rank.ini file. After this, the scripts give the first point + the rank point and this rank point is an alias because is a dynamic value (sorry if I’m wrong in this). All this is controller with a timer that every X time (%offline is a global variable that check if the channel is online = 120 or offline = 360) re run the alias add.pts to give a new point.
Example: The viewer connects to the channel and he has rank lvl 5 (this mean it will have + 0.8 points in the point count). The bot give him 1.8 points every join BUT this is not happening.

The problem in the scripts is:
1. - the «rankpoint» is only given the first time the viewer connects to the channel then, when the timer triggers the add.pts alias... the timer give only 1 point and not 1.8 points.
2. - Maybe this is because the timer only runs the add.pts alias and not the rank.pts alias. (I don't know if this is true)
3. - I tried to deal with this with my «very limited scripter begginer mind» adding another timer for the rank.pts next to the timer of the add.pts but this wasn't the solution.

These are my 4 questions:
1. - How can I solve this problem? (make it work, the rank system)
2. - is it possible run 2 commands at the same time for a single timer?
3. - The global variable «%offline» return 120 as value when the stream is online and 360 when it's offline. If this global variable changes to 360 (turning off the stream) the timers maintain their value of 120 because it's the value that the viewer gets in his "Join", of course at least the viewer rejoin the channel and gets the new value = 360. Is it possible to refresh in «real time» the timers?
4. - The scripts start with the event JOIN and the viewers in the channel, who joined before the bot, don't get points, at least they do a rejoin. [I can learn to get a userlist using «names $$1» then use «raw commands» like I read here in another post (I don't learn this yet) but I don't know how to use a userlist in a Join event for this point system]. So which is the best way to use a users list (users connected to the channel before the bot joins) from the channel in this system point?.

Thanks for your patience and time,

Nanito


Last edited by nanito; 21/12/15 04:35 AM.
Joined: Nov 2015
Posts: 14
N
nanito Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
Well, after all I change the point system to another one and with a new rank system.
But I have 1 of the question pending, the number 3.
Is it possible to refresh in «real time» the timers?

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
You can use $timer(0) to get info about your current timers and then update them one by one. Check help file about this command for details.


Dont give a fish - teach to fish!
Joined: Nov 2015
Posts: 14
N
nanito Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
Ty splinny for the answer, but which is the correct method to update the timers? overwrite it?, maybe through an alias?, with another timer?.

Code:
.Timerfoo 0 %dynamicvalue myalias

%dynamicvalue is a Global variable.

with $timer(N) I can get all the info that I need. but I need to check the %dynamicvalue (and update) every rep of the timer.

again ty for your time.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Yes, you need to create new timer with same name. For me it looks easier if your timers will have some names like /timer.BLABLA.1 /timer.BLABLA.2 and so on, and when you change your value in some part of your script you will have to add loop for all .BLABLA.* timers to change its delay from 120 to 360 or back.
Probably, you can try to use something like
Code:
/timer 1 %value test
alias test { echo -ag $time | .timer 1 %value test }


Dont give a fish - teach to fish!
Joined: Nov 2015
Posts: 14
N
nanito Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Nov 2015
Posts: 14
Ty splinny for your time, the problem is solved.


Link Copied to Clipboard