mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2014
Posts: 49
JB_uk Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
Anybody able to help with this problem?
This script randomises the symbols to work like a slot or scratchcard. However it costs 1 gold to buy.
The script will not execute any of the if statements or else if sections if they are true. However if none of them are true it will execute the else section perfectly. Any ideas appreciated.
Code:
on *:TEXT:!scratch:#:{

  var %symbol.0 Kappa
  var %symbol.1 shazamicon
  var %symbol.2 BrainSlug
  var %symbol.3 ItsBoshyTime
  var %topic $+($chan,.,$nick)
  var %goldies $readini(Gold.ini,$+(#,.,$nick),Gold)
  var %ngoldies $calc(%goldies - 1)
  var %topic1 $+($chan,.,$nick)
  var %againgoldies1 $readini(Gold.ini,%topic1,Gold)
  var %wingoldies1 $calc(%againgoldies1 + 68)
  var %topic2 $+($chan,.,$nick)
  var %againgoldies2 $readini(Gold.ini,%topic2,Gold)
  var %wingoldies2 $calc(%againgoldies2 + 29)
  var %topic2 $+($chan,.,$nick)
  var %againgoldies2 $readini(Gold.ini,%topic2,Gold)
  var %wingoldies2 $calc(%againgoldies2 + 29)

  msg # $nick spent 1 Gold.
  var %slot1 %symbol. [ $+ [ $rand(0,3) ] ]
  var %slot2 %symbol. [ $+ [ $rand(0,3) ] ]
  var %slot3 %symbol. [ $+ [ $rand(0,3) ] ]
  .timer.s 1 2 msg # %slot1 %slot2 %slot3
  if (%slot1 == Kappa) && (%slot2 == Kappa) && (%slot3 == Kappa) {
    var %topic1 $+($chan,.,$nick)
    var %againgoldies1 $readini(Gold.ini,%topic1,Gold)
    var %wingoldies1 $calc(%againgoldies1 + 68)

    writeini -n Gold.ini %topic1 Gold %winngoldies1

    .timer.Kappawin 1 4 msg # $nick won the jackpot Kappa
    .timer.Kappawin1 1 6 msg # $nick won 69 Gold! Kappa

    return
  }
  elseif (%slot1 == %slot2) && (%slot1 == %slot3) {
    var %topic2 $+($chan,.,$nick)
    var %againgoldies2 $readini(Gold.ini,%topic2,Gold)
    var %wingoldies2 $calc(%againgoldies2 + 29)

    writeini -n Gold.ini %topic2 Gold %winngoldies2

    .timer.wiener 1 4 msg # We have an wiener %slot1
    .timer.wiener1 1 6 msg # $nick won 30 points!

    return
  }
  elseif (%slot1 == %slot2) || (%slot1 == %slot3) || (%slot2 == %slot3) {
    var %topic3 $+($chan,.,$nick)
    var %againgoldies3 $readini(Gold.ini,%topic3,Gold)
    var %wingoldies3 $calc(%againgoldies3 + 5)

    writeini -n Gold.ini %topic Gold %winngoldies3

    .timer.2of3 1 4 msg # You were so close $nick $+ . You won 5 Gold.

    return
  }
  else {   
    var %topic $+($chan,.,$nick)
    var %goldies $readini(Gold.ini,$+(#,.,$nick),Gold)
    var %ngoldies $calc(%goldies - 1)

    writeini -n Gold.ini %topic Gold %ngoldies
    return
  }
}

Joined: Jan 2004
Posts: 1,352
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,352
On lines 30, 42, and 54 you have a typo in your variables %winngoldies1/2/3.

You will have errors in your status window telling you the line number: * /writeini: insufficient parameters

Joined: Oct 2014
Posts: 49
JB_uk Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
Noticed that now, such a stupid little mistake, I tried making it do $error but it didn't display. Cheers for that simple "fix".


Link Copied to Clipboard