mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2014
Posts: 2
N
Nanako Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Dec 2014
Posts: 2
I was wondering if someone could help me get started on a script for twitch that uses a bank system with money and a betting system for betting on a person or a team.

Joined: Nov 2014
Posts: 79
N
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Hi, new to scripting myself but I've done this with the help of some others in the forum. My question is, how do you want them to earn points? Are they gonna have a set amount of points from the beginning or do you want them to earn points as they join the channel?

Joined: Nov 2014
Posts: 79
N
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Oh, and here's the betting system I have.

Code:
on *:TEXT:!bet*:#: {
var %betfile bet.ini
var %wager wager.ini
 if ($2 isnum) {
  var %points $readini(points.ini,$+(#,.,$nick),dinocoins)
  var %Subtract = %points - $2
     if (%subtraction < 0) {
       msg # Sorry $nick you do not have enough points.
     }
     else {
       writeini %betfile $3 $nick 1
       writeini %wager $nick wager $2
       writeini -n points.ini $+(#,.,$nick) points          $calc($readini(points.ini,$+(#,.,$nick)points) - $2)
    }
 }
 else if ($2 = allin) {
   writeini %betfile $3 $nick 1
   writeini %wager $nick wager $readini(points.ini,$+   (#,.,$nick),points)
   writeini -n points.ini $+(#,.,$nick) points 0
 }
else if ($2 = close) {
 if ($nick !isop #) {
   msg # This command is for mods only
 }
 else {
   var %betwinners $ini(%betfile,$3,0)
   var %i 0
     while (%betwinners) {
       %i = %i + 1
       var %betwinner $ini(%betfile,$3,%betwinners)
       var %betwins %betwins %betwinner
       var %increase $readini(%wager, %betwinner, wager)
       var %realincrease %increase + %increase / %i
       writeini -n points.ini $+(#,.,%betwinner) points   $calc($readini(%betfile,$+(#,.,%betwinner),points) +   %realincrease)
       dec %betwinners
     }
  msg # The winner(s) are: %betwins 
  write -c %betfile
  write -c %wager
 }
}

Last edited by Newbie; 29/12/14 01:13 AM.
Joined: Dec 2014
Posts: 2
N
Nanako Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
N
Joined: Dec 2014
Posts: 2
They were gonna have a set amount of $400 or points when they first join the channel. And thank you for showing me your code, it is really helpful

Joined: Nov 2014
Posts: 79
N
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
So this would make it so that they gain points when joining the channel. If they already have points however they should not get any more. I would recommend you make a base value, like they can't have less than 100 points similar to the twitch plays pokemon but that's my opinion.


Code:
on !*:JOIN:#: {
  var %spoints 400
  var %balance $readini(points.ini,$+(#,.,$nick),points)
  if (%balance == 0) {
    writeini -n points.ini $+(#,.,$nick) points %spoints
  }
}

Last edited by Newbie; 29/12/14 06:37 AM.

Link Copied to Clipboard