| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| RedMaverickZero Three pointed, red disaster!
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 12 Jul 2003
 Posts: 1459
 
 
 | 
			
				|  Posted: Wed Jan 10, 2007 10:25 am    Post subject: Timer? |   |  
				| 
 |  
				| I have an idea for my game, where the hero has a certain amount of time to do a certain objective. Like 10 seconds.. I know it's possible to plotscript this stuff and show a timer and all that stuff. But I was wondering if somebody could help me make a quick script that sets up a timer and stuff. 
 My ultimate plan for it, is if the player can set all 3 tags on before the timer runs out, then an event would happen. But if the player fails, something else would happen.
 
 Could anyone be cool enough to kinda construct it and explain it so I can figure out how to make one later on? You will get mad props in the game I am working on now.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Moogle1 Scourge of the Seas
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 15 Jul 2004
 Posts: 3377
 Location: Seattle, WA
 
 | 
			
				|  Posted: Wed Jan 10, 2007 10:32 am    Post subject: |   |  
				| 
 |  
				|  	  | Code: |  	  | global variable(1, seconds) global variable(2, minutes)
 global variable(3, hours)
 
 script, start timer, begin #records timer start
 seconds:=seconds of play
 minutes:=minutes of play
 hours:=hours of play
 set tag(tag:Timer, on)
 end
 
 script, elapsed time, begin #returns elapsed time in seconds
 variable(total)
 total:=(hours -- hours of play)*3600 #3600 sec/hr
 total+=(minutes -- minutes of play)*60 #60 sec/min
 total+=seconds -- seconds of play
 return (total)
 end
 
 script, check timer, begin
 if (check tag(tag:Timer),and,elapsed time > 300) # 5 minutes, let's say
 then
 (
 #do whatever you do when the timer has run out
 )
 end
 | 
 
 This is kind of rudimentary, but it should point you in the right direction.
 _________________
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| RedMaverickZero Three pointed, red disaster!
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 12 Jul 2003
 Posts: 1459
 
 
 | 
			
				|  Posted: Wed Jan 10, 2007 10:36 am    Post subject: |   |  
				| 
 |  
				| I'm sure that can help.. But I'm no plotscripter, so how will I use those three scripts to do the one thing I need to do? I'm pretty sure I know what to do with the globals. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Bob the Hamster OHRRPGCE Developer
 
 
 
  
 Joined: 22 Feb 2003
 Posts: 2526
 Location: Hamster Republic (Southern California Enclave)
 
 | 
			
				|  Posted: Wed Jan 10, 2007 11:12 am    Post subject: set timer |   |  
				| 
 |  
				| scripting a timer in the current version is a huge pain, but the next release will contain a cool new plotscripting command which makes timers really easy. 'plot:set timer' 
 You can test the feature out now if you use a nightly WIP build
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |