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
219 stars 7 forks source link

Add Arrays to RakuScript #265

Open Jeremi360 opened 12 months ago

Jeremi360 commented 12 months ago

It will be usefull for example inventory in game. I think we need to make it easy to discover/use arrays, because from what I discovered hacking many amateur games in Ren'Py, people don't know about arrays.

array empty_array # []
array invetory "crowbar" "key" # ["crowbar", "key"]
invetory += "knob" # ["crowbar", "key", "knob"]
invetory -= "key" # ["crowbar", "knob"]
invetory += ["light", "pan] # ["crowbar", "knob", "light", "pan]
invetory -= ["light", "pan] # ["crowbar", "knob"]
invetory[1] # => "knob"
invetory[1] = "key" #  ["crowbar", "key"]

if "knob" in invetory # => true
# or/add maybe:
if invetory has "knob" # => true

# multiline array
array invetory:
  "crowbar" "key"

# empty line ends mulitline array def