Jeu avec des nombres.

Contenu du snippet

Hum le jeu est simple vous devez trouvez un nombres situez entre deux
autre nombre, j'ai fait un dialog avec des petite options
Il y a beaucoup d'erreur d'orthographe j'vous l'accorde
Et j'attend les commentaire pour optimiser ( c'est completement optimisable )

Source / Exemple :


dialog jeunb {
  title "Configuration"
  size -1 -1 113 99
  option dbu
  check "Activer sur le channel :", 1, 1 3 65 10
  edit "", 2, 66 4 40 10, autohs
  box "Options", 3, 0 13 113 41
  check "Voicer lorsque un user arrive a 50 points", 5, 1 21 105 10
  check "Halfop lorsque un user arrive a 100 points", 6, 1 32 108 10
  check "Op lorsque un user arrive a 200 points", 7, 1 42 105 10
  box "Couleurs", 8, 0 55 99 44
  text "Texte Principal", 9, 2 63 37 8
  text "Texte Précis", 10, 2 75 37 8
  text "Nombre max", 11, 2 88 37 8
  edit "", 12, 40 62 12 10, autohs
  edit "", 13, 40 74 12 10, autohs
  edit "", 14, 40 86 12 10, autohs
  text "Nombre min", 15, 54 63 30 8
  text "Nick winner", 16, 54 87 30 8
  text "Msg d'arret", 17, 54 75 30 8
  edit "", 18, 85 62 12 10, autohs
  edit "", 19, 85 74 12 10, autohs
  edit "", 20, 85 86 12 10, autohs
  button "OK", 21, 101 58 12 40, multi ok cancel
}

on *:load:{
  echo -a Jeu du nombre chargé
  echo -a Ouvrer le dialog pour configurer les options
  echo -a Vous devez imperativement entrer un channel ou le jeu sera inactif
}
on *:unload:{
  echo -a Jeu du nombre décharger
}

menu menubar {
  Jeux-du-Nombre
  .Configurer:{ dialog -m jeunb jeunb }
  .Unload:{ .unload -rs $shortfn($script) | /remove $shortfn($script)  }
}

