mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2014
Posts: 20
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2014
Posts: 20
i need help with my heist system that's integrated into my points system. the problem i'm having is that i don't know how to make it add/subtract the points you win or lose depending on the outcome. here's the current code i have for it now http://pastebin.com/HEKFFeiJ

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
In the code, you have already set a $calc which reduces the points by 50 which is right here.

Code:
   %points = $calc(%points - 50)
  writeini -n Points.ini %topic Points %points
  return %points 


All you need to do is apply this to all your if statements with the proper value set.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Mar 2014
Posts: 20
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2014
Posts: 20
oh ok thank you very much. i wasnt sure if i could use that because i was getting a bracket error

Joined: Mar 2014
Posts: 20
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2014
Posts: 20
i added the code like you said but theres a problem with it not starting the timer on the if statement. heres how i have it now. http://pastebin.com/7QgYABfC

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Took a quick look at it and removed the first return %points.

Code:
 
on *:text:!heist:#: {
  var %topic $+($chan,.,$nick)
  var %points $iif($readini(Points.ini,%topic,Points) == $null,0,$v1)
  if (%points < 50) { msg $chan $nick you do not have enough points to start a heist. | return }
  %points = $calc(%points - 50)
  msg $chan $nick has started a heist and it will last 15 seconds.  $+ . Removed 50 points from $nick (Had $calc(%points + 50) points and now has %points points).
  writeini -n Points.ini %topic Points %points
  var %rng $rand(1,10)
  if (%rng == 1) { 
    /timer1 1 15 msg # $nick, the heist went well, you earned 100 points
    %points = $calc(%points + 100)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 2) { 
    /timer 1 15 msg # $nick, the heist went bad, you lost 200 points
    %points = $calc(%points - 200)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 3) { 
    /timer 1 15 msg # $nick, the heist went well, you earned 50 points
    %points = $calc(%points + 50)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 4) { 
    /timer 1 15 msg # $nick, the heist went bad, you lost 100
    %points = $calc(%points - 100)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 5) {
    /timer 1 15 msg # $nick, the heist went well, you earned 300 points
    %points = $calc(%points + 300)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 6) {
    /timer 1 15 msg # $nick, the heist went bad, you lost 300 points
    %points = $calc(%points - 300)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 7) { 
    /timer 1 15 msg # $nick, the heist went well, you earned 350 points
    %points = $calc(%points + 350)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 8) { 
    /timer 1 15 msg # $nick, the heist went bad, you lost 50 points
    %points = $calc(%points - 50)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 9) { 
    /timer 1 15 msg # $nick, the heist went well, you earned 400 points
    %points = $calc(%points + 400)
    writeini -n Points.ini %topic Points %points
    return %points
  }
  if (%rng == 10) { 
    /timer 1 15 msg # $nick, the heist went bad, you lost 400 points
    %points = $calc(%points - 400)
    writeini -n Points.ini %topic Points %points
    return %points
  }
}

Should work now.

Note: Since you initially remove 50 points, the gain will only be 50 from winning 100. (50 - 50 + 100) Also, if people have only 50 points and they lose 400, they'd result in having -400 points. (50 - 50 - 400)


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Mar 2014
Posts: 20
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2014
Posts: 20
thanks so much it works perfectly


Link Copied to Clipboard