home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 10 Scripting / 05 Barnes, Hutchens / Listing1.cpp next >
Encoding:
Text File  |  2001-12-09  |  1.2 KB  |  36 lines

  1. /* Copyright (C) Jonty Barnes and Jason Hutchens, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Jonty Barnes and Jason Hutchens, 2001"
  9.  */
  10.  
  11. // A simple script written in the Challenge programming language.
  12.  
  13. begin script SickCow(Target)
  14.     Cow = create ANIMAL COW at position of hand
  15. Start
  16.     make evil spirit point to Cow
  17.     say "This unhealthy beast is on its last legs!"
  18.     move Cow to {Target}
  19.     begin loop
  20.         wait 3 seconds
  21.         HEALTH of Cow -= 0.1
  22.         if {Cow} near {Target} radius 15
  23.             say "It's almost there! Hurry up and die, bovine!"
  24.         elsif HEALTH of Cow < 0.5 and HEALTH of Cow > 0.3
  25.             say "It's almost dead! Yippee!"
  26.         elsif Cow is FLYING
  27.             say "Is it a bird? Is it a plane? No. It's a cow."
  28.         end if
  29.     until {Cow} at {Target}
  30.         say "It made it to safety. How unfortunate!"
  31.     until HEALTH of Cow <= 0
  32.         say "Ha! It's steak for dinner!"
  33.     end loop
  34.     send evil spirit home
  35. end script SickCow
  36.