Hi all, version 1.2 is out.
It has major fixes and reorganizations inside, the first of which is the move to GoogleCode as SourceForge was overkill for this kind of project (<rant>and totally unintuitive to use, it's still the same as 10 years ago if not worse </rant>).
The new download link is:
http://code.google.com/p/lualinq/
Changes:
"from" detects a GrimQ structure and inteprets it correctly, plus all methods taking a second LuaLinq now can take anything you can feed a "from" method with
This mean you can use arrays in calls to except, zip, etc. without converting to GrimQ objects first.
"select" method accepts a property name instead of a selector function / "where" method accepts a property name and a value instead of a predicate
This means you can now write:
Code: Select all
grimq.from(allEntities(1))
:where("name", "secret")
:select("id")
:foreach(print)
reverseFacing, getChampionFromOrdinal, isToorumMode, dezombifyParty
Utility functions of recurrent use. Nothing to write home about
string functions
strformat(string, ...) – transform the string by replacing tokens starting with $ with an appropriate substitution text:
-- $1.. $9 -> are replaced with the optional parameters which can be passed to the function
-- $champ1..$champ4 -> are replaced with name of champion of the appropriate slot
-- $CHAMP1..$CHAMP4 -> are replaced with name of champion of the appropriate ordinal
-- $rchamp -> a random champion
-- $RCHAMP -> a random champion which is alive and enabled
for example: hudPrint(strformat("Hello $RCHAMP")) - will print Hello followed by a random champion name everytime it's called.
strstarts(string,start) – returns true if string starts with the “start” string
strends(string,end) – returns true if string starts with the “end” string
strmatch(string, pattern) – returns true if the string matches the Lua pattern specified (see
http://lua-users.org/wiki/PatternsTutorial and
http://www.lua.org/pil/20.2.html)
Auto objects
If AUTO_ALL_SECRETS option is enabled, all secrets are automatic. Hud Printer uses strformat so you can put champions names there.
JKos framework integration
The integration is
OPTIONAL.
The integration with the awesome JKos framework offers:
- Simplified JKos framework setup (no need of defining the logfw_init entity in the dungeon)
- Automatic hooks (see autohooks) can be defined in scripting entities
- Initialization order features – the autoexec method of scripting entities will be called after both GrimQ and JKos framework are initialized and ready
- Non-delayed initialization – the initialization of JKos framework does not use a timer at this moment, in grimq
To setup:
- Setup GrimQ and set its USE_JKOS_FRAMEWORK option to true
- Follow the setup instructions at https://sites.google.com/site/jkosgrimrock2/home but do NOT create the logfw_init entity
- Put any code adding hooks etc. in an autoexec method in any scripting entity you want.
Advantages:
As said, the advantage is that autoexec() methods of scripting_entities are called only when all the other scripting entities are loaded AND the jkos framework is completely initialized.
As a bonus, one can write automatic hooks. For example if you put:
Code: Select all
autohook =
{
party =
{
onPickUpItem = function(self, item)
print("onPickUpItem")
end,
onMove = function(self, direction)
print("onMove")
end,
onTurn = function(self, direction)
print("onTurn")
end,
}
}
in an entity, those hooks are automatically installed at startup.
Thanks again to JKos for such an awesome framework.
Now let's try to work on the mod for 2 days straight without saying "mmh maybe this could be generalized and moved in a library..."
