Example #1
0
	def keysdown(self, thetyped):
		self.theword = self.letter(thetyped, self.userinput)	#the growing string
		if self.event.type == KEYDOWN and self.event.key == K_RETURN:
			self.thefinalword = self.theword		#the final string
			self.thefinalword = self.thefinalword.lower()
			self.thefinalword = self.thefinalword.strip()
			
			#identifying the string & running backend
			self.thefinalstring = self.thefinalword.split()
			j = len(self.thefinalstring)
				
			
			firstword = self.thefinalstring[0]
			#self.lastword = self.thefinalstring[1:j]	
			#self.k = len(self.lastword)
			
			self.personurl='none.png'
			self.text = ''
			self.text2 = ''
			self.text3 = ''
			self.text4 = ''
			self.text5 = ''
			
			if self.endPrompt:
				print firstword
				if firstword =='1':
					self.sleep = True
					self.endPrompt = False
					self.url='dorm.jpg'
					self.classnum=0
					self.day=self.day+1
				elif firstword == '2':
					self.sleep = False
					self.endPrompt = False
					self.url='lounge.jpg'
					self.classnum = 0
					self.day=self.day+1
				else:
					self.text="Answer the goddamn question"
			print self.endPrompt, self.classnum		
			if self.l and self.modconlec2 != 0 and j !=0: #if you are in the second modcon lecture
				self.url='lecture.jpg'
			
				ls1,lsop = backend.modconlec(self.sleep)
										
				if ls1[len(ls1)-1] and self.modconlec2 < len(ls1)-1: #
					self.text=ls1[self.modconlec2]
				elif ls1[len(ls1)-1] and self.modconlec2< len(ls1): # if there are options in the prompt
					choise= int(firstword)
					self.text=lsop[choise-1]
					if choise == 1:			
						self.url='notes.jpg'
						self.personurl='none.png'
				if ls1[len(ls1)-1]:
					if self.modconlec2 == len(ls1):
						self.l=False
						self.personurl == 'none.png'
						self.modconlec2 =0
						self.classnum=self.classnum+1
				elif ls1[len(ls1)-1] == False:
					if self.modconlec2 == len(ls1)-1:
						#print 'met condit lesson over'
						self.l=False
						self.classnum=self.classnum+1
						self.personurl='none.png'
						self.modconlec2 =0
				else: self.personurl='tempStorey.png'
				self.modconlec2=self.modconlec2+1
			else:
				pass
				
							
			if j == 0:
				pass	#later turn into "continue" for conversation?
			else:
				if self.classnum ==2:
					self.text="Well that was an event-filled day. What do you want to do? (1) Go to bed and get some rest before your classes (2) Stay up, you're at college for f***s sake"
					self.endPrompt = True
				firstword = self.thefinalstring[0]
				self.lastword = self.thefinalstring[1:j]	
				self.k = len(self.lastword)

				#classList=['modcon','modsim','design','' ]


				#GOTO identifier
				if self.l==False and firstword == 'goto' or firstword == 'go':
					if self.lastword[0] != 'modcon': #change to if lastword is not in list of classes
						self.goto()	
					elif self.lastword[0] == 'modcon' or self.lastword[1] == 'con': 
						ls1,lsop = backend.modconlec(self.sleep)
						self.text=ls1[self.modconlec2]
						
						self.url='lecture.jpg'
						self.personurl='tempStorey.png'
						self.l=True
						self.modconlec2=self.modconlec2+1
					elif self.lastword[0] == 'oie':
						




				#loading the bg and person images
				self.image = pygame.image.load(os.path.join('Backgrounds',self.url))
				if self.personurl != None:
					self.person = pygame.image.load(os.path.join('Characters', self.personurl))
				self.userinput = []		#resetting the userinput
				self.theword = ''		#resetting the displayed text
				
		if self.event.type == KEYDOWN and self.event.key == K_BACKSPACE:	#backspace!
			i = len(self.theword)
			self.userinput = self.userinput[0:i-2]
			self.theword = self.theword[0:i-2]