on *:dialog:*:*:*:{
  if ($dname == jeunb) {
    if ($devent == init) {
      did -a $dname  2 %chanjeunb
      did -a $dname 12 %c.principal
      did -a $dname 13 %c.precis
      did -a $dname 14 %c.nbmax
      did -a $dname 18 %c.nbmin
      did -a $dname 19 %c.arret
      did -a $dname 20 %c.win
      if (%actijeunb == on) { did -c $dname 1 }
      if (%v.user == on) { did -c $dname 5 }
      if (%h.user == on) { did -c $dname 6 }
      if (%o.user == on) { did -c $dname 7 }
    }
    if ($devent == sclick) {
      if ($did == 1) { set %actijeunb $iif($did(1).state == 1,on,off) }
      if ($did == 5) { set %v.user $iif($did(5).state == 1,on,off) }
      if ($did == 6) { set %h.user $iif($did(6).state == 1,on,off) }
      if ($did == 7) { set %o.user $iif($did(7).state == 1,on,off) }
    }
    if ($devent == edit) {
      if ($did == 2) { set %chanjeunb $did(2) }
      if ($did == 12) { set %c.principal $did(12) }
      if ($did == 13) { set %c.precis $did(13) }
      if ($did == 14) { set %c.nbmax $did(14) }
      if ($did == 18) { set %c.nbmin $did(18) }
      if ($did == 19) { set %c.arret $did(19) }
      if ($did == 20) { set %c.win $did(20) }
    }
    if ($devent == close) {
      if (%actijeunb == on) {
        if (!$did(2)) { echo -a 4Erreur15 :4 Le jeu est activé mais aucun channel n'a ete rentré , le jeux est desactivé | set %actijeunb off }
        elseif (!%c.principal) || (!%c.arret) || (!%c.precis) || (!%c.win) || (!%c.nbmax) || (!%c.nbmin) { echo -a Manque des parametres de couleur le jeu est desactivé | set %actijeunb off }  
      }
    }
  }
}

on *:text:*:%chanjeunb:{
  if (%actijeunb == on) {
    if ($1- == !start) {
      if (!%c.principal) || (!%c.arret) || (!%c.precis) || (!%c.win) || (!%c.nbmax) || (!%c.nbmin) { //msg $chan Manque de parametre le jeu est annulé } 
      else {
        if (%jeunb == off) {
          set %jeunb on
          msg %chanjeunb $+($chr(3),%c.principal,Le,$chr(32),jeu,$chr(32),du,$chr(32),nombre,$chr(32),est,$chr(32),lancé,$chr(32),par,$chr(32),$chr(3),%c.precis,$nick)
          .timer 1 2 msg %chanjeunb $+($chr(3),%c.principal,Vous,$chr(32),pouvez,$chr(32),consulter,$chr(32),votre,$chr(32),scores,$chr(32),en,$chr(32),tapant,$chr(32),$chr(3),%c.precis,!scores,$chr(3),%c.principal,$chr(32),et,$chr(32),celui,$chr(32),des,$chr(32),autres,$chr(32),en,$chr(32),tapant,$chr(32),$chr(3),%c.precis,!scores,$chr(32),pseudo)
          .timer 1 4 msg %chanjeunb $+($chr(3),%c.principal,Vous,$chr(32),devez,$chr(32),trouvez,$chr(32),un,$chr(32),nombre,$chr(32),situer,$chr(32),dans,$chr(32),une,$chr(32),tranche)
          .timer 1 6 msg %chanjeunb $+($chr(3),%c.principal,Bonne,$chr(32),chance,$chr(32),a,$chr(32),tous,$chr(32),le,$chr(32),jeu,$chr(32),commence,$chr(32),dans,$chr(32),$chr(3),%c.precis,10,$chr(32),secondes)
          .timer 1 10 jeunombre
        }
      }
    }
  }
  if ($1 == !scores) {
    if (%jeunb == on) || (%jeunb1 == on) || (%jeunb2 == on) {
      if (!$2) {
        if (!$var($+(%,$nick))) { notice $nick Tu N'a Pas Encore Gagnez De Point }    
        else { notice $nick Ton Scores Est De $+($($+(%,$nick),2),$chr(32),point) }
      }
      else { 
        if (!$($+(%,$2)),2) { notice $nick $2 N'a Pas Encore Gagnez De Point }    
        else { notice $nick Le Scores De $2 Est De $+($($+(%,$nick),2),$chr(32),point) }
      }
    }
  }
  if (%jeunb1 == on) {
    if ($1 == !tranche) {
      if ($2 isnum) && ($3 isnum) {
        if ($4-) { msg %chanjeunb $+($chr(3),%c.principal,Trop,$chr(32),de,$chr(32),parametre) }
        elseif ($2 == $3) { msg %chanjeunb $+($chr(3),%c.principal,Vous,$chr(32),ne,$chr(32),pouvez,$chr(32),pas,$chr(32),choisir,$chr(32),le,$chr(32),meme,$chr(32),nombre) }
        elseif ($2 > $3) { msg %chanjeunb $+($chr(3),%c.principal,Vous,$chr(32),ne,$chr(32),pouvez,$chr(32),pas,$chr(32),definir,$chr(32),un,$chr(32),nombre,$chr(32),minimum,$chr(32),plus,$chr(32),grand,$chr(32),que,$chr(32),le,$chr(32),nombre,$chr(32),maximum,$chr(32),!) }
        else {
          set %jeunb1 off
          set %nbmax $3 
          set %nbmin $2       
          set %tranche $r($2,$3)
          echo -a nombre a trouver : %tranche , nombre max : %nbmax : nombre min : %nbmin
          .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal,La tranche,$chr(32),choisis,$chr(32),est,$chr(32),$chr(3),%c.nbmin,$2,$chr(3),15,$chr(32),$chr(45),$chr(32),$chr(3),%c.nbmax,$3,$chr(3),%c.principal,$chr(32),Vous,$chr(32),devez,$chr(32),donc,$chr(32),$chr(32),trouver,$chr(32),un,$chr(32),nombre,$chr(32),$chr(32),situer,$chr(32),entre,$chr(3),%c.nbmin,$chr(32),$2,$chr(32),$chr(3),15,$chr(32),et,$chr(3),%c.nbmax,$chr(32),$3)
          .timer 1 2 msg %chanjeunb $+($chr(3),%c.principal,Le,$chr(32),jeu,$chr(32),commence,$chr(32),dans,$chr(32),$chr(3),%c.precis,10,$chr(32),secondes) $+($chr(3),%c.principal,preparez,$chr(32),vous.)
          .timer 1 10 jeunombre1 
        }
      }
      else { msg %chanjeunb $+($chr(3),%c.principal,Choississez,$chr(32),des,$chr(32),nombres,$chr(32),espece,$chr(32),de,$chr(32),neu²) }    
    }
  }
  if (%jeunb2 == on)  {
    if ($strip($1-) isnum) {
      set %testing off
      if ($strip($1-) < %nbmin) { .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal,Dsl,$chr(32),$chr(3),%c.precis,$nick,$chr(3),%c.principal,$chr(32),mais,$chr(32),le,$chr(32),nombre,$chr(32),minimum,$chr(32)est,$chr(32),$chr(3),%c.nbmin,%nbmin) } 
      elseif ($strip($1-) > %nbmax) { .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal,Dsl,$chr(32),$chr(3),%c.precis,$nick,$chr(3),%c.principal,$chr(32),mais,$chr(32),le,$chr(32),nombre,$chr(32),maximum,$chr(32)est,$chr(32),$chr(3),%c.nbmax,%nbmax) }
      elseif ($strip($1-) < %tranche) { .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal,Dsl,$chr(32),$chr(3),%c.precis,$nick,$chr(3),%c.principal,$chr(32),Le,$chr(32),nombre,$chr(32),est,$chr(32),plus,$chr(32),grand,$chr(32),que,$chr(32),$strip($1-)) }
      elseif ($strip($1-) > %tranche) { .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal) Dsl $+($chr(3),%c.precis,$nick,$chr(3),%c.principal,$chr(32),Le,$chr(32),nombre,$chr(32),est,$chr(32),plus,$chr(32),petit,$chr(32),que,$chr(32),$strip($1-)) }         
      elseif ($strip($1-) == %tranche) { 
        .timer 1 1 msg %chanjeunb $+($chr(3),%c.principal,Bravo,$chr(32),$chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),Tu,$chr(32),as,$chr(32),trouvé,$chr(32),le,$chr(32),bon,$chr(32),chiffre,$chr(32),$chr(3),15,$chr(58),$chr(32),$chr(3),%c.precis,%tranche)
        .timer 1 2 msg %chanjeunb $+($chr(3),%c.principal,Le,$chr(32),jeu,$chr(32),est,$chr(32),terminé,$chr(32),tapez,$chr(32),$chr(3),%c.precis,!start,$chr(3),%c.principal,$chr(32),Pour,$chr(32),jouez,$chr(32),de,$chr(32),nouveau.)
        set %jeunb off 
        set %jeunb1 off
        set %jeunb2 off 
        unset %nbmax %tranche %nbmin 
        if (!$($+(%,$nick),2)) { set % $+ $nick 0 | inc % $+ $nick }
        else { inc % $+ $nick }
        if ($($+(%,$nick),2) < 50) { echo -a - de 50 | .timer 1 3 msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(32),$chr(3),%c.principal,a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(32),$chr(3),%c.principal,points) }
        elseif (%v.user == on) {
          if ($($+(%,$nick),2) >= 50) {
            if ($me isop $chan) {
              if ($nick !isvo %chanjeunb) { echo -a + de 50 non voice | .timer 1 3 mode %chanjeunb +v $nick | msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(3),%c.principal,$chr(32),points) }
              else { echo -a + de 50 voicé | .timer 1 3 msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(3),%c.principal,$chr(32),points) }
            }
            else { halt }
          }
        }
        elseif (%h.user == on) {
          if ($($+(%,$nick),2) >= 100) {
            if ($me isop $chan) {
              if ($nick !ishelp %chanjeunb) { .timer 1 3 mode %chanjeunb +h $nick | msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(3),%c.principal,$chr(32),points) }
              else { .timer 1 3 msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),a,$chr(32),$+($chr(3),%c.precis),$($+(%,$nick),2),$chr(3),%c.principal,$chr(32),points) }
            }
            else { echo -a test }
          }
        }
        elseif (%o.user == on) {
          if ($($+(%,$nick),2) >= 200) {
            if ($me isop %chanjeunb) {
              if ($nick !isop %chanjeunb) { .timer 1 3 /mode %chanjeunb +o $nick | msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal,$chr(32),a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(3),%c.principal,$chr(32),points) } 
              else { .timer 1 3 msg %chanjeunb $+($chr(3),%c.win,$nick,$chr(3),%c.principal),$chr(32),a,$chr(32),$chr(3),%c.precis,$($+(%,$nick),2),$chr(3),%c.principal,point.) }
            }
            else { halt }
          }
        }
        else { msg %chanjeunb $+($chr(3),%c.win) $nick $+($chr(3),%c.principal) a $+($chr(3),%c.precis) $($+(%,$nick),2) $+($chr(3),%c.principal) points } 
      }
    }
  }   
}

alias jeunombre {
  msg %chanjeunb $+($chr(3),%c.principal,Choississez,$chr(32),une,$chr(32),$chr(3),%c.precis,$chr(31),tranche,$chr(32),de,$chr(32),nombre,$chr(31)) $+($chr(3),%c.principal,en,$chr(32),faisant) $+($chr(3),%c.precis,$chr(31),!tranche,$chr(32),1er,$chr(32),2eme,$chr(31))
  set %jeunb1 on
  .timer 1 30 finjeunb
}

alias jeunombre1 {
  msg %chanjeunb $+($chr(3),%c.principal,C'est,$chr(32),partis,$chr(32),j'attend,$chr(32),vos,$chr(32),proposition,$chr(32),!)
  set %jeunb2 on
  set %testing on 
}
alias finjeunb {
  if (%jeunb1 == on) { 
    set %jeunb off
    msg %chanjeunb $+($chr(3),%c.arret) Pas de tranche definis, le jeu est arreter
  }
  elseif (%testing == on) {
    set %jeunb off
    set %jeunb1 off
    unset %tranche
    unset %nbmax
    unset %nbmin
    msg %chanjeunb $+($chr(3),%c.arret) Pas de proposition le jeu est arrété
  }
}
alias stopjeunb {
  set %jeunb off
  set %jeunb1 off
  set %jeunb2 off
  unset %nbmax
  unset %nbmin
  unset %tranche
  msg $chan $+($chr(3),%c.arret) jeu momentanement interompu
}

Conclusion :


Pour les couleur vous devez juste rentré le n° de la couleur avec le 0 si c'est un nombre inferieur a 10 par exemple:
04 et non 4

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.