mIRC Home    About    Download    Register    News    Help

Print Thread
#251675 27/02/15 01:14 AM
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
So I am working on a basic bet system as you may have figured if you look at my previous posts, whiles't testing I ran accros a problem.

Here is the code :
Click to reveal..
Code:
on *:TEXT:!bet *:#: {
  set %rand $rand(1,6)
  var %cash $readini(rxcoin.ini,%user,coins)
  var %spend $2
  var %calc calc(%spend * 4)
  var %user $nick
  if (%cash == 0) { 
    msg $chan sorry $nick you have no credits to bet on!
    halt
  }
  $rand(1,6)
  if (%rand == 1) {
    msg $chan number one has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 2) { 
    msg $chan number two has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 3) { 
    msg $chan number three has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 4) { 
    msg $chan number four has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 5) { 
    msg $chan number five has been called, you lose your points!
    set %money.withdraw $calc($readini(rxcoin.ini,$nick,coins) - $2)
    writeini -n rxcoin.ini $nick coins %money.withdraw
    unset %money.withdraw
  }
  elseif (%rand == 6) { 
    msg $chan number six has been called, you win %calc credits!
    set %money.add calc($readini(rxcoin.ini,$nick,coins) + %calc)
    writeini -n rxcoin.ini $nick coins %money.add
    unset %money.add
  }
}


Here's is the problem, It removes the points if you lose, but if you win it put's this into the ini file
Click to reveal..

[michaelukz]
coins=calc($readini(rxcoin.ini,$nick,coins) +


Anyone know why this is happening?

michaelukz #251677 27/02/15 02:04 AM
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
You probably realized by now, but you wrote calc( ) instead of $calc( )

Sakana #251681 27/02/15 06:39 AM
Joined: Dec 2014
Posts: 68
M
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2014
Posts: 68
I honestly, didn't even think to check for that mistake -- ironically -- I had that issue earlier haha.


Link Copied to Clipboard