mIRC Home    About    Download    Register    News    Help

Print Thread
Assistance needed with error in script. #257503 16/04/16 02:22 AM
Joined: Oct 2014
Posts: 49
JB_uk Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
Hi all, I've had thsi script running for a while all fine but I wanted to upgrade it so I could track how each user is getting gold in the chat alongside being able to display stats in the chat when required such as
Quote:
"Users have gambled 894 Gold"

meaning they have collectively used !scratch 894 times

Is anyone able to see why this will not work anymore, I know it may be a longwinded way of doing this, but if it could be pointed out where I'm going wrong that'd be great so I'd learn for future. It seems to be with the new writeini's I have inserted.

Code:
on *:TEXT:!scratch:#:{ 
  if ($($+(%,hacks.,$nick),3)) {
    msg # Your account has been temporarily locked $nick $+ .
    return   
  } 
  if ((%floodscratch) || ($($+(%,floodscratch.,$nick),3))) { return }
  set -u45 %floodscratch. $+ $nick On
  set -u7 %floodscratch
  if ($readini(NewGold.ini,$+(#,.,$nick),Total) == $null) { msg # You do not currently have any gold to spend $nick $+ . | return }
  if ($readini(NewGold.ini,$+(#,.,$nick),Total) == 0) { msg # You do not currently have any gold to spend $nick $+ . | return }

  elseif ($readini(NewGold.ini,$+(#,.,$nick),Total) != $null) {

    var %symbol.0 Kappa
    var %symbol.1 duDudu
    var %symbol.2 PeteZarollTie
    var %symbol.3 StinkyCheese
    var %symbol.4 Keepo
    var %symbol.5 deIlluminati
    var %symbol.6 BCouch
    var %symbol.7 VaultBoy
    var %symbol.8 OhMyDog
    var %symbol.9 CorgiDerp

    var %topic $+($chan,.,$nick)
    var %goldies $readini(NewGold.ini,$+(#,.,$nick),Total)
    var %ngoldies $calc(%goldies - 1)

    var %goldiesGAM $readini(NewGold.ini,$+(#,.,$nick),Gambled)
    var %ngoldiesGAM $calc(%goldiesGAM + 1)
    var %goldiesT $readini(NewGold.ini,$+(#,.,TOTAL),Gambled)
    var %ngoldiesTOTALS $calc(%goldiesT + 1)
    var %topic1 $+($chan,.,$nick)
    var %topicT $+($chan,.,TOTAL)

    writeini -n NewGold.ini %topic1 %ngoldiesGAM
    writeini -n NewGold.ini %topicT %ngoldiesTOTALS


    msg # $nick spent 1 Gold.


    var %slot1 %symbol. [ $+ [ $rand(0,6) ] ]
    var %slot2 %symbol. [ $+ [ $rand(0,6) ] ]
    var %slot3 %symbol. [ $+ [ $rand(0,6) ] ]
    .timer.s 1 2 msg # %slot1 %slot2 %slot3
    if (%slot1 == Kappa) && (%slot2 == Kappa) && (%slot3 == Kappa) {
      var %topic1 $+($chan,.,$nick)
      var %againgoldies1 $readini(NewGold.ini,%topic1,Total)
      var %wingoldies1 $calc(%againgoldies1 + 68)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + 69)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + 69)

      writeini -n NewGold.ini %topic1 Total %wingoldies1
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T

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

      return
    }
    elseif (%slot1 == deIlluminati) && (%slot2 == deIlluminati) && (%slot3 == deIlluminati) {
      var %topic1 $+($chan,.,$nick)
      var %againgoldies1 $readini(NewGold.ini,%topic1,Total)
      var %wingoldies1 $calc(%againgoldies1 + 99)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + 100)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + 100)

      writeini -n NewGold.ini %topic1 Total %wingoldies1
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T

      .timer.Kappawin 1 4 msg # Illuminati Confirmed
      .timer.Kappawin1 1 6 msg # $nick won 100 BitGold

      return
    }
    elseif (%slot1 == duDudu) && (%slot2 == duDudu) && (%slot3 == duDudu) {
      var %topic1 $+($chan,.,$nick)
      var %againgoldies1 $readini(NewGold.ini,%topic1,Total)
      var %numb $rand(49,220)
      var %wingoldies1 $calc(%againgoldies1 + %numb)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + %numb + 1)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + %numb + 1)

      writeini -n NewGold.ini %topic1 Total %wingoldies1
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T
      write darude_wins.txt $nick won %numb on $date $time

      .timer.duwin 1 4 msg # COVER YOUR EYES
      .timer.duwin1 1 6 msg # There's a Sandstorm inbound!
      .timer.duwin2 1 8 msg # du du du du du du
      .timer.duwin3 1 10 msg # du du du du du du
      .timer.duwin4 1 12 msg # du du du du du du du du du du du du du du du du du du du du
      .timer.duwin5 1 14 msg # duDudu duDudu duDudu 
      .timer.duwin6 1 16 msg # /me Sandstorm Over
      .timer.duwin7 1 18 msg # $nick won an undisclosed amount

      return
    }
    elseif (%slot1 == VaultBoy) && (%slot2 == VaultBoy) && (%slot3 == VaultBoy) {
      var %topic1 $+($chan,.,$nick)
      var %againgoldies1 $readini(NewGold.ini,%topic1,Total)
      var %wingoldies1 $calc(%againgoldies1 + 110)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + 111)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + 111)

      writeini -n NewGold.ini %topic1 Total %wingoldies1
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T

      .timer.Kappavwin 1 4 msg # You have returned to the Vault
      .timer.Kappavwin1 1 6 msg # $nick found 111 Gold

      return
    }

    elseif (%slot1 == %slot2) && (%slot1 == %slot3) {
      var %topic2 $+($chan,.,$nick)
      var %againgoldies2 $readini(NewGold.ini,%topic2,Gold)
      var %wingoldies2 $calc(%againgoldies2 + 29)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + 30)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + 30)

      writeini -n NewGold.ini %topic2 Total %wingoldies2
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T

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

      return
    }
    elseif (%slot1 == %slot2) || (%slot1 == %slot3) || (%slot2 == %slot3) {
      var %topic3 $+($chan,.,$nick)
      var %againgoldies3 $readini(Gold.ini,%topic3,Gold)
      var %wingoldies3 $calc(%againgoldies3 + 0)
      var %againgoldies1U $readini(NewGold.ini,%topic1,Won)
      var %wingoldies1U $calc(%againgoldies1U + 1)
      var %topicT $+($chan,.,TOTAL)
      var %againgoldies1T $readini(NewGold.ini,%topicT,Won)
      var %wingoldies1T $calc(%againgoldies1T + 1)

      writeini -n NewGold.ini %topic Total %wingoldies3
      writeini -n NewGold.ini %topic1 Won %wingoldies1U
      writeini -n NewGold.ini %topicT Won %wingoldies1T

      var %lineforscratch $rand(1,$lines(randomforit.txt))

      .timer.2of3 1 4 msg # $read(randomforit.txt,%lineforscratch)

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


      writeini -n NewGold.ini %topic Total %ngoldies
      return
    }
  }
}



Help appreciated.

Re: Assistance needed with error in script. [Re: JB_uk] #257507 16/04/16 11:17 AM
Joined: Oct 2014
Posts: 49
JB_uk Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2014
Posts: 49
This thread can now be ignored, it was a simple error of not specifying the section I wanted the script to write in the ini file as per Help:
Code:
writeini -n <inifile> <section> <item> <value>