[Library] - GrimQ - v1.4.3

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.3.

Post by Xanathar »

Hope they help - I don't have a personal tester :lol: so I'm not 100% confident there are no bugs (who is ?). The linq part is covered by unit tests, but the grimrock specific parts aren't yet.. :( so if you find anything wrong tell me :)

And I'm really curious about that transfer, it will be very helpful! Great work
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.3.

Post by Xanathar »

I just noticed now: the download link was wrong!

here it is :

http://code.google.com/p/lualinq/downlo ... -1.3.2.zip
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

[Library] - GrimQ - v1.4.1

Post by Xanathar »

Version 1.4.1 of this thing is up:
  • GrimQ: NEW: moveItem and moveItemFromFloor to automagically move an item around
  • GrimQ: NEW: partyGainExp(amount) function
  • GrimQ: NEW: shuffleCoords(..) to generate "almost-random" numbers from a set of coordinates
  • GrimQ: NEW: randomReplacer to replace all instances of an object with another chosen at random
  • GrimQ: NEW: decorateWalls and decorateOver to automatically insert decorations in dungeons
  • GrimQ: NEW: auto_onStep and auto_onStepOnce autos in scripting entities
  • GrimQ: automatic patch for allEntities bug in game engine (defaults at true) - thanks MarbleMouth!
  • GrimQ: loadItem support restoring ids of items in containers
  • GrimQ: fromAllEntitiesInWorld supports a where predicate in the function itself for optimizations
  • GrimQ: autoprinters support overriding the function to use as hudPrint
  • GrimQ: version check *SHOULD* work now. Or not, who knows ?
  • GrimQ: fromAliveChampions() fixed
  • GrimQ: fromEntitiesForward(),fromEntitiesInArea() and fromEntitiesAround() TONS of bugs fixed
  • GrimQ: moveFromFloorToContainer and moveItemsFromTileToAlcove now preserve ids
  • GrimQ: optimizations in find and getEx


Apart from the bug fixes of a lot of functions, the biggest new entries are:

Patching for allEntities bug
Just use grimq.fromAllEntities(level).
Thanks marblemouth! :) (even if the grimq code doesn't use your iterator in the latest ver)
Thanks Komag :)


moveItem and moveItemFromFloor
These are like spawn, except that they copy and move an existing item preserving the id

id preservation
For a lot of things like loadItem etc. there is the possibility of restoring the id

auto_onStep and auto_onStepOnce
Just put a function named auto_onStep in a scripting entity and everytime the party steps on it, it gets executed. auto_onStepOnce does the same except only the first time. Yes, I'm that lazy.

decorateWalls and decorateOver
Because I'm that lazy, you can write a script like:

Code: Select all

function autoexec()
	local t = {
		"",
		"",

		"dungeon_ceiling_root_1",
		"dungeon_ivy_1",
		"dungeon_ivy_2",
		{"dungeon_ivy_1", "dungeon_ivy_2"},
		{"dungeon_ivy_1", "dungeon_ceiling_root_1"},
		{"dungeon_ivy_1", "dungeon_wall_dirt_1"},	
		{"dungeon_ivy_2", "dungeon_ceiling_root_1"},
		{"dungeon_ivy_2", "dungeon_wall_dirt_2"},
		"dungeon_wall_dirt_1",
		"dungeon_wall_dirt_2",
	}

	grimq.decorateWalls(self.level, t, false)
end
in a level to automatically put those boring decorations.

Download at http://code.google.com/p/lualinq/downlo ... _1.4.1.zip
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.4

Post by Diarmuid »

woohooooooo auto-OnStep. I had that manually implemented in all sorts of places, glad to have a standardized solution. (Ok, standard to 3 people, lol).

it's the kind of thing that should have been in the editor from the start.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.4

Post by Xanathar »

I had that manually implemented in all sorts of places
Good to know I'm not the only lazy one who cannot stand putting a pressure plate every time!! :lol:
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.4

Post by Diarmuid »

Well script entities make great placeholders for stuff, as they only exist in the logical domain and don't have a physical GameObject / Entity existance as far as I know.

For this new GrimQ, if I want to integrate it into the ORRR2, i just replace grimq.lua inside framework/modules?

Oh, and you HAVE to do a room... just a quick one! We're still missing 6 designers. ;)
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.4

Post by Xanathar »

I think you can just put a scripting entity named grimq in the mod and it will override the one included into jkos fw :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [Library] - GrimQ - a query library for Grimrock - v1.4

Post by Xanathar »

Version 1.4.3 released.

It fixes the integration with JKos framework. - Thanks to Grimfan for reporting this issue :)

If you are using GrimQ AND the JKos framework, now you can simply create a scriptingentity in the game called grimq with the new sources, set USE_JKOS_FRAMEWORK to true in the grimq script and it will work (plus, if you forget to set USE_JKOS_FRAMEWORK, it will alert you with an error message).

Also, a quick note to those who use autohooks - the documentation suggested you to do a wrong thing :oops: sorry.

Let's say you have this:

Code: Select all

function _onMove()
	print("onMove")
end
to be called when the party moves.

OK:

Code: Select all

autohook =
{
	party =
	{
		onMove = _onMove,
	}
}

Also OK:

Code: Select all

autohook =
{
	party =
	{
		onMove = function(self, whatever) my_scripting_entity._onMove(); end,
	}
}
NOT OK (causes reloads to crash):

Code: Select all

autohook =
{
	party =
	{
		onMove = function(self, whatever) _onMove(); end,
	}
}
Sorry for this :)


Download link:
http://code.google.com/p/lualinq/downlo ... _1.4.3.zip

Edit: edited quickly to fix an issue with 1.4.2 where there was a small backward compatibility break. Meh.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Post Reply