You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
536 B

  1. extends Node
  2. class_name YarnRunnerNode
  3. var yarnRunner := YarnRunner.new()
  4. export var yarnScript : Resource
  5. func start_script():
  6. yarnRunner.say_func = funcref(self, "on_new_line")
  7. yarnRunner.choices_func = funcref(self, "on_choices")
  8. yarnRunner.yarnScript = self.yarnScript
  9. yield(yarnRunner.run_all(), "completed")
  10. func on_new_line(line):
  11. print(line)
  12. yield(get_tree(),"idle_frame")
  13. func on_choices(blocks):
  14. print(blocks)
  15. yield(get_tree(),"idle_frame")
  16. print("Default choice taken : " + str(blocks[0]))
  17. return blocks[0]