Ejemplo n.º 1
0
	def Do(self, verb, idobject = None):
		if type(verbs.objects[verbs.directory.index(verb)]) is str:
			verb = verbs.objects[verbs.directory.index(verb)]
		if idobject is None and verbs.Get(verb).idclarify is not None:
			return verbs.Get(verb).ClarifyIndirect(self.name) # Clarify the verb if we don't have an indirect object
		try:
			if idobject is not None and scripts.PlayerHas("idobject"): # I don't remember what this was supposed to do.
				return verbs.Get(verb).DefaultResponse()
		except:
			pass
		try: # Find the action
			matches = Indices(self.verbs, verb)
			foundmatch = False
			foundnone = False
			using = ""
			take = ""
			for i in matches:
				if self.idobjects[i] == idobject:
					foundmatch = i
				if self.idobjects[i] is None:
					foundnone = i
			if foundmatch is not False:
				# Match found
				if idobject is not None:
					if scripts.PlayerHas(idobject, True):
						action = self.actions[foundmatch].replace("%idobject%", idobject)
					else:
						raise
				else:
					# Hmm, we don't have a match. Let's see if we have a match using the same verb and an item in the player's inventory
					for i in matches:
						if scripts.PlayerHas(self.idobjects[i]):
							# Ha, we do! Let's use it.
							idobject = self.idobjects[i]
							using = "(with " + Get(idobject).Grammar("the") + " " + Get(idobject).Description("short") + ")\n"
							action = self.actions[i].replace("%idobject%", idobject)
					if not using:
						action = self.actions[foundmatch]
			elif foundnone is not False:
				# No direct match, but we found a match without the indirect object. We'll push it to that.
				if idobject is not None:
					action = self.actions[foundnone].replace("%idobject%", idobject)
				else:
					action = self.actions[foundnone]
			else:
				raise
			take = ""
			if action and self.autoTake and self.Location() != "me" and self.canTake and not verb in ignoreautotake:
				take += "(first taking " + self.Grammar("the") + " " + self.Description("short") + ")\n" + scripts.Take(self.name) + "\n"
			if idobject:
				if action and Get(idobject).autoTake and Get(idobject).Location() is not "me" and Get(idobject).canTake and not verb in ignoreautotake:
					take += "(first taking " + Get(idobject).Grammar("the") + " " + Get(idobject).Description("short") + ")\n" + scripts.Take(Get(idobject).name) + "\n"
			return using + take + action
		except:
			# Opps, we don't seem to have that action set for this object
			return verbs.Get(verb).DefaultResponse()
Ejemplo n.º 2
0
def Verb(verb): return verbs.Get(verb)
def Game(): return game.Settings()
Ejemplo n.º 3
0
def Verb(verb):
    return verbs.Get(verb)