Best and rating script

By slub77 on Jan 30, 2010

Ok so i have started playing around with Dialogs, and have edited a script to work with it.

This is for people who are bored and wana mess about, it works by either rating someone, or Saying who is best at something.

The dialog shows you information regarding what has been saved aka:

Best tab
list:best for _____
boxes: who is, and how many times someone has asked
Change button

rate tab
list:rating for _____
boxes: rating for that person
Change button

[u]COMMANDS[u/]
Sbest = Asks who is best at what, and shows also how many times it has been asked
Srate = Rates someone stays the same unless changed

[u]How to Install[u/]

Copy the code in to remotes:

ON A NEW PAGE!

Edit
Added a + button so that you can add things

menu * {
  Srate & Sbest Script:/dialog -ma s9 s9
}

dialog S9 {
  title S9 Dialog

  size -1 -1 208 112

  option dbu

  tab "The best", 1, 5 5 200 100
  tab "Rate", 2

  list 4, 9 25 90 80, tab 1
  edit , 5, 105 27 80 10, disable, tab 1, center
  edit , 6, 105 40 80 10, tab 1, disable, center
  button Change, 8, 105 55 40 10, tab 1
  button Delete, 9, 148 55 40 10, tab 1
  edit New meaning, 10, 105 65 85 10, tab 1, center
  button Change, 11, 105 75 85 10, tab 1

  list 12, 9 25 90 80, tab 2
  edit , 13, 105 27 80 10, disable, tab 2, center
  button Change, 15, 105 55 40 10, tab 2
  button Delete, 16, 148 55 40 10, tab 2
  edit New rateing, 17, 105 65 85 15, tab 2, center, autohs
  button Change, 18, 105 80 85 10, tab 2
  button +, 19, 187 27 10 10, tab 1
  button +, 20, 187 27 10 10, tab 2
  button Shout out, 21, 105 90 85 15, tab 2
  button Shout out, 22, 105 90 85 15, tab 1

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on 1:DIALOG:s9:init:*:{
  did -h $dname 10,11,17,18,
  set %d $calc($ini(rate.ini,rate,0) + 1)
  set %f 1
  set %g 1

  :next
  if %g == %d { goto sec }
  else {
    did -i $dname 12 %f { $ini(rate.ini,rate,%f) | inc %g | inc %f | goto next }
  }

  :sec
  set %a $calc($ini(best.ini,rate,0) + 1)
  set %b 1
  set %c 1

  :loop
  if %c == %a { halt }
  else {
    did -i $dname 4 %b { $ini(best.ini,rate,%b) | inc %c | inc %b | goto loop }
  }

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on 1:DIALOG:s9:Sclick:21:{
  if !$did(12).seltext { did -o $dname 13 1 You must select an item }
  else { 
    msg %channel $did(12).seltext Rating is: $readini(rate.ini, rate, $did(12).seltext)
  }
}
on 1:DIALOG:s9:Sclick:22:{
  if !$did(4).seltext { did -o $dname 5 1 You must select an item | did -o $dname 6 1 <<<<<<<<<<<<<<<<<< }
  else { 
    msg %channel $readini(best.ini, rate, $did(4).seltext) is the best at : $did(4).seltext  
  }
}

on 1:DIALOG:s9:Sclick:4:{
  if !$did(4).seltext { did -o $dname 5 1 You can't delete nothing | did -o $dname 6 1 <<select an item }
  else {
    if $readini(best.ini, rate, $did(4).seltext) { 
      did -o $dname 5 1 $readini(best.ini, rate, $did(4).seltext )
    did -o $dname 6 1 Asked $readini(best.ini, number, $did(4).seltext ) Time(s) }
    else {
      did -o $dname 5 1 You have deleted This 
      did -o $dname 6 1 -=-=-=-=-=-=-=-=-=-=-
    }
  }
}

on 1:DIALOG:s9:Sclick:9:{
  if !$did(4).seltext { did -o $dname 5 1 You can't delete nothing | did -o $dname 6 1 <<select an item }
  else {
    remini best.ini rate $did(4).seltext
    remini best.ini number $did(4).seltext 
    did -o $dname 5 1 Deleted $did(4).seltext
    did -o $dname 6 1 -=-=-=-=-=-=-=-=-=-=-

  }
}
on 1:DIALOG:s9:Sclick:8:{
  if !$did(4).seltext { did -o $dname 5 1 You can't change nothing | did -o $dname 6 1 <<select an item }
  else { did -v $dname 10,11 }
}
on 1:DIALOG:s9:Sclick:11:{
  if $did(10).text == New meaning { halt } 
  else { 
    writeini best.ini rate $did(4).seltext $did(10).text
    did -o $dname 5 1 Changed $did(4).seltext
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on 1:DIALOG:s9:Sclick:12:{
  if !$did(12).seltext { did -o $dname 13 1 You can't delete nothing }
  else {
    if $readini(rate.ini, rate, $did(12).seltext) { 
    did -o $dname 13 1 $readini(rate.ini, rate, $did(12).seltext ) }
    else {
      did -o $dname 13  1 You have deleted This 
    }
  }
}

on 1:DIALOG:s9:Sclick:16:{
  if !$did(12).seltext { did -o $dname 13 1 You can't delete nothing }
  else {
    remini rate.ini rate $did(12).seltext
    did -o $dname 13  1 Deleted $did(12).seltext

  }
}

on 1:DIALOG:s9:Sclick:15:{
  if !$did(12).seltext { did -o $dname 13 1 You can't delete nothing | did -o $dname 13 1 <<select an item } 
  else { did -v $dname 17,18 }
}
on 1:DIALOG:s9:Sclick:18:{
  if $did(17).text == New Rateing { halt }
  if $did(17).text  isnum -1-11 {
    writeini rate.ini rate $did(12).seltext $did(17).text
    did -o $dname 13  1 Changed $did(12).seltext
  }

  else { 
    did -o $dname 17 1 New rating must be between 0 and 10, and also must be a number 
  }

}

on 1:DIALOG:s9:sclick:19:{
  var %a $?="Enter new item"
  if $readini(best.ini, rate, %a) { did -o $dname 5 1 Word is all ready in the list. }
  else {
    writeini best.ini rate %a $?="Who is the best at %a "
    did -o $dname 5 1 Added $!
  }
}
on 1:DIALOG:s9:sclick:20:{
  var %a $?="Enter new item"
  if $readini(rate.ini, rate, %a) { did -o $dname 13 1 %a has all ready been rated  }
  else {
    var %b $?="Who is the best at %a "
    if %b isnum -1-11 {
      writeini rate.ini rate %a %b
      did -o $dname 13 1 Added %a
    }
    else { did -o $dname 13 1 Sorry invaild number }
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:TEXT:Sbest*&:*:{
  if !$2 { notice $nick Best at? }
  if $2 ison $chan { msg $chan Well $2 aint that bad at being them self. }
  else {
    if !$readini(best.ini, rate, $2) {
      var %best $nick($chan,$rand(1,$nick($chan,0)))
      writeini best.ini rate $2 %best

      if !$readini(best.ini, number, $2) {
        writeini best.ini number $2 1
      }
      else {
        var %totalnumber $readini(best.ini, number, $2) Asked: $readini(best.ini, number, $2) Times.
        inc %totalnumber 
        writeini best.ini number $2 %totalnumber
      }

      Msg $chan The person who is best at $2 Is %best

    }
    else {
      if !$readini(best.ini, number, $2) {
        writeini best.ini number $2 1
      }
      else {
        var %totalnumber $readini(best.ini, number, $2)
        inc %totalnumber 
        writeini best.ini number $2 %totalnumber
      }

    msg $chan The person who is best at $2 Is $readini(best.ini, rate, $2) : Asked: $readini(best.ini, number, $2) Times  }
  }
}

on *:TEXT:Srate*:*:{
  if !$2 { notice $nick Rate what? }
  else {
    if !$readini(rate.ini,rate, $2) {
      var %rate $rand(0,10)
      writeini rate.ini rate $2 %rate

      if !$readini(rate.ini, number, $2) {
        writeini rate.ini number $2 1
      }
      else {
        var %totalnumber $readini(rate.ini, number, $2)
        inc %totalnumber 
        writeini rate.ini number $2 %totalnumber
      }

      Msg $chan The most up to date rating of $2- is %rate out of 10 : Asked: $readini(rate.ini, number, $2) Times.

    }
    else {
      if !$readini(rate.ini, number, $2) {
        writeini rate.ini number $2 1
      }
      else {
        var %totalnumber $readini(rate.ini, number, $2)
        inc %totalnumber 
        writeini rate.ini number $2 %totalnumber
      }

    msg $chan The most up to date rating of $2 is $readini(rate.ini, rate, $2) out of 10 : Asked: $readini(rate.ini, number, $2) Times. }
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.