Questions tagged [ffl]

Frogatto Formula Language (FFL) is the scripting language for the Anura game engine. It differs from many other programming languages in that it is a pure functional language. This tag should only be used for questions about this language and programming in it; it should not be used for building, installing, or setup problems of the Anura game engine.

FFL stands for "Frogatto Formula Language". It is the scripting language for the Anura game engine, which is used by games such as Frogatto & Friends and Argentum Age. It differs from many other high-level programming languages such as Python or Lua or Javascript in that it is a pure functional language.

Background:

Frogatto Formula Language was named in honor of Frogatto because originally, Anura was built as a single-purpose engine intended to run only the game Frogatto, and nothing else. But because FFL proved to be a flexible and powerful language, and because the engine was in practice general-purpose, it was enhanced to allow modules containing all the scripting and assets for individual games to be simply dropped into a subfolder. The goal of FFL is to make it much easier to manage large codebases used by serious, long-term projects or games.

  • Source: "FFL FAQ" ed. by Richard Kettering, November 3, 2017 (abridged and edited for clarity)

Reference:

You may learn more by reading the FFL documentation at the Frogatto github wiki.

See also "A Gentle Introduction to Frogatto Formula Language" by David White.

8 questions
2
votes
2 answers

advanced ffl: conditional expression then-expressions activation

Here is a snippet from https://github.com/anura-engine/anura/blob/55bc02244f0faba5e0831578a3c1c9a82e7bf569/src/formula_function.cpp#L923-L931: FUNCTION_DEF(if, 2, -1, "if(a,b,c)") const int nargs = static_cast(NUM_ARGS); …
1737973
  • 159
  • 18
  • 42
2
votes
2 answers

keyword - FFL: Where vs. Let

I was trying to understand the following code: def() ->commands if(deferred_passive_abilities != [], let [{ability: class passive_ability, creature: class creature}] items = []; let found = false; …
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

FFL: second identifier from where clause not recognized

I believe my syntax is correct on this one, but for some reason the Anura FFL parser is not recognizing the second identifier choice defined in my where clause. What am I missing? def(class creature creature, class game_state game) ->commands [ …
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Combine asserting clauses with where clauses

I have noticed that when I have multiple where clauses and multiple asserting clauses, that I get often get syntax errors when I combine them together. The error will say "unexpected token after where". How should I write it to avoid this error?…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
2 answers

filter max of N

Could it be possible to write in FFL a version of filter that stops filtering after the first negative match, i.e. the remaining items are assumed to be positive matches? more generally, a filter. Example: removeMaxOf1([1,2,3,4], value>=2) Expected…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Understanding the evaluation and execution order with semicolon syntax

I already learned a little bit about FFL semicolons from my previous question. However, it is still not clear what order of evaluation or execution they enforce. So here is a more concrete example: [ expr_a, expr_b ; expr_c, expr_d ; expr_e, expr_f…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Understanding the lib keyword

Is lib a special keyword for Frogatto Formula Language (FFL)? That seems to be the way of invoking class methods. For example: where frog = lib.citadel.create_creature('Giant Frog') Also, I am interested to know where can I find a list of all the…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

should FFL where clause allow referring to previous variable?

So, in Frogatto Formula Language we can have a where clause with multiple assignments, like where a = yadda, b = foo However I can't refer to a in the assignment of b ? I was hoping to simplify by breaking it into steps, where a = ..., b =…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51