Example #2
0
	def keysdown(self, thetyped):
		self.theword = self.letter(thetyped, self.userinput)	#the growing string
		if self.event.type == KEYDOWN and self.event.key == K_RETURN:
			self.thefinalword = self.theword		#the final string
			self.thefinalword = self.thefinalword.lower()
			self.thefinalword = self.thefinalword.strip()
			
			#identifying the string & running backend
			self.thefinalstring = self.thefinalword.split()
			j = len(self.thefinalstring)
				
			
			if len(self.thefinalstring)>0:
				firstword = self.thefinalstring[0]
			#self.lastword = self.thefinalstring[1:j]	
			#self.k = len(self.lastword)
			
			self.personurl='none.png'
			self.text = ''
			self.text2 = ''
			self.text3 = ''
			self.text4 = ''
			self.text5 = ''
			
			if self.day == 7:
				self.text="Today is the day of your finals. Chose which to go to first. MODCON DESNAT OIE or MODSIM"
				
			if self.day ==7 and firstword == 'modcon':
				if self.modconhw ==True:
					self.text="You present your working modcon project, a beautiful piece of circuitry if you do say so yourself. Everyone is shocked and amazed at your prowess and you complete the course with a lovely PASS"
				if self.modconhw ==False:
					self.text="You present a horrific nightmare of circuits shooting sparks every which-way. One of these loose embers catches the neighboring project on the efficiency of lighterfluid. The building go up in flames. Needless to say you are leave with a weighty FAIL on your record."
			
			if self.day ==7 and firstword == 'modsim':
				if self.modsimhw ==True:
					self.text="The model you lovingly created excutes magnificently. With a palette swap or two, you MATLAB animation could be mistaken for reality! A stunning success, you leave with a PASS!"
				if self.modsimhw ==False:
					self.text="Your model is so horribly abuses the law of earth and man that it makes the audience sick to view. In the mass chaos, you see this abomination of physics begin to tear a whole in reality. You and your audience are sent hurling into the sun as the universe tries to correct this creation you made. As you burn for eternity, you still make note of the new fail on your record."
					
			if self.day ==7 and firstword == 'desnat':
				if self.desnathw ==True:
					self.text="When it comes your time to present, you squeeze together the suction cups that active your hopper and stand back. With a second, it leaps. Higher and higer it climbs, through the cieling tiles, past the roof of the ac and further upwards. After watching for 5 min, it descends, perfectly in-tact as the applause of the class wafts over you. You comemorate this day celebrating a PASS on your record."
				if self.desnathw ==False:
					self.text="The unholy monstrosity you made is set on the stage. Nervously, you activate the trigger. Instead of Hopper, it further deforms. This 'hopper' you created repeats 'HUNT KILL DESTROY swag' over its rampage. The tragedy is one you hope to never think of again. You leave with a FAIL, but an impressive body-count"
					
			if self.day ==7 and firstword == 'oie':
				if self.oiehw ==True:
					self.text="You turn in your essay, and proceed to never think about it again. A week later you get an email that says what a wonderful job you did, and a note that you passes the class."
				if self.oiehw ==False:
					self.text="You fail to turn in your essasy and a week later you recieve an email about how disappointed your professer is. When you check your class status, you note that  you still passed. lol ok"
			
			
			
			if self.endPrompt:
				if firstword =='1':
					self.sleep = True
					self.endPrompt = False
					self.url='dorm.jpg'	
					self.classnum=0
					self.day=self.day+1
					self.p=1
				elif firstword == '2':
					self.sleep = False
					self.endPrompt = False
					self.url='lounge.png'
					self.classnum = 0
					self.day=self.day+1
					self.p=1
				elif self.p==1:
					self.text="Answer the question already!"

		
			if self.l and self.modconlec2 != 0 and j !=0: #if you are in the second modcon lecture
				self.url='lecture.png'
			
				ls1,lsop = backend.modconlec(self.sleep)
										
				if ls1[len(ls1)-1] and self.modconlec2 < len(ls1)-1: #
					self.text=ls1[self.modconlec2]
				elif ls1[len(ls1)-1] and self.modconlec2< len(ls1): # if there are options in the prompt
					choise= int(firstword)
					self.text=lsop[choise-1]
					if choise == 1:			
						self.url='notes.jpg'
						self.personurl='none.png'
				if ls1[len(ls1)-1]:
					if self.modconlec2 == len(ls1):
						self.l=False
						self.modcon=3
						self.personurl == 'none.png'
						self.modconlec2 =0
						self.classnum=self.classnum+1
				elif ls1[len(ls1)-1] == False:
					if self.modconlec2 == len(ls1)-1:
						#print 'met condit lesson over'
						self.l=False
						self.modcon=3
						self.classnum=self.classnum+1
						self.personurl='none.png'
						self.modconlec2 =0
				else: self.personurl='tempStorey.png'
				self.modconlec2=self.modconlec2+1
			else:
				pass
				
							
			if j == 0:
				pass	#later turn into "continue" for conversation?
			else:
				if self.classnum ==2:
					self.text="Wait! It's getting late. It's too late to do that! Although you are tired, there are still people up in the lounge. Do you (1) Go to sleep (2) Stay up and have some fun in your life."
					self.endPrompt = True
				firstword = self.thefinalstring[0]
				self.lastword = self.thefinalstring[1:j]	
				self.k = len(self.lastword)

				classList=['modcon','modsim','desnat','oie', 'design' ]

				if len(self.lastword)!=0 and self.lastword[0]=='to':
					self.lastword = self.lastword[1:self.k]

				if firstword == 'kill' or firstword == 'die':
					if firstword == 'kill' and self.lastword[0]=='self':
						self.url='death.png'
					elif firstword== 'die':
						self.url = 'death.png'
					else:
						self.text="Stop trying to kill things, this is a happy environment."

				if firstword =='do':
					if 'home'and 'work' or'hw' or 'homework' in self.lastword:
						if 'mod' and 'con' or 'modcon' in self.lastword:
							self.modconhw=True
							self.text="Well it's nice to get that out of the way!"
						if 'mod' and 'sim' or 'modsim' in self.lastword:
							self.modsimhw=True
							self.text="Well it's nice to get that out of the way!"
						if 'design' and 'nature' or 'desnat' in self.lastword:
							self.desnathw=True
							self.text="Well it's nice to get that out of the way!"					
						if 'oie' in self.lastword:
							self.oiehw=True
							self.text="Well it's nice to get that out of the way!"							
							
				#GOTO identifier
				if not self.endPrompt and self.day <7 and self.l==False and firstword == 'goto' or firstword == 'go':
					if self.lastword[0] not in classList: #change to if lastword is not in list of classes
						self.goto()
					elif self.lastword[0] == 'modcon': 
						if self.lastword[0]=='to':
							self.lastword = self.lastword[1:self.k]
						
						if self.modcon ==1:
							self.text="Welcome to Modeling and  Control! I'm Brian Storey and you're in for a world of pain and depression. Have fun with simulink!"
							self.classnum=self.classnum+1
							self.url='lecture.png'
							self.personurl='tempStorey.png'
							self.modcon =2
						elif self.modcon ==2:
							ls1,lsop = backend.modconlec(self.sleep)
							self.text=ls1[self.modconlec2]
							self.url='lecture.jpg'
							self.personurl='tempStorey.png'
							self.l=True
							self.modconlec2=self.modconlec2+1
						elif self.modcon==3:
							self.text="For your final project make sure it is AWESOME and you'll do fine. Or do this lab or whatever, the ninja's will deal with you then"
							self.personurl="tempStorey.png"
							self.url='lecture.png'
							self.classnum=self.classnum+1
							self.modcon=4
					elif self.lastword[0] == 'oie':
						if self.oie ==1:
							self.text= backend.oielec()
							self.url='lecture.png'	
							self.classnum= self.classnum+1
							self.oie =2
						elif self.oie==2:
							self.text= "Well that was very informative about... dating culture or something. Fun times! (Did he mention an essay or something?)"
							self.oie=3
							self.url='lecture.png'
							self.classnum=self.classnum+1
						elif self.oie==3:
							self.text="Well friends, it looks like we're coming to the end of your first semester. You only need to finish your essay, and then you're experienced and entire introduction to Olin"
							self.classnum=self.classnum+1
							self.url='lecture.png'
							self.oie=4
					elif self.lastword[0] =='modsim':
						if self.modsim ==1:
							self.text="Hello. I'm John Geddes. We're going to be doing some physics and, everybody's favorite, MATLAB! (No Mathematica. Ever.)"
							self.url='lecture.png'
							self.classnum=self.classnum+1
							self.modsim=2
						elif self.modsim ==2:
							self.text="You better get to work on your simulation. -You are a bit unsure what to do for your project, so you decide yo wait for John to get to your group. Unfortunately after an hour, he is only at the second table and you lose hope-"
							self.classnum=self.classnum+1
							self.modsim=3
							self.url='lecture.png'
						elif self.modsim ==3:
							self.text="Remember that you're project is do soon!If you don't keep your model accurate to real-world physics, who knows what's going to happen"
							self.classnum=self.classnum+1
							self.modsim=4
							self.url='lecture.png'
					elif self.lastword[0]=='desnat' or self.lastword[0]=='design':
						if self.desnat==1:
							self.classnum=self.classnum+1
							self.desnat=2
							self.url='lecture.png'
							self.text="Hello and welcome to Design Nature! Now go in the woods and draw bugs. Trust us this is `important`"
						elif self.desnat ==2:			
							self.classnum=self.classnum+1
							self.desnat=3
							self.url='lecture.png'
							self.text="Well now that you have some bug pictures and thoroughly studied that scientific paper on jumping, make a Hopper that moves! Only with this one crappy motor, rubber tubbing and all of the delrim. Also learn solidworks"
						elif self.desnat==3:	
							self.classnum=self.classnum+1
							self.desnat=4
							self.url='lecture.png'
							self.text="So you're hopper doesn't.... quite... work... Well, as long as it's done by finals!"
				#loading the bg and person images
				
				self.image = pygame.image.load(os.path.join('Backgrounds',self.url))
				if self.personurl != None:
					self.person = pygame.image.load(os.path.join('Characters', self.personurl))
				self.userinput = []		#resetting the userinput
				self.theword = ''		#resetting the displayed text
				
		if self.event.type == KEYDOWN and self.event.key == K_BACKSPACE:	#backspace!
			i = len(self.theword)
			self.userinput = self.userinput[0:i-2]
			self.theword = self.theword[0:i-2]