def explication_obj(msg, obj): """ Permet à partir d'un message et d'un type objet de parcourir le fichier trouvé de notre bdd :return: """ sm.speech_and_move(u"redirecion sur explicator effectuée !") sm.speech_and_move(u"Quelles informations désires-tu sur {} {}".format( obj.get_data(obj.__class__.DETERMINANT), obj.get_data(obj.__class__.NOM))) list_obj = ["{}".format(key) for key in obj.data] sm.speech_and_move( u"Tu peux avoir des informations sur {}".format(list_obj)) # On ecoute la question question = nl.nao_listen() # On regarde si l'info demandé est dans notre bdd et on boucle tant que l'utilisateur n'a pas dit non while "non" not in question: trouve = False #On récupère chaque mot dans la phrase dite par l'utilisateur for mot in question.split(): if mot in list_obj: sm.speech_and_move(u"{} : {}".format(mot, obj.get_data(mot))) trouve = True #Si on ne trouve pas de reponse à la question, on renvoi sur wikipédia if not trouve: get_wikipedia_answer(question) sm.speech_and_move( u"Voudrais tu d'autres infos ? Non si tu veux quitter, " u"et un autre mot clé si tu veux continuer.") question = nl.nao_listen()
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoSensor.captor_data import cpts from NaoSensor.jardin import Pot import NaoCreator.Tool.speech_move as sm if not player: Setting.error( "Error in execution of post_script of objective \"recupInfoPot\": player is None" ) return if s.success: jardin = player.current_scenario.jardin cpt = cpts[player.current_scenario.cpt_name] pot = Pot(cpt.get_datas()) if jardin.reg_pot(pot): sm.speech_and_move("Le pot a été ajouté avec succès !") else: sm.speech_and_move( "Impossible d'ajouter le pot, n'aurais-tu pas ajouté le même pot ou pas attendu assez ?" ) else: print "Impossible d'ajouter le pot; l'utilisateur a répondu 'non'."
def script(s, player=None): from NaoQuest.quest import Quest from NaoCreator.setting import Setting import NaoCreator.Tool.speech_move as sm import NaoCreator.Tool.mailor as MA import codecs if not player: Setting.error( "Error in execution of post_script of objective \"ChoixArrosage\": player is None" ) return if s.completed: # on chop le mail template f = codecs.open("datas/mailTemplate/mailArrosage", 'r', encoding='utf-8') text = '\n'.join(f.readlines()) mail = MA.get_user_mail() # on l'envoie est on récupaire le mail de l'utilisateur MA.nao_send_mail(mail, "Aide arrosage automatique", text) sm.speech_and_move( u"Je tes envoyer un mail avec tout se qui faut savoir sur l'arrosage automatique." ) else: s.completed = True
def next_scn(self): """ Modifie le scénario actuel en trouvant le scénario suivant. :return: False si il n'y a pas de scénario suivant, True sinon. """ todo = [ s for s in self.player.current_scenario.next_scenario if not s.completed ] if not todo: return False if len(todo) == 1: self.player.set_current_scenario(todo[0]) return True sm.speech_and_move( u"Il y a plusieurs scénarios disponibles. Lequel veux-tu executer?" ) kws = [ "premier", "2e" if not Setting.NAO_CONNECTED else "deuxième", "troisième", "quatrième", "cinquième", "sixième" ] sm.speech_and_move(u"".join([ u"Le {} s'intitule {}.".format(kws[i], todo[i].name) for i in range(len(todo)) ])) msg = nl.nao_listen().lower() rep = nkr.sentence_keywords(msg, kws) if not rep: print("Non reconnu !") return False self.player.set_current_scenario( Scenario( self.player.current_scenario.next_scenario[kws.index(rep)])) return True
def script(s, player=None): from NaoQuest.objective import Objective from NaoQuest.quest import Quest from NaoCreator.setting import Setting import NaoCreator.Tool.speech_move as sm if not player: Setting.error( "Error in execution of post_script of objective \"nbPots\": player is None" ) return if not s.completed: return try: player.nb_pots = int(s.answer) for i in range(player.nb_pots): q = Quest(s.scenario_name, "infosPotN") q.name = q.name.format([ "premier", "deuxième", "troisième", "quatrième", "cinquième", "sixième", "septième", "huitième", "neuvième", "dixième" ][i]) q.branch_id = i + 1 s.caller.next_quests += [q] except Exception as e: sm.speech_and_move("Je n'ai pas réussi à comprendre un nombre !") s.completed = False
def script(s, player=None): from NaoQuest.quest import Quest from NaoCreator.setting import Setting import NaoCreator.Tool.speech_move as SM if not player: Setting.error( "Error in execution of post_script of objective \"ChoixService\": player is None" ) return print s.__dict__ if hasattr(s, "kw_answer"): print s.kw_answer # ajoue des quêtes en fonction du choix de l'utilisateur if s.kw_answer == "éxplication" or s.kw_answer == "éxplications": print "ajoue preparation jardin" new_qst = Quest(player.current_scenario.inner_name, "PreparationJardin") else: SM.speech_and_move(u"Ajoue de l'arrosage") print "ajoue arrosage" new_qst = Quest(player.current_scenario.inner_name, "Arrosage") l = len(player.current_quest.next_quests) new_qst.branch_id = l + 1 player.current_quest.next_quests.append(new_qst)
def _exec(self): if not hasattr(self, "question"): Setting.error("No \"question\" in KeyWordObjective \"{}\"".format( self.inner_name)) return if not hasattr(self, "keywords"): Setting.error("No \"keywords\" in KeyWordObjective \"{}\"".format( self.inner_name)) return sm.speech_and_move(self.question)
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoSensor.plant import Plant from NaoQuest.scenario import Scenario import NaoCreator.Tool.speech_move as sm print "il se lance ou pas ce fdp" if not player: Setting.error( "Error in execution of post_script of objective \"determienrTerrainPropice\": player is None" ) return jardin = player.current_scenario.jardin plante_ideale = Plant() plante_ideale.data["valeursIdeales"] = { "soil_moisture": { "min": 50.0, "max": 80.0 }, "light": { "min": 5.0, "max": 8.0 }, "temperature": { "min": 20.0, "max": 50.0 }, "fertilizer": { "min": 0.2, "max": 0.4 } } pots_ideals = [(p, i) for p, i in zip(jardin.pots, range(1, len(jardin.pots) + 1)) if p.is_ideal_for_plant(plante_ideale)] player.current_scenario.pots_ideals = pots_ideals if not pots_ideals: sm.speech_and_move( "Il semblerait qu'aucuns des pots que tu as enregistrés présentent des caractéristiques idéales. Assure toi de trouver un terrain lumineux, riche et humide et relance le scénario." ) player.current_scenario = Scenario("terrainPropice") print("Redémarrage du Scénario \"Terrain Propice\" !") return texte = "Selon mes données, il semblerait que les pots. " for t in pots_ideals: texte += str(t[1]) + ", " texte += "présentent des caractéristiques intéressantes pour ton jardin." sm.speech_and_move(texte)
def i_know_you_local(face_name): """ Fonction appelée par nao creator quand nao connait la personne :param face_name: nom de la personne :return: """ # bonjour prenom text1 = Dg.Creer(Dg.MotsUtiles, {"prenom": face_name}, 8, 37) Sm.speech_and_move(u"{}".format(text1.out())) # on regarde si le joueur n'existe pas déja dans les fichier # menu(face_name) start_quest_mode(face_name)
def _pres(self): """ Présente le scénario si l'attribut "pres" = True """ if hasattr(self, "pres") and not self.pres: return if hasattr(self, "name") and self.name: sm.speech_and_move(u"L'intitulé de cet objectif est. {}.".format(self.name)) if hasattr(self, "desc") and self.desc: sm.speech_and_move(self.desc) self.pres = False
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting import NaoCreator.Tool.speech_move as sm if not player: Setting.error( "Error in execution of post_script of objective \"obj2\": player is None" ) return if s.completed: sm.speech_and_move("La phrase que tu as dite est: {}".format( s.raw_answer))
def _pres(self): """ Présente la quête si l'attribut "pres" = True """ if hasattr(self, "pres") and not self.pres: return if "name" in self.__dict__: sm.speech_and_move(u"L'intitulé de cette quête est. {}.".format(self.name)) if "desc" in self.__dict__: sm.speech_and_move(self.desc) self.pres = False
def script(s, player=None): from NaoQuest.objective import Objective from NaoSensor.plant import Plant import NaoCreator.SGBDDialogue.creer as bd import NaoCreator.Tool.speech_move as sm if not player: print("Error in execution of post_script \"testobj1_post\": player is None") return if not s.completed: p1 = bd.Creer(bd.Instruction, bd.DicoVide, 34, 35, 36) sm.speech_and_move(p1.out()) sm.speech_and_move(u"Pour cette plante, tu dois : {}".format(player.current_quest.plante_lie.get_data(Plant.PLANTATION)["arroser"]))
def script(s, player=None): from NaoQuest.objective import Objective from NaoSensor.plant import Plant import NaoCreator.SGBDDialogue.creer as bd import NaoCreator.Tool.speech_move as sm if not player: print("Error in execution of post_script \"testobj1_post\": player is None") return if not s.completed: p1 = bd.Creer(bd.Instruction, bd.DicoVide, 30) p2 = bd.Creer(bd.Instruction, bd.DicoVide, 31) p3 = bd.Creer(bd.Instruction, bd.DicoVide, 32) p4 = bd.Creer(bd.Instruction, bd.DicoVide, 33) sm.speech_and_move(p1.out() + p2.out() + p3.out() + p4.out())
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.Tool.speech_move import speech_and_move from NaoCreator.setting import Setting if not player: Setting.error( "Error in execution of post_script of objective \"q2\": player is None" ) return if hasattr(s, "kw_answer"): if s.kw_answer == "python": player.point += 1 speech_and_move(u"Bravo ! tu as dit la bonne réponse !")
def launch(self, player=None): """ Démarre le Scénario :param player: Le joueur démarrant le Scénario :return: True si l'exécution termine le scénario (completed=True), False sinon """ if player: player.current_scenario = self self._pres() if self.starting_quest is None: print("Error! Scenario {} has no starting quest!".format(self.inner_name)) return True todo = self.starting_quest.choose_quest() if todo: if len(todo) == 1: todo[0].caller = self todo[0].launch(player) else: sm.speech_and_move(u"Il y a plusieurs quêtes disponibles. Laquelle veux-tu executer?") kws = ["première", "2e" if not Setting.NAO_CONNECTED else "deuxième", "troisième", "quatrième", "cinquième", "sixième"] sm.speech_and_move(u"".join([u"La {} s'intitule {}.".format(kws[i], todo[i].name) for i in range(len(todo))])) msg = codecs.encode(nl.nao_listen().lower(), "utf-8") rep = nkr.sentence_keywords(msg, kws) if not rep: print("Non reconnu !") return False todo[kws.index(rep[0])].caller = self todo[kws.index(rep[0])].launch(player) todo = self.starting_quest.choose_quest() if not todo: self.completed = True # give xp if player: player.give_xp(self.xp) return True else: return False
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoCreator.Tool.speech_move import speech_and_move import NaoCreator.SGBDDialogue.creer as C if not player: Setting.error("Error in execution of post_script of objective \"ValidationRemplirTerre\": player is None") return if not s.completed: # on recupaire le position de l'objectif courent dans la list index_curent_obj = player.current_quest.objectives.index(s) # on mais l'onjectif présédent comme non valider pour que nao reise les instruction player.current_quest.objectives[index_curent_obj - 1].completed = False p1 = C.Creer(C.Reponse, 41, 42, 43, 44) speech_and_move(u"{}".format(p1.out())) else: p1 = C.Creer(C.Reponse, 37, 38, 39, 40) speech_and_move(u"{}".format(p1.out()))
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoSensor.captor_data import cpt_giselle, CaptorData from NaoCreator.Tool.speech_move import speech_and_move from time import sleep if not player: Setting.error( "Error in execution of pre_script of objective \"InfoJardin\": player is None" ) return try: tempetur = cpt_giselle.data[0][CaptorData.TEMPERATURE] except Exception as e: print e tempetur = 20 if -50 <= tempetur <= -1: text = u"IL fait trop froit ! Tu vie au pole Nord ?" elif 0 <= tempetur <= 5: text = u"C'est trop froit pour t-on bullbe. Je te conseil de le rentrée au chaut" elif 6 <= tempetur <= 11: text = u"Il fait un peut froit pour t-on bullbe." elif 12 <= tempetur <= 19: text = u"La températur est un peut just. Je te conseille de rentrée t-on bulbe le matin. " \ u"Est des qu'il fait plus chaud, tu peut le sortire" elif 20 <= tempetur <= 29: text = u"La température est très bien." elif 30 <= tempetur <= 32: text = u"Il commence a fire chaud ! Il faut bien pensser a aroser t-on bulbe. Mais que quand le soleil est coucher pour éviter de bruller t-on bulbe." elif 33 <= tempetur <= 35: text = u"Il fait trop chaud ! Rentre t-on pôt a l'intèrieur pour protéger t-on bulbe de la charleur" else: text = u"je ne peut rien dire" speech_and_move( u"Maintenemps que tu a mit le capteur dans t-on peau. Je vais regarder le température." ) sleep(1) s.desc = s.desc.format(text)
def _interact(self): self.failed_interact = False self.raw_answer = nao_listen().lower() if typemsg(self.raw_answer): self.answer = list() self.failed_interact = True return # On fait dire à Nao les différents mots-clefs if nkr.sentence_keywords(self.raw_answer, ["aide", "ed"]): if hasattr(self, "help_kw"): sm.speech_and_move(self.help_kw) else: sm.speech_and_move( "Les mots clefs disponibles sont. {}".format(". ".join( [self.kw2id[i] for i in self.kw2id]))) self.completed = False self.answer = list() # On extrait la réponse selon keywords puis kw2id self.answer = nkr.sentence_keywords(self.raw_answer, self.keywords) if len(self.answer) == 1: if self.answer[0] in self.kw2id: self.kw_answer = self.kw2id[self.answer[0]] else: self.kw_answer = self.answer[0] # On échoue si on repère plus d'un mot-clef elif len(self.answer) > 1: sm.speech_and_move("Vous avez dit plus d'un mot-clef !") self.answer = [] self.completed = False
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoSensor.plant import Plant from NaoCreator.Tool.speech_move import speech_and_move if not player: Setting.error( "Error in execution of post_script of objective \"ChoixBulbe\": player is None" ) return if hasattr(s, "kw_answer"): if s.kw_answer == "1": p = Plant("glaieul") speech_and_move( u"Très bon choix le glaieul est l'une de mes fleur préférer.") elif s.kw_answer == "2": p = Plant("lys") speech_and_move(u"Tu a bien fait de choisir un lys.") else: print "3" p = Plant("freesias") speech_and_move( u"Sa tombe bien, c'est justement la saison des freesias") # creation d'un attribut qui va contenir la plante liée au joueur player.plante_lie = p print(u"Quete correctement ajoutée")
def admin(face_name): """ Petite fonction secrète pour donner des ordres à Nao :param face_name: nom du visage devant nao :return: """ Sm.speech_and_move(u"Mots de passe".format(face_name)) password = Nkr.nao_key_word_recognition("cancer") # bon mots de passe if password != "": Sm.speech_and_move(u"Bienvenu maitre {}! Attention il me faut de la place pour mes mouvements." u"Pour arrêter dit moi fini ou fin. Quand je fini une action appuie sur ma tête" u"Dis moi ce que tu veux " .format(face_name)) posture_key_word = {"assis":"Sit", "debout":"Stand", "coucher":"LyingBack", "couché":"LyingBack", "ventre":"LyingBelly", "pause":"SitRelax", "méditer":"Crouch", "méditation":"Crouch"} end_key_word = ["fin", "fini", "arret", "stop"] desactive_traker() while True: try: res = Nkr.nao_key_word_recognition(*posture_key_word.keys() + end_key_word) if res in posture_key_word: Setting.naoPosture.goToPosture(posture_key_word[res], 1.0) elif res in end_key_word: Sm.speech_and_move(u"Fin de la session admin !") break waitfor() # que veux-tu de moi text1 = Dg.Creer(Dg.Demande, Dg.DicoVide, 7, 8) Sm.speech_and_move(u"{}".format(text1.out())) except Exception as e: print("Erreur: ", e) active_traker() else: Sm.speech_and_move(u"Mots de passe incorrect. Auto destruction amorcée")
def get_user_mail(): """ Récupère le mail de l'utilisateur devant nao :return: le mail entrer par l'utilistaeur """ sm.speech_and_move(u"Peux-tu entrer ton adresse mail ?") email_re = re.compile( r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) # domain while True: try: mail = tkSimpleDialog.askstring('Email', 'Adresse mail') # si le mail est correct if email_re.search(mail): return mail else: sm.speech_and_move( u"L'adresse mail que tu as entrée n'est pas valide") except Exception as e: print e
def nao_scenario_module(func_i_meet_you, func_i_know_you): """Fonction principale. :param func_i_meet_you: fonction qui est appelée quand nao ne connait pas la personne. :param func_i_know_you: fonction qui est appelée quand nao connait la personne. :return: """ # Si nao est assie il Setting.naoPosture.goToPosture("Stand", 1.0) Setting.naoFaceDetectionRecognition.enableRecognition(True) # on autorise le proxy FaceDetectionRecognition a écrire dans la mémoire "Face" Setting.naoFaceDetectionRecognition.subscribe( Setting.MEMORY_FACE, Setting.FACE_DETECTION_RECOGNITION_PERIOD, 0.0) Setting.naoLed.on("AllLedsGreen") Setting.naoMotion.setStiffnesses("Head", 1.0) Setting.naoFaceTracker.startTracker() nb_unknown_face = 0 nb_known_face = 0 current_color = "green" Sm.speech_and_move( u"Démarage de nao création ! Initialisation des capteurs ! Tout le système et charger!" ) # Boucle principale while Setting.naoMemoryProxy.getData("LeftBumperPressed") != 1: nb_unknown_face, nb_known_face, current_color, finished, name = search_face( func_i_meet_you, func_i_know_you, nb_unknown_face, nb_known_face, current_color) sleep(0.5) normal_stop()
def menu(player_name): """ Menu principal :param player_name: nom du joueur courant :return: """ admin_key_word = ["admin", "administrateur", "administration"] quest_start_key_word = ["apprentissage", "quête", "formation", "mission"] end_key_word = ["fin", "fini", "arret", "stop"] # que veux-tu de moi text1 = Dg.Creer(Dg.Demande, Dg.DicoVide, 7, 8) Sm.speech_and_move(u"{}.".format(text1.out())) # Menu while True: res = Nkr.nao_key_word_recognition(*admin_key_word + quest_start_key_word + end_key_word) # Commande secrete if res in admin_key_word: admin(player_name) Setting.naoPosture.goToPosture("Stand", 1.0) # Il veut faire ses quêtes elif res in quest_start_key_word: # On démarre les quêtes super start_quest_mode(player_name) # si on veut quitter elif res in end_key_word: break # Si la personne se trompe else: Sm.speech_and_move(u"Dommage je n'ai pas compris ce que tu a dis, peux-tu répéter ?") waitfor() # que ve tu de moi text1 = Dg.Creer(Dg.Demande, Dg.DicoVide, 7, 8) Sm.speech_and_move(u"{}.".format(text1.out())) Sm.speech_and_move(u"Dommage tu vas me manquer! C'est pas grave à plus. Bisous")
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoCreator.Tool.speech_move import speech_and_move if not player: Setting.error("Error in execution of post_script of objective \"q1\": player is None") return if hasattr(s, "kw_answer"): if s.kw_answer == "3" or s.kw_answer == "trois": player.current_quest.point += 1 speech_and_move(u"Félicitation tu a la bonne réponse.") else: speech_and_move(u"mauvaise réponse ! La bonne réponse était. 3.") speech_and_move(u"Le bouturage est un mode de multiplication. Cela consiste à donner naissance à une nouvelle " u"plante à partir de la plaznte mère. C'est une technologie de clonage.")
def get_wikipedia_answer(info): """ Permet de faire la recherche sur wikipédia et de donner la première phrase de la page wikipédia correspondante à la question posée par l'utilisateur. :param info: message dit par l'utilisateur :return: """ sm.speech_and_move( u"Désolé cette information m'est inconnue, je te redirige sur wikipédia." ) try: resum = w.get_resum(info, w.FRENCH).split(".") sm.speech_and_move(u"Voici la réponse a ta question. {}".format( resum[0])) except Exception as e: sm.speech_and_move( u"Je n'ai pas réussi à trouver la réponse à ta question sur Wikipédia !" )
def get_name(): """ Fonction qui obtient le nom de la personne. :return: Elle renvoie un couple (booleen, string) True et le nom si tout s'est bien passé False et un code d'erreur sinon """ keyout = "non" name = "" while keyout != "" and Setting.naoMemoryProxy.getData( "MiddleTactilTouched") != 1: try: name = Nl.nao_listen().decode("utf-8") # gestion des cas spéciaux if name == "": if Setting.DEBUG: print "erreur sur NaoListen" return False, "erreur" elif "annuler" in name: if Setting.DEBUG: print "annulation" return False, "annulation" elif "tu me connais" in name: if Setting.DEBUG: print "re learning" return False, "re learning" Sm.speech_and_move( u"Le prénoms que tu ma dit est {} ".format(name)) demande = Dg.Creer(Dg.Demande, Dg.DicoVide, 23) Sm.speech_and_move(u'{}'.format(demande.out())) # Si on a mal enregistré on le fait répéter keyout = Nkr.nao_key_word_recognition("non", "tu l'a mal dit") if keyout != "": Sm.speech_and_move(u"Désoler, peut tu me redire t-on prénom ?") except Exception as e: print e raise e return True, name
def wait_for(current_player): """ Attend un joueur. Celui-ci devra se montrer à Nao ou appuyer sur un bumper pour continuer l'exécution. :param current_player: Le joueur actuel """ print "[wait_for] Waiting for player..." if Setting.BYPASS_WAIT_FOR: return False # On fait dire à Nao le text lors du wait_for if hasattr(current_player.current_objective, "wait_for_text"): sm.speech_and_move(current_player.current_objective.wait_for_text) elif hasattr(current_player.current_quest, "wait_for_text"): sm.speech_and_move(current_player.current_quest.wait_for_text) elif hasattr(current_player.current_scenario, "wait_for_text"): sm.speech_and_move(current_player.current_scenario.wait_for_text) nb_unknown_face = 0 nb_known_face = 0 pass_to_i_now_you = False Setting.naoLed.off("AllLeds") Setting.naoLed.on("AllLedsBlue") Setting.naoLed.on("AllLedsRed") i = 1 old_player = current_player.player_name while Setting.naoMemoryProxy.getData( "MiddleTactilTouched") != 1 and not pass_to_i_now_you: stop = Setting.naoMemoryProxy.getData("RightBumperPressed") == 1 if stop: return False nb_unknown_face, nb_known_face, current_color, finished, pass_to_i_now_you = search_face( i_meet_you, i_know_you, nb_unknown_face, nb_known_face, "none", [current_player]) sleep(.5) print i i += 1 print old_player, Setting.CURRENT_PLAYER.player_name return old_player != Setting.CURRENT_PLAYER.player_name
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoCreator.Tool.speech_move import speech_and_move if not player: Setting.error("Error in execution of post_script of objective \"q1\": player is None") return if hasattr(s, "kw_answer"): if s.kw_answer == "1" or s.kw_answer == "un": player.current_quest.point += 1 speech_and_move(u"Félicitation tu a la bonne réponse.") else: speech_and_move(u"mauvaise réponse ! La bonne réponse était. 1.") speech_and_move(u"Voici l'explication : Le purin d'ortie est un insecticide naturel, peu couteux et efficace" u"pour lutter contre les pucerons. C'est aussi un excellent engrais pour les plantes." u"Pour le préparer, il suffit de laisser macérer 1 kg d'orties dans 10 litres d'eau " u"pendant 2 à 3 jours.")
def script(s, player=None): from NaoQuest.objective import Objective from NaoCreator.setting import Setting from NaoCreator.Tool.speech_move import speech_and_move if not player: Setting.error( "Error in execution of post_script of objective \"q1\": player is None" ) return if hasattr(s, "kw_answer"): if s.kw_answer == "2" or s.kw_answer == "deux": player.current_quest.point += 1 speech_and_move(u"Félicitation tu a la bonne réponse.") else: speech_and_move(u"mauvaise réponse ! La bonne réponse était. 2.") speech_and_move( u"Voici l'explication : La grelinette est un outil de jardinage qui permet d'ameublir la terre" u"sans la retourner. La grelinette ressemble à une fourche à quatres dents, munie de deux bras." )