Bomb Dialog

By DarkCoder on Dec 05, 2009

A very simple bomb game, You can either type /bomb or right click anything and hit the Bomb Game button, You click the "Defuse Bomb" Button and then you pick a colour and cut the wire, The score shows your score, if you just start, it shows 0.

[size=20]First Script, postive comments please![/size]

Dialog Bomb {
  title "Bomb Dialog"
  option dbu
  size -l -l 120 120
  List 1, 3 15 113 14
  button "Defuse Bomb", 2, 2 35 36 24, 
  button "Cut Wire", 7, 74 35 36 24,
  button "Score", 8, 38 35 36 24,
  button "Pick Red", 3, 2 90 36 24, 
  button "Pick Blue", 4, 38 90 36 24, 
  button "Pick Black", 5, 74 90 36 24, 
  text "Bomb Activity" 6, 38 1 96 14, cancel
}
on *:dialog:Bomb:init:*: {
  did -ra $dname 1 Click Defuse Bomb Button To Start
}
alias bombme {
  var %x $rand(30,60)
  set %bomb Active
  did -ra Bomb 1 You have %x seconds to defuse the bomb!
  .timer 1 2 .timerBombDisplay 0 1 BombDisplay
  .timerBomb 1 %x BombEnd
}
Alias bombdisplay did -ra Bomb 1 $timer(bomb).secs Seconds Left To Defuse the bomb!
alias bombend {
  did -ra Bomb 1 Explosion! You didnt defuse the bomb in time!
  .timerbombdisplay off
unset %bom*
inc %scorel
}
Alias BombScore did -ra Bomb 1 Bombs Defused - $iif(%scorew,$v1,0) - Bombs Exploded - $iif(%scorel,$v1,0)
on *:dialog:bomb:sclick:*: {
  if ($did == 2) Bombme
  if ($did == 3) BombP Red
  if ($did == 4) BombP Blue
  if ($did == 5) BombP Black
  if ($did == 8) BombScore
  if ($did == 7) {
    if (%colour) Cut %colour
    else display You have not selected a colour yet!
  }
}
alias cut {
  set %Bomb.ColourT $rand(1,3)
  .timerbomb* off
  if (%colour == %bomb.ColourT) {
    did -ra bomb 1 You have defused the bomb!
    .timer 1 1 bombwin
  }
  else Bomblost
}
alias bombwin {
  inc %ScoreW
  did -ra Bomb 1 You have defused %scorew bombs!
  .timerbombdisplay off
  unset %bom*
  unset %colour
}
Alias bomblost {
  did -ra Bomb 1 !!!!!!!!!Explosion!!!!!!!!!!
  .timer 1 2 did -ra Bomb 1 The actual colour was $bombp(%Bomb.ColourT)
  unset %bom*
  unset %colour
  .timerbombdisplay off
  inc %ScoreL
}
alias display noop $tip(Bomb,Bomb Event,$1-,9)
Alias Bombp {
  if ($1 == 1) return Red
  if ($1 == 2) return Blue
  if ($1 == 3) return Black
  if ($1 == red) { 
    if (%bomb) {
      set %colour 1
      display You have picked the colour Red!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == blue) {
    if (%bomb) {
      set %colour 2
      display You have picked the colour Blue!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == black) {
    if (%bomb) {
      set %colour 3
      display You have picked the colour Black!
    }
    else did -ra bomb 1 You have not turned on the bomb yet!
  }
}
alias bomb dialog -mo bomb bomb
menu * {
  -
  Bomb Game:Bomb
  -
}

Comments

Sign in to comment.
sunslayer   -  Dec 06, 2009

VinX there are already bot versions
http://www.hawkee.com/snippet/6273/ is one

 Respond  
VinX   -  Dec 06, 2009

can this be coded for a bot pls ?

 Respond  
SnoooP   -  Dec 06, 2009

LOL

 Respond  
sunslayer   -  Dec 06, 2009

@SnoooP,Ghost-writer comments to troll i wouldn't consider anything he says to be readworthy as generally he doesnt even know wtf he talkin bout either

gets a 4 imo, its been done before you just put it in a dialog, WOW?Ghost-writer's Bomb snippet
i find it lulzworthy u can say that when he made a dialog version that is shorter then your text event version, but atleast you didnt "bracket abuse it", o wait...

 Respond  
SnoooP   -  Dec 06, 2009
if (%bomb) {
      set %colour 1
      display You have picked the colour Red!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == blue) {
    if (%bomb) {
      set %colour 2
      display You have picked the colour Blue!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == black) {
    if (%bomb) {
      set %colour 3
      display You have picked the colour Black!
    }

Is far easier to read than

if (%bomb) { set %colour 1 | display You have picked the colour Red!  } 
else did -ra Bomb 1 You have not turned on the bomb yet!  }
if ($1 == blue) {  if (%bomb) {       set %colour 2 |  display You have picked the colour Blue!   }
else did -ra Bomb 1 You have not turned on the bomb yet! }
if ($1 == black) {    if (%bomb) {      set %colour 3 | display You have picked the colour Black!  } }  

So it isn't really bracket abuse, it is just for ease of reading. and scripts run faster with brackets -_-

 Respond  
Ghost-writer   -  Dec 06, 2009

gets a 4 imo, its been done before you just put it in a dialog, WOW?


if (%bomb) {
      set %colour 1
      display You have picked the colour Red!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == blue) {
    if (%bomb) {
      set %colour 2
      display You have picked the colour Blue!
    }
    else did -ra Bomb 1 You have not turned on the bomb yet!
  }
  if ($1 == black) {
    if (%bomb) {
      set %colour 3
      display You have picked the colour Black!
    }

This could be like 9 less lines and you dont need such bracket abuse.

 Respond  
#Warizardworks   -  Dec 05, 2009

Cool game, nicely scripted, and lots of fun! Good job. :D
~ Wariopower

 Respond  
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.