Rakugo-Dialogue-System
Rakugo-Dialogue-System copied to clipboard
Support for `in` keyword in RakuScript
I think we should add support for in
keyword or its alternative,
but for only easier writing if
, I think that rakuscript don't need loops.
# gdscript
if true in [x, y, z]:
# is same as gdscript
if x or y or z:
# rakuscript
orif x, y, z:
# gdscript
if not (false in [x == 1, y == 2]):
# is same as gdscript
if x == 1 and y == 2:
# rakuscript
andif x == 1, y == 2:
What you think @theludovyc and @MatteoPiovanelli-Laser ??
I haven't dug in rakuscript enough to really weigh in on this.
Personally, I never use the in
keyword in if
clauses, because I've been writing if
s without it for too long, but it's just a matter of habit.
What is your reasoning against loops?
I haven't dug in rakuscript enough to really weigh in on this. Personally, I never use the
in
keyword inif
clauses, because I've been writingif
s without it for too long, but it's just a matter of habit.
in
in if
s are allows to write complied conditions with many and
s or or
s easier.
if true in [x, y, z]:
# is same as gdscript
if x or y or z:
What is your reasoning against loops?
RakuScript is aim to write branching dialogs,
if you really need loops RakuScript supports gdscript
blocks with which you can write almost any gdscript code.
So you are saying to have a base rakuscript that does what the scripting in renpy does, and is easy to parse by a non programmer into one (or several) text files for the dialogues and scenes (as in, not necessarily godot's scenes, but a story's scenes). If someone has to put complex logic into them, then they have the option to use gdscript directly. Right? I can support that.
So you are saying to have a base rakuscript that does what the scripting in renpy does, and is easy to parse by a non programmer into one (or several) text files for the dialogues and scenes (as in, not necessarily godot's scenes, but a story's scenes). If someone has to put complex logic into them, then they have the option to use gdscript directly. Right? I can support that.
Yes.
as possible counterpoints to what I just said:
- the syntax with gdscript should allow mixing gdscript and rakuscript clearly, so that it's possible for example, to have a character say a line 10 times by looping 10 times.
- renpy has an explicit
while
statement to avoid having to mix syntaxes per my previous point.
the syntax with gdscript should allow mixing gdscript and rakuscript clearly, so that it's possible for example, to have a character say a line 10 times by looping 10 times.
Sorry for some reason I had some block in my mind I could think about loops only in case of every advanced code, but you are right in this case loop would be useful, so I no longer against it.
renpy has an explicit
while
statement to avoid having to mix syntaxes per my previous point.
I didn't know that renpy has loops I didn't saw it in any renpy code I saw, and if it is in their docs I miss it.
To be fair, I can see not needing loops in 99% of "normal" vns.
But there are several things a while
statement can make nicer. For example, a character describing their clothes/inventory in a dialogue, by iterating over them.
Link to renpy's while
statement: https://www.renpy.org/doc/html/conditional.html#while-statement
Honestly, I've never seen it in the wild, but I've never looked too hard for it.
renpy has an explicit
while
statement to avoid having to mix syntaxes per my previous point.
You are wrong here @MatteoPiovanelli-Laser, every programming language has while
loop, but is not used so often.
I moved this discussion about loops to separated issue #64
This issue is should closed a long time ago, as our if
to check its condition uses Godot's Expression
class.
A class that allows you to execute the GDScript code given in string, and GDScript supports in
so our RakuScript too.
So I closing it @theludovyc .