|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Hi, so I need help with gambling script. This is what I got on $*:text:/!slots/Si:#: {
set %taskai $get.pts(#,$nick)
if (%taskai < $2) msg # $+($nick,$chr(44)) you only have %taskai chips
else {
set %prand $rand(1,175)
set %srand1 $rand(1,5)
set %srand2 $rand(1,5)
set %srand3 $rand(1,5)
while (%srand1 == %srand2) {
set %srand2 $rand(1,5)
}
if (%prand < 5) {
set %srand1 3
set %srand2 3
set %srand3 3
}
elseif (%prand < 15) {
set %srand1 2
set %srand2 2
set %srand3 2
}
elseif (%prand < 30) {
set %srand1 1
set %srand2 1
set %srand3 1
}
if (%srand1 == 1) set %srand1 @
if (%srand1 == 2) set %srand1 %
if (%srand1 == 3) set %srand1 $
if (%srand1 == 4) set %srand1 &
if (%srand1 == 5) set %srand1 !
if (%srand2 == 1) set %srand2 @
if (%srand2 == 2) set %srand2 %
if (%srand2 == 3) set %srand2 $
if (%srand2 == 4) set %srand2 &
if (%srand2 == 5) set %srand2 !
if (%srand3 == 1) set %srand3 @
if (%srand3 == 2) set %srand3 %
if (%srand3 == 3) set %srand3 $
if (%srand3 == 4) set %srand3 &
if (%srand3 == 5) set %srand3 !
set %win1 $2
set %win2 $calc( $2 * 5 )
set %win3 $calc( $2 * 10 )
set %awins 0
PRIVMSG $nick Isriedejo: ( %srand1 )( %srand2 )( %srand3 )
if (%srand1 == @) if (%srand2 == @) if (%srand3 == @) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if ($calc( %win1 * 2 ) > %awins) set %awins $calc( %win1 * 2 )
}
}
if (%srand1 == % || %srand2 == % || %srand3 == %) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win2 > %awins) set %awins %win2
}
}
if (%srand1 == $ || %srand2 == $ || %srand3 == $) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win3 > %awins) set %awins %win3
}
}
if (%awins == 0) {
PRIVMSG $nick Atsiprasau, tu pralaimejai $comma($2) tasku
add.pts $+ $nick
set %outval $calc( %taskai - $2 )
add.pts # $nick %outval
}
else {
PRIVMSG $nick Sveikinu! Tu laimejai $comma(%awins) tasku!
add.pts # $nick $+
set %outval $calc(( %taskai - $2 ) + %awins ))
add.pts # $nick %outval
}
PRIVMSG $nick $+($nick,$chr(44)) dabar tu turi $comma($get.pts(#,$nick))
PRIVMSG $nick Palauk 60sec jei nori vel suzaisti
ignore -cu60 $nick
timertime 1 60 PRIVMSG $nick You can now play again!
}
} And main problem is here if (%awins == 0) {
PRIVMSG $nick (Lose) Atsiprasau, tu pralaimejai $comma($2) tasku
add.pts $+ $nick
set %outval $calc( %taskai - $2 )
add.pts # $nick %outval
}
else {
PRIVMSG $nick (Win) Sveikinu! Tu laimejai $comma(%awins) tasku!
add.pts # $nick $+
set %outval $calc(( %taskai - $2 ) + %awins ))
add.pts # $nick %outval
}
Maybe someone can help fix this? p.s. this is points system http://pastebin.com/tkxMJuqr
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
First of all you did not describe what problem you have, pasting only the code doesn't help us to understand your problem, but actually there is an small issue that 'may' be this the problem. Before replace the code use: /unset %taskai %prand %win* %awins %srand* %outval1st code:
on $*:text:/!slots/Si:#: {
var %taskai = $get.pts(#,$nick)
if (%taskai < $2) msg # $+($nick,$chr(44)) you only have %taskai chips
else {
var %prand = $rand(1,175)
var %srand1 = $rand(1,5)
var %srand2 = $rand(1,5)
var %srand3 = $rand(1,5)
if (%srand1 == %srand2) { var %srand2 = $rand(1,5) }
if (%prand < 5) {
var %srand1 = 3
var %srand2 = 3
var %srand3 = 3
}
elseif (%prand < 15) {
var %srand1 = 2
var %srand2 = 2
var %srand3 = 2
}
elseif (%prand < 30) {
var %srand1 = 1
var %srand2 = 1
var %srand3 = 1
}
if (%srand1 == 1) var %srand1 = @
if (%srand1 == 2) var %srand1 = $chr(37)
if (%srand1 == 3) var %srand1 = $chr(36)
if (%srand1 == 4) var %srand1 = &
if (%srand1 == 5) var %srand1 = !
if (%srand2 == 1) var %srand2 = @
if (%srand2 == 2) var %srand2 = $chr(37)
if (%srand2 == 3) var %srand2 = $chr(36)
if (%srand2 == 4) var %srand2 = &
if (%srand2 == 5) var %srand2 = !
if (%srand3 == 1) var %srand3 = @
if (%srand3 == 2) var %srand3 = $chr(37)
if (%srand3 == 3) var %srand3 = $chr(36)
if (%srand3 == 4) var %srand3 = &
if (%srand3 == 5) var %srand3 = !
var %win1 = $2
var %win2 = $calc( $2 * 5 )
var %win3 = $calc( $2 * 10 )
var %awins = 0
msg $chan $nick Isriedejo: ( %srand1 )( %srand2 )( %srand3 )
if (%srand1 == @) if (%srand2 == @) if (%srand3 == @) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if ($calc( %win1 * 2 ) > %awins) var %awins = $calc( %win1 * 2 )
}
}
if (%srand1 == % || %srand2 == % || %srand3 == %) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win2 > %awins) var %awins = %win2
}
}
if (%srand1 == $ || %srand2 == $ || %srand3 == $) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win3 > %awins) var %awins = %win3
}
}
if (%awins == 0) {
msg $nick Atsiprasau, tu pralaimejai $comma($2) tasku
var %outval = $calc( %taskai - $2 )
add.pts # $nick %outval
}
else {
msg $chan $nick Sveikinu! Tu laimejai $comma(%awins) tasku!
var %outval = $calc(( %taskai - $2 ) + %awins ))
add.pts # $nick %outval
}
msg $chan $nick $+($nick,$chr(44)) dabar tu turi $comma($get.pts(#,$nick))
msg $chan $nick Palauk 60sec jei nori vel suzaisti
ignore -cu60 $nick
timertime 1 60 msg $nick You can now play again!
}
} 2nd code:
if (%awins == 0) {
msg $nick (Lose) Atsiprasau, tu pralaimejai $comma($2) tasku
var %outval = $calc( %taskai - $2 )
add.pts # $nick %outval
}
else {
msg $nick (Win) Sveikinu! Tu laimejai $comma(%awins) tasku!
var %outval = $calc(( %taskai - $2 ) + %awins ))
add.pts # $nick %outval
}
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
So, problem is that I don't lose points if I lose game, and another problem is that If I win I get too much points. Here example: http://prntscr.com/9pc94u
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Try this one: on $*:text:/!slots/Si:#: {
var %taskai = $get.pts(#,$nick)
if (%taskai < $2) { msg # $+($nick,$chr(44)) you only have %taskai chips! | return }
var %prand = $rand(1,175)
var %srand1 = $rand(1,5)
var %srand2 = $rand(1,5)
var %srand3 = $rand(1,5)
if (%srand1 == %srand2) { var %srand2 = $rand(1,5) }
if (%prand < 5) {
var %srand1 = 3
var %srand2 = 3
var %srand3 = 3
}
elseif (%prand < 15) {
var %srand1 = 2
var %srand2 = 2
var %srand3 = 2
}
elseif (%prand < 30) {
var %srand1 = 1
var %srand2 = 1
var %srand3 = 1
}
if (%srand1 == 1) var %srand1 = @
if (%srand1 == 2) var %srand1 = $chr(37)
if (%srand1 == 3) var %srand1 = $chr(36)
if (%srand2 == 1) var %srand2 = @
if (%srand2 == 2) var %srand2 = $chr(37)
if (%srand2 == 3) var %srand2 = $chr(36)
if (%srand3 == 1) var %srand3 = @
if (%srand3 == 2) var %srand3 = $chr(37)
if (%srand3 == 3) var %srand3 = $chr(36)
var %win1 = $calc( $2 * 2 )
var %win2 = $calc( $2 * 5 )
var %win3 = $calc( $2 * 10 )
msg $chan $nick Isriedejo: ( %srand1 )( %srand2 )( %srand3 )
if (%srand1 == @) || (%srand2 == @) || (%srand3 == @) {
if (%srand1 == %srand2) && (%srand2 == %srand3) {
if (%win1 > %awins) { var %awins = %win1 }
}
}
if (%srand1 == $chr(37)) || (%srand2 == $chr(37)) || (%srand3 == $chr(37)) {
if (%srand1 == %srand2) && (%srand2 == %srand3) {
if (%win2 > %awins) { var %awins = %win2 }
}
}
if (%srand1 == $chr(36)) || (%srand2 == $chr(36)) || (%srand3 == $chr(36)) {
if (%srand1 == %srand2) && (%srand2 == %srand3) {
if (%win3 > %awins) { var %awins = %win3 }
}
}
if (!%awins) {
msg $nick Atsiprasau, tu pralaimejai $comma($2) tasku
var %outval = $calc( %taskai - $2 )
if (%outval) { add.pts # $nick %outval }
elseif (!%outval) { clean.pts # $nick }
}
elseif (%awins) {
msg $chan $nick Sveikinu! Tu laimejai $comma(%awins) tasku!
var %outval = $calc(( %taskai - $2 ) + %awins ))
if (%outval) { add.pts # $nick %outval }
elseif (!%outval) { clean.pts # $nick }
}
msg $chan $nick $+($nick,$chr(44)) dabar tu turi $comma($get.pts(#,$nick))
msg $chan $nick Palauk 60sec jei nori vel suzaisti
.ignore -cu60 $nick
.timertime 1 60 msg $nick You can now play again!
}
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
So its weird, but I will try show you everything whats happening. 1. http://prntscr.com/9pdoe32. This is all chat and whats happening http://pastebin.com/KL5sjq1YAnd now this acting weird " ( @ )( 5 )( 5 )" instead of symbols its say numbers. Tomorrow I will try show everything more detailed. Now I have to go.
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
So I'm back and I just want to post script, fixed and working. Thanks for helping Westor. alias -l comma {
var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
return %a
}
on $*:text:/!slots/Si:#: {
if ((%floodslots) || ($($+(%,floodslots.,$nick),2))) { return }
set -u5 %floodslots On
set -u60 %floodslots. $+ $nick On
var %taskai = $get.pts(#,$nick)
if (%taskai < $2) msg # $+($nick,$chr(44)) Tu turi tik %taskai tasku
else {
var %prand = $rand(1,175)
var %srand1 = $rand(1,5)
var %srand2 = $rand(1,5)
var %srand3 = $rand(1,5)
if (%srand1 == %srand2) { var %srand2 = $rand(1,5) }
if (%prand < 5) {
var %srand1 = 3
var %srand2 = 3
var %srand3 = 3
}
elseif (%prand < 15) {
var %srand1 = 2
var %srand2 = 2
var %srand3 = 2
}
elseif (%prand < 30) {
var %srand1 = 1
var %srand2 = 1
var %srand3 = 1
}
if (%srand1 == 1) var %srand1 = @
if (%srand1 == 2) var %srand1 = $chr(37)
if (%srand1 == 3) var %srand1 = $chr(36)
if (%srand1 == 4) var %srand1 = &
if (%srand1 == 5) var %srand1 = !
if (%srand2 == 1) var %srand2 = @
if (%srand2 == 2) var %srand2 = $chr(37)
if (%srand2 == 3) var %srand2 = $chr(36)
if (%srand2 == 4) var %srand2 = &
if (%srand2 == 5) var %srand2 = !
if (%srand3 == 1) var %srand3 = @
if (%srand3 == 2) var %srand3 = $chr(37)
if (%srand3 == 3) var %srand3 = $chr(36)
if (%srand3 == 4) var %srand3 = &
if (%srand3 == 5) var %srand3 = !
var %win1 = $calc( $2 * 3 )
var %win2 = $calc( $2 * 5 )
var %win3 = $calc( $2 * 10 )
var %awins = 0
PRIVMSG $nick Isriedejo: ( %srand1 )( %srand2 )( %srand3 )
if (%srand1 == @) if (%srand2 == @) if (%srand3 == @) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if ($calc( %win1 * 1 ) > %awins) var %awins = $calc( %win1 * 1 )
}
}
if (%srand1 == % || %srand2 == % || %srand3 == %) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win2 > %awins) var %awins = %win2
}
}
if (%srand1 == $ || %srand2 == $ || %srand3 == $) {
if (%srand1 == %srand2 && %srand2 == %srand3) {
if (%win3 > %awins) var %awins = %win3
}
}
if (%awins == 0) {
var %outval = $calc( - $2 )
add.pts # $nick %outval
PRIVMSG $nick (Lose) Atsiprasau, tu pralaimejai $2 tasku(s) ___ Dabar tu turi $comma($get.pts(#,$nick)) tasku(s) ___ Bandyk vel po 1min :)
}
else {
var %outval = $calc( %awins )
add.pts # $nick %outval
PRIVMSG $nick (Win) Sveikinu! Tu laimejai $comma(%awins) tasku(s)! ___ Dabar tu turi $comma($get.pts(#,$nick)) tasku(s) ___ Bandyk vel po 1min :)
}
}
}
|
|
|
|
Joined: Jan 2016
Posts: 8
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Jan 2016
Posts: 8 |
Fun script just tried it :P
Maybe it would be fun if you add a leader board to it. For example top five players with highest points.
BTW you forgot to add the message on the end again that announce that you can use the slot machine again :P
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Fun script just tried it :P
Maybe it would be fun if you add a leader board to it. For example top five players with highest points.
BTW you forgot to add the message on the end again that announce that you can use the slot machine again :P Ye would be great. I know I removed because 3 messages for one user is too much, don't want to get global ban in twitch :P
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Hi again, so I noticed problem with this script, people can bet even when they don't have points, for example: !slots -500 <-- when they add ( - ) in front of number. Maybe someone know how to fix it ?
|
|
|
|
Joined: Oct 2015
Posts: 112
Vogon poet
|
Vogon poet
Joined: Oct 2015
Posts: 112 |
Hi again, so I noticed problem with this script, people can bet even when they don't have points, for example: !slots -500 <-- when they add ( - ) in front of number. Maybe someone know how to fix it ? There are a few ways to do this. The easiest way, if you don't want to create any custom replies for if they use a negative number, would be to just change the event line to: on $*:text:/^!slots\s\d+$/Si:#: This forces positive numbers without decimal places.
Last edited by Blas; 22/01/16 03:20 AM.
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Thanks
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Hi again, so I noticed problem with this script, people can bet even when they don't have points, for example: !slots -500 <-- when they add ( - ) in front of number. Maybe someone know how to fix it ? There are a few ways to do this. The easiest way, if you don't want to create any custom replies for if they use a negative number, would be to just change the event line to: on $*:text:/^!slots\s\d+$/Si:#: This forces positive numbers without decimal places. Hey again, how do I block negative numbers for this? on $*:text:/!taskai (duoti)/Si:#dariux1x: {
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
Fixed. Script there regular user can give his points to other users. on $*:text:/!taskai (duoti)/Si:#: {
if ((%floodduoti) || ($($+(%,floodduoti.,$nick),2))) { return }
set -u1 %floodduoti On
set -u2 %floodduoti. $+ $nick On
if ($4 < 0) { PRIVMSG $nick Skaiciu rasyk be minuso :) | return }
if ($0 < 4) { PRIVMSG $nick Klaida: Rasyk !taskai <duoti> <nick> [skaicius] | return }
var %taskai = $get.pts(#,$nick)
if (%taskai < $4) msg # $+($nick,$chr(44)) Tu turi tik %taskai tasku
else {
add.pts # $3 $4
add.pts # $nick $calc( - $4)
PRIVMSG $nick Tu davei $3 $4 tasku }
{ PRIVMSG $3 Tau $nick dave $4 tasku }
}
Last edited by Deerayn; 28/01/16 11:00 PM.
|
|
|
|
Joined: Sep 2015
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2015
Posts: 33 |
So only now I noticed bug with this script, people who join channel for first time, don't have points and its says that "Bot: <nick> have _ points", and they can gamble, if they lose they have negative number of points. on $*:text:/!slots/Si:#: {
if ((%floodslots) || ($($+(%,floodslots.,$nick),2))) { return }
set -u3 %floodslots On
set -u30 %floodslots. $+ $nick On
if ($2 < 10) { PRIVMSG $nick Min. of points is 10 :) | return }
var %taskai = $get.pts(#,$nick)
if (%taskai < $2) PRIVMSG $nick You only have %taskai points
else { Maybe someone know how to fix this, that people can't bet if they don't have points
|
|
|
|
|
|
|
|