On Mon, 14 Apr 2008 03:06:50 -0500, Zoe Phoenix wrote: > I'm playing around with making a small test game with what little Ruby > code I've learned so far and I feel like I'm doing good for only having > been learning the past couple of weeks or so. I've mostly been figuring > things out as I go, but I need a little help. > > Say I wanted a character to be afflicted with a "poison" status that > removes 5% of their current HP. I know it should be a method that occurs > every few seconds (or just every turn) and that it should loop until > something is used to cure it or the battle ends, but I'm not sure how to > do this. I'd like to make it repeat every, say, 15 seconds or so, but I > guess it doesn't really matter how often, since this is just for > practice. The following code is incomplete (and possibly incorrect), but > please advise: > > def poison > #loop begins.. help? > character.hp - (character.hp * 0.03) > puts 'Your HP dropped!' + Character[1].hp'/'+Character[1].maxhp > end #loop ends if battle ends or if antidote used > end You could use a thread Thread.new do until antidote? character.hp -= whatever puts 'Your HP dropped...' sleep 5 end end but as Phillip mentioned, it's probably better to look at how your game is organized as a whole, because lots of little threads doing stuff like this is going to get confusing, buggy, and dangerous quickly. -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/