Page 2 of 2

Re: Selecting a random character

Posted: Fri Mar 29, 2013 1:34 am
by Grimfan
The script is very simple. It's basically just like the one above with a hudPrint ("One of your party members has been sucked into the crystal") and sound ("party_crushed") attached to it, however here's the interesting point:

The script is within Diarmuid's and Neikun's extensive crystalHandler script and basically changes the properties of one of their crystals from the normal party:heal to the script already mentioned (note that their script does not using grimq a far as I can tell). Now could it be that the onClick function of the crystals (is a crystal clicked by all party members simultaneously?) or something similar about their construction is causing the script to fail if there are any dead characters (it crashes preview mode)?

Mmmm...

Any ideas guys?

Re: Selecting a random character

Posted: Fri Mar 29, 2013 1:43 am
by Xanathar
If it's a crash i know the solution .. grab the last version I fixed that bug last week :)

Re: Selecting a random character

Posted: Fri Mar 29, 2013 1:48 am
by Grimfan
Well if it's a bug it means that JKos hasn't updated his framework to your new version. If he has then something else is going on.

Re: Selecting a random character

Posted: Fri Mar 29, 2013 2:07 am
by Grimfan
Just updated (replacing version 1.2 for 1.4.1) and got this error:

mod_assets/framework/module/grimq.lua:48 attempt to call global 'print' (a nil value).

It seems to be referring to this code:

Code: Select all

function _log(level, prefix, text)
	if (level <= LOG_LEVEL) then
		print(prefix .. LOG_PREFIX .. text)
	end
end
If I set the LOG_LEVEL to -1 (no info) it works (I expected as much), but setting the LOG_LEVEL to anything else gives me the error.

Re: Selecting a random character

Posted: Fri Mar 29, 2013 3:16 pm
by Xanathar
Hi Grimfan,
congratulations on your problem solving skills! Yes changing the log level should do the trick. What you are seeing is probably a consequence of grimq being called from the framework, when print is not yet bound to a function by the engine. When I get back from holydays I'll make an install with just the framework and grimq and try debug it.

Anyway, glad you solved it :)

I would suggest doing something similar to:

Code: Select all

local champs = grimq.fromAliveChampions()

if (champs:count() > 1) then
	champs:random():setEnabled(false)
	hudPrint("Four little Soldier Boys going out to sea; A red herring swallowed one and then there were three.")
else
	hudPrint("One little Soldier Boy left all alone; He went out and hanged himself and then there were none.")
	grimq.gameover();
end
This should solve all issues you can have with previously disabled and dead champs (and shows you also how "count" works :) plus a lame excuse to cite some great book).

Re: Selecting a random character

Posted: Sat Mar 30, 2013 1:04 am
by Grimfan
While my workaround fixed that problem Xanathar as soon as I start preview mode the game crashes. Now I think it has to be a compatibility issue between your new version of grimq and JKos current framework or another piece of script I'm running (note that I simply replaced version 1.2 with version 1.4.1).

Thanks for your help thus far Xanathar. As soon as I've finished testing my dungeon I'll hopefully release it and get your treasure chests on show! :)

Re: Selecting a random character

Posted: Fri Apr 05, 2013 5:51 pm
by Xanathar
I fixed that issue in the new version (see its thread).. too late I think :) but thanks for the report :)