rakugoteam / Rakugo-Dialogue-System

Inspired by Ren'Py, Rakugo is a project aiming to provide a way to make narrative-based games on Godot easily. Simplify your project, if it is a visual novel, point and click, RPG, interactive text game or many other styles and blends of styles.
https://rakugoteam.github.io
MIT License
221 stars 7 forks source link

Args in labels and menus of RakuScript #236

Open Jeremi360 opened 1 year ago

Jeremi360 commented 1 year ago

Inspired by #235 and it shows that we need #53. Is just way to make menu and labels be as useful as funcs in other langues. Example:

func _ready():
  var door_script = Rakugo.parse_script("res://door.rk")

  door_a.pressed.connect(Rakugo.execute_script(door_script, "door_menu", ["door_a"]))
  door_b.pressed.connect(Rakugo.execute_script(door_script, "door_menu", ["door_b"]))
menu explore:
  "Go to door A" > door_menu("door_a")
  "Go to door B" > door_menu("door_b")
  "Go to next corridor"

menu door_menu(door_id):
  "Lock pick" show if (has_lockpics > 1) > lockpick_minigame(door)
  "Open Door" if door_id in keys > open_door(door_id)
  "Open Door" hide if door_id in closed_doors > missing_key
  "Go in" show if door_id in open_doors > door_id
  "Go Back to exploring" > explore