Another Missile Script :P

By cantseeme on Sep 01, 2007

delete plz

;######-Load-######

on *:LOAD:{
  if (%fails == $null) {
    .set %fails 0
  }
  if (%success == $null) {
    .set %success 0
  }
  if (%launched == $null) {
    .set %launched No
  }
}

;######-Text Commands-######

on *:TEXT:!initiate*:#:{
  if (%launched == No) {
    .set %launched Yes
    .randomcode
    .set %launch.code %1 $+ %2 $+ %3 $+ %4 $+ %5 $+ %hy1 $+ %11 $+ %12 $+ %hy2 $+ %6 $+ %7 $+ %8 $+ %9 $+ %10
    .set %targeted No
    .set %launch.user $nick
    .set %launch.chan $chan
    .set %launch.entered No
    .msg %launch.chan Please enter the launch-code.
    .msg %launch.user The launch-code is:  %launch.code 
    .msg %launch.chan Awaiting the code...
    .close -m %launch.user
    halt
  }
  if (%launched == Yes) {
    .msg %launch.chan Error: There is already a launch started.
  }
}

on *:TEXT:!launch*:#:{
  if (%launch.entered == Yes) && (%targeted == Yes) {
    .timer 1 4 msg %launch.chan Launching the missile...
    .missile
    halt
  }
  if (%launch.entered == No) && (%targeted == No) {
    .msg %launch.chan Error: Missile cannot be fired. 
    .msg %launch.chan 2 Reasons found.
    .msg %launch.chan 1 out of 2: Launch-code wasn't entered correctly.
    .msg %launch.chan 2 out of 2: A target hasn't been selected.
    halt
  }
  if (%launch.entered == No) {
    .msg %launch.chan Error: Missile cannot be fired. 
    .msg %launch.chan Reason: Launch-code wasn't entered correctly.
    halt
  }
  if (%targeted == No) {
    .msg %launch.chan Error: Missile cannot be fired. 
    .msg %launch.chan Reason: A target hasn't been selected.
    halt
  }
}

on *:TEXT:!target*:#: {
  if (%targeted = No) {
    .set %target.chan $2
    .msg %launch.chan Target acquired.
    .set %targeted Yes
    .msg %launch.chan Awaiting permission to launch...
    halt
  }
  if (%targeted = Yes) {
    .msg %launch.chan Error: There is already a selected target.
  }
}

on *:TEXT:!mhelp*:#: {
  .msg $nick To acquire the launch-codes, type: !initiate.
  .msg $nick To enter the launch-code, private message $me with the code and ONLY the code.
  .msg $nick To select a target, type: !target <target here>
  .msg $nick To abort, type: !abort.
  .msg $nick To launch the missile, make sure you have entered the code, and selected a target and type: !launch.
  .close -m $nick
}

on *:TEXT:!abort*:#: {
  if ($nick == %launch.user) {
    .set %opt.chan $chan
    .unset %launch.code
    .unset %launch.chan
    .set %launched No
    .unset %launch.user
    .unset %target.chan
    .msg %opt.chan Mission aborted by user.
    halt
  }
  if ($nick != %launch.user) {
    .msg $chan Error: You do not have permission to do that $nick $+ .
    halt
  }
}

on *:TEXT:!mstats*:#: {
  .msg $chan --Missle Stats--
  .msg $chan ------------------
  .msg $chan Fails: %fails
  .msg $chan Successes: %success
  .msg $chan ------------------
}

;######-Query-######

on *:open:?:{
  if ($nick == %launch.user) && ($1 == %launch.code) {
    .msg %launch.chan Launch-code has been entered. Awaiting target setup...
    .msg %launch.user Code Accepted
    .set %launch.entered Yes
    .close -m $nick
    halt
  }
  if ($nick == %launch.user) && ($1 != %launch.code) {
    .msg %launch.user Error: Incorrect Code. Please enter the correct launch-code. You should have received a message with the latest code.
    .close -m $nick
    halt
  }
  if ($nick != %launch.user) {
    .msg $nick Error: [Message Blocked] Access Denied.
    .close -m $nick
    halt
  }
  if (%launch.code == $null) {
    .msg $nick Error: A launching sequence has not been initiated. There is no valid launch-code.
    .close -m $nick
    halt
  }
}

;######-Aliases-######

alias randomcode { 
  .set %1 $rand(A,Z)
  .set %2 $rand(1,9)
  .set %3 $rand(A,Z)
  .set %4 $rand(A,Z)
  .set %5 $rand(1,9)
  .set %hy1 -
  .set %11 $rand(A,Z)
  .set %12 $rand(1,9)
  .set %hy2 -
  .set %6 $rand(1,9)
  .set %7 $rand(A,Z)
  .set %8 $rand(1,9)
  .set %9 $rand(A,Z)
  .set %10 $rand(A,Z)
}

alias missile {
  .timer 1 2 .describe %launch.chan deploys a nuclear missile from one of its' many missile silos.
  .timer 1 4 .msg %launch.chan The warhead has been aimed at the selected target:  %target.chan 
  .timer 1 6 .impact.rand
  halt
}

alias impact.rand {
  .set %launch.impact $rand(1,2)
  if (%launch.impact == 1) {
    .timer 1 6 .msg %launch.chan Enemy defender missiles have destroyed our missile.
    .timer 1 8 .mreset
    inc %fails
    halt
  }
  if (%launch.impact == 2) {
    .timer 1 6 .msg %launch.chan Impact.
    .timer 1 6 .msg %launch.chan Target destroyed.   
    .timer 1 8 .mreset
    inc %success
    halt
  }
}

alias mreset {
  .unset %launch.code
  .unset %launch.chan
  .set %launched No
  .unset %launch.user
  .set %launch.entered No
  .unset %target.chan
  .msg $chan Systems reset.
}

alias codetest {
  .randomcode
  .echo -a  %1 $+ %2 $+ %3 $+ %4 $+ %5 $+ %hy1 $+ %11 $+ %12 $+ %hy2 $+ %6 $+ %7 $+ %8 $+ %9 $+ %10 
}

;######-Menu-######

menu channel,menubar {
  Missile Projection
  .Abort Active: {
    /unset %launch.code
    /unset %launch.chan
    /set %launched No
    /set %launch.entered No
    /unset %launch.user
    /unset %target.chan
    /msg $chan Mission aborted by systems.
  }
  .-
  .Troubleshoot
  ..Code Check:/codetest
}

Comments

Sign in to comment.
Zeroodemon   -  Sep 12, 2007

...

._.\"

 Respond  
Akishoot   -  Sep 01, 2007

o_O

 Respond  
cantseeme   -  Sep 01, 2007

rifk...

I swear, delete if you want I dont know how I did this..
Other then Im drinking.

 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.