mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with a script (Queueing related stuff) #251259 13/02/15 04:11 AM
Joined: Feb 2015
Posts: 6
R
RatkaStream Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2015
Posts: 6
So i have a question, and i was hoping anyone could help me out over here, i have been struggling with my bot, regarding a function i seen at some streams.

like for 2 different streams i run a different, well sort of system but the intentions with both are the same.

and its pretty much a rank system for 1 and coins for the other.

now i would love some help on how i could make this.

whenever some1 does !rank or !coins, it does $nick u have <amount> coins or ranks depending which command, but when multiple users do it, ofc it will only say it the person who first typed it.

when 2 or more do it i would like to make the message be like, using the coins as an example now.

Bot: User1 <amount>, User2 <Amount>, User3 <Amount, Etc.

I hope that is a clear example.

and i got completly clueless on how to do this, im including the !top 5 section of the scripts i use, since i thought i could do it with those functions, but i cant seem to figure that out.

so heres the little piece of script i used, and thanks for any help.
Click to reveal..
;##############################
; Points System
;##############################

on *:JOIN:#dehbeeflyy:{
timerDebbieRanks $+ $nick 0 600 add.pts $nick
}

on *:TEXT:!joinpoints:#dehbeeflyy:{
timerDebbieRanks $+ $nick 0 600 add.pts $nick
}

on *:PART:#dehbeeflyy:{
.timerDebbieRanks $+ $nick off
}

alias add.pts {
if (!$check_twitch(%twitch_username)) { | return }
set %topic $1
var %DehbeePoints $calc($readini(DehbeeRanks.ini,%topic,points) + 1)
writeini -n DehbeeRanks.ini %topic points %DehbeePoints
echo -a %topic now has %DehbeePoints
}


on *:TEXT:!top5:#dehbeeflyy:{
if (%floodDebRanks) { return }
set -u120 %floodDebRanks On
top5 #
}
alias top5 {
window -h @. | var %i 1
while $ini(DehbeeRanks.ini,%i) {
aline @. $v1 $readini(DehbeeRanks.ini,$v1,points)
inc %i
}
filter -cetuww 2 32 @. @.
var %i 1 | while %i <= 5 {
var %list $addtok(%list,$line(@.,%i),44)
inc %i
}
msg # The top 5 viewers are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
window -c @.
}

Last edited by RatkaStream; 13/02/15 04:12 AM.
Re: Need help with a script (Queueing related stuff) [Re: RatkaStream] #251260 13/02/15 05:18 AM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
You didn't include the code for !rank or !coins, so can't realy say what's wrong.. ^^

Though it sounds like those on text events have "flood protection" (just temporary variables)

You have one for that other command:

Code:
if (%floodDebRanks) { return }
set -u120 %floodDebRanks On


"set -u120 %floodDebRanks On" --> this basically means a 2 minute cooldown between uses


So either remove them or lower the timers

Last edited by Sakana; 13/02/15 05:21 AM.
Re: Need help with a script (Queueing related stuff) [Re: Sakana] #251265 13/02/15 04:22 PM
Joined: Feb 2015
Posts: 6
R
RatkaStream Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2015
Posts: 6
ah yes i know that, but thats just for the top5 command, since i dont want ppl spamming that all day long, but the coins and rank both have their own wait time before next use.

but heres the coins part which i stupidly enough indeed forget.

the coins are for a different person however but as i said, pretty much intended with the same idea.

Click to reveal..
on *:text:!coins:#missyyakimo:{
if (%FloodYaki) { return }
set -u10 %FloodYaki On
%PoroCoins = $readini(YakiRanks.ini,$nick,points)
if (%PoroCoins == $null ) {
msg # $nick you have no Poro Coins.
}
elseif (%PoroCoins > 0) {
msg # $nick you have %PoroCoins Poro Coins.
}
}


the !rank is a tad different since it includes titles.

but here it is.

Click to reveal..
on *:text:!rank:#dehbeeflyy:{
if (%floodDeb) { return }
set -u10 %floodDeb On
%Ranks = $readini(points.ini,$nick,points)
%rank1 = "Force Sensitive"
%rank2 = "Youngling"
%rank3 = "Initiate"
%rank4 = "Padawan"
%rank5 = "Knight"
%rank6 = "Seer"
%rank7 = "Sentinel"
%rank8 = "Consular"
%rank9 = "Guardian"
%rank10 = "Arbiterr"
%rank11 = "Instructor"
%rank12 = "Weapon Master"
%rank13 = "Watchmen"
%rank14 = "Lieutenant"
%rank15 = "Captain"
%rank16 = "Major"
%rank17 = "Lieutenant Colonel"
%rank18 = "Colonel"
%rank19 = "Commander"
%rank20 = "Supreme Commander"
%rank21 = "Senior General"
%rank22 = "General"
%rank23 = "High General"
%rank24 = "Ambassador"
%rank25 = "Lord"
%rank26 = "Master
%rank27 = "Council Member"
%rank28 = "Master of the Order"

if (%ranks == $null ) { msg # $nick your viewer rank is %rank1 ( $+ %ranks Points $+ ) }
elseif (%ranks < 24) { msg # $nick your viewer rank is %rank1 ( $+ %ranks Points $+ ) }
elseif (%ranks < 72) { msg # $nick your viewer rank is %rank2 ( $+ %ranks Points $+ ) }
elseif (%ranks < 120) { msg # $nick your viewer rank is %rank3 ( $+ %ranks Points $+ ) }
elseif (%ranks < 168) { msg # $nick your viewer rank is %rank4 ( $+ %ranks Points $+ ) }
elseif (%ranks < 216) { msg # $nick your viewer rank is %rank5 ( $+ %ranks Points $+ ) }
elseif (%ranks < 264) { msg # $nick your viewer rank is %rank6 ( $+ %ranks Points $+ ) }
elseif (%ranks < 360) { msg # $nick your viewer rank is %rank7 ( $+ %ranks Points $+ ) }
elseif (%ranks < 456) { msg # $nick your viewer rank is %rank8 ( $+ %ranks Points $+ ) }
elseif (%ranks < 552) { msg # $nick your viewer rank is %rank9 ( $+ %ranks Points $+ ) }
elseif (%ranks < 648) { msg # $nick your viewer rank is %rank10 ( $+ %ranks Points $+ ) }
elseif (%ranks < 744) { msg # $nick your viewer rank is %rank11 ( $+ %ranks Points $+ ) }
elseif (%ranks < 936) { msg # $nick your viewer rank is %rank12 ( $+ %ranks Points $+ ) }
elseif (%ranks < 1128) { msg # $nick your viewer rank is %rank13 ( $+ %ranks Points $+ ) }
elseif (%ranks < 1320) { msg # $nick your viewer rank is %rank14 ( $+ %ranks Points $+ ) }
elseif (%ranks < 1512) { msg # $nick your viewer rank is %rank15 ( $+ %ranks Points $+ ) }
elseif (%ranks < 1704) { msg # $nick your viewer rank is %rank16 ( $+ %ranks Points $+ ) }
elseif (%ranks < 2088) { msg # $nick your viewer rank is %rank17 ( $+ %ranks Points $+ ) }
elseif (%ranks < 2472) { msg # $nick your viewer rank is %rank18 ( $+ %ranks Points $+ ) }
elseif (%ranks < 2856) { msg # $nick your viewer rank is %rank19 ( $+ %ranks Points $+ ) }
elseif (%ranks < 3240) { msg # $nick your viewer rank is %rank20 ( $+ %ranks Points $+ ) }
elseif (%ranks < 3624) { msg # $nick your viewer rank is %rank21 ( $+ %ranks Points $+ ) }
elseif (%ranks < 4392) { msg # $nick your viewer rank is %rank22 ( $+ %ranks Points $+ ) }
elseif (%ranks < 5160) { msg # $nick your viewer rank is %rank23 ( $+ %ranks Points $+ ) }
elseif (%ranks < 5928) { msg # $nick your viewer rank is %rank24 ( $+ %ranks Points $+ ) }
elseif (%ranks < 6696) { msg # $nick your viewer rank is %rank25 ( $+ %ranks Points $+ ) }
elseif (%ranks < 7464) { msg # $nick your viewer rank is %rank26 ( $+ %ranks Points $+ ) }
elseif (%ranks < 10536) { msg # $nick your viewer rank is %rank27 ( $+ %ranks Points $+ ) }
elseif {%ranks > 10536) { msg # $nick your viewer rank is %rank28 ( $+ %ranks Points $+ ) }
else { }
}


But on basic idea, all im trying to get is to make it go like the example i gave on my first post.

since ill have a file for the viewers to watch where they can see at how many points they will get what rank.

Re: Need help with a script (Queueing related stuff) [Re: RatkaStream] #251267 13/02/15 04:59 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Oh, ok. Then you could do something along the lines of this. (Just a general idea, probably have to change a lot to make it functional)


Code:
on *:text:!coins:#:{

  set %coins $addtok(%coins,$nick - $readini(YakiRanks.ini,$nick,points,46))
  
if (!%coins.timer) { 

.timer 1 5 releasecoins # 
set %coins.timer On   
  }
}


alias releasecoins {

  msg $1 $replace(%coins,$chr(46),$chr(44) $chr(32))

  unset %coins
  unset %coins.timer
}

Last edited by Sakana; 13/02/15 05:16 PM.
Re: Need help with a script (Queueing related stuff) [Re: Sakana] #251272 13/02/15 06:41 PM
Joined: Feb 2015
Posts: 6
R
RatkaStream Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2015
Posts: 6
alright, so i was, fiddling with it myself, since it told me there was to few parameters, so i changed a few things, but it would still only tell me the name of whoever did !coins.

so i went fiddling some more and now i think i got it working actualy, or at least it seems to be working.

Click to reveal..

on *:text:!coins:#:{

%PoroCoins = $readini(YakiRanks.ini,$nick,points)
%listcoins = $nick - ( $+ %porocoins $+ ),
set %coins $addtok(%coins,%listcoins, 32 )
if (!%coins.timer) {

.timer 1 5 releasecoins #
set %coins.timer On
}
}


alias releasecoins {

msg $1 $replace(%coins,$chr(46),$chr(44) $chr(32))
unset %coins
unset %coins.timer
unset %listcoins

}


Now im getting curious, since my ranks system uses variables for the, well rank names.

would there be a way to do that as well, that it would say

user1 - (rank title), user2 - (rank title), etc

Last edited by RatkaStream; 13/02/15 06:57 PM.
Need help with a script (Queueing related stuff) [Re: RatkaStream] #251279 14/02/15 03:44 AM
Joined: Feb 2015
Posts: 6
R
RatkaStream Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Feb 2015
Posts: 6
well i actualy managed to fix it myself, with usage of the knowledge i gained through your earlier help, this is what i ended up with, seems to work quite good.

Click to reveal..
on *:text:!rank:#:{
%ranks = $readini(DehbeeRanks.ini, $nick, points)

if (%ranks == $null ) {
set %rank Force Sensitive
}
elseif (%ranks < 24) {
set %rank Force Sensitive
}
elseif (%ranks < 72) {
set %rank Youngling
}
elseif (%ranks < 120) {
set %rank Initiate
}
elseif (%ranks < 168) {
set %rank Padawan
}
elseif (%ranks < 216) {
set %rank Knight
}
elseif (%ranks < 264) {
set %rank Seer
}
elseif (%ranks < 360) {
set %rank Sentinel
}
elseif (%ranks < 456) {
set %rank Consular
}
elseif (%ranks < 552) {
set %rank Guardian
}
elseif (%ranks < 648) {
set %rank Arbiterr
}
elseif (%ranks < 744) {
set %rank Instructor
}
elseif (%ranks < 936) {
set %rank Weapon Master
}
elseif (%ranks < 1128) {
set %rank Watchmen
}
elseif (%ranks < 1320) {
set %rank Lieutenant
}
elseif (%ranks < 1512) {
set %rank Captain
}
elseif (%ranks < 1704) {
set %rank Major
}
elseif (%ranks < 2088) {
set %rank Lieutenant Colonel
}
elseif (%ranks < 2472) {
set %rank Colonel
}
elseif (%ranks < 2856) {
set %rank Commander
}
elseif (%ranks < 3240) {
set %rank Supreme Commander
}
elseif (%ranks < 3624) {
set %rank Senior General
}
elseif (%ranks < 4392) {
set %rank General
}
elseif (%ranks < 5160) {
set %rank High General
}
elseif (%ranks < 5928) {
set %rank Ambassador
}
elseif (%ranks < 6696) {
set %rank Lord
}
elseif (%ranks < 7464) {
set %rank Master
}
elseif (%ranks < 10536) {
set %rank Council Member
}
elseif {%ranks > 10536) {
set %rank Master of the Order
}
else { }

%ranklist = $nick - Points: %ranks $+ , Rank: %rank $+ ,
set %debranks $addtok(%debranks, %ranklist, 32)

if (!%debranks.timer) {

.timer 1 10 releaseranks #
set %debranks.timer On
}
}


alias releaseranks {

msg $1 $replace(%debranks,$chr(46),$chr(44) $chr(32))
unset %debranks
unset %debranks.timer
unset %ranklist
unset %ranks
unset %rank
}


so by these, thanks for the help.


This topic can be closed.

Last edited by RatkaStream; 14/02/15 03:45 AM.