Page 1 of 1

[1.0.0] Clock

Posted: Mon Feb 18, 2013 6:43 am
by lukep
This adds a clock to the game in the Minimalist UI, that tracks turns, global speed, attack/move/spell/mind/summon speeds, and can calculate how much stuff you can do before timed effects tick down again (and other turn based stuff happens). Based on this thread.

Download Link

Credits: a fairly large majority of the code in this came from Zizzo's Online Indicator addon. I hope that they don't clash, since they share so much code.

Re: [1.0.0] Clock

Posted: Mon Feb 18, 2013 12:38 pm
by jotwebe
Nice!

It seems to work with the OldRPG tileset's OldWood GUI.

Re: [1.0.0] Clock

Posted: Mon Feb 18, 2013 11:27 pm
by jenx
Excellent. Using it I stumbled upon a bug I think: http://forums.te4.org/viewtopic.php?f=42&t=36875

Using gauntlets increases attack energy required by 10%.

Re: [1.0.0] Clock

Posted: Tue Feb 19, 2013 1:13 am
by lukep
I really need to find a way of choosing the proper weapon for the attack time calculation. It's a bug here, not in the game.

Re: [1.0.0] Clock

Posted: Tue Feb 19, 2013 1:39 am
by Zizzo
lukep wrote:Credits: a fairly large majority of the code in this came from Zizzo's Online Indicator addon. I hope that they don't clash, since they share so much code.
Oh dear. Online Indicator was a monstrous hack, and people are reusing it? :oops: [sound F/X: source diving] Ah, I see, Clock is basically just Online Indicator with its tooltip replaced with yours. Yeah, those will probably step on each other's toes, then; even apart from the potential problems with multiple addons superloading the same method, it would be a matter of which addon ended up in control of the tooltip hotzone.

Re: [1.0.0] Clock

Posted: Tue Feb 19, 2013 2:33 am
by lukep
Well...it still beats my first few attempts, hijacking the activation for the orb of scrying, trying (and failing) to get a new item made and added at birth, and then hijacking the description of the "attack" talent. The dialogue is quite easy to move anywhere, it's just finding a good place to put it that's the issue.

EDIT: Actually, I may end up moving it, the mouseover of your character in the UI looks like a decent place.

Re: [1.0.0] Clock

Posted: Tue Feb 19, 2013 10:30 am
by jenx
lukep wrote:I really need to find a way of choosing the proper weapon for the attack time calculation. It's a bug here, not in the game.
Is the following routine from Archery.lua the sort of thing you need?

Code: Select all

--- Check if the actor has a bow or sling and corresponding ammo
function _M:hasArcheryWeapon(type)
	if self:attr("disarmed") then
		return nil, "disarmed"
	end

	if not self:getInven("MAINHAND") then return nil, "no shooter" end
	if not self:getInven("QUIVER") then return nil, "no ammo" end
	local weapon = self:getInven("MAINHAND")[1]
	local ammo = self:getInven("QUIVER")[1]
	if self.inven[self.INVEN_PSIONIC_FOCUS] then
		local pf_weapon = self:getInven("PSIONIC_FOCUS")[1]
		if pf_weapon and pf_weapon.archery then
			weapon = pf_weapon
		end
	end
	if not weapon or not weapon.archery then
		return nil, "no shooter"
	end
	if not ammo then
		return nil, "no ammo"
	else
		if not ammo.archery_ammo or weapon.archery ~= ammo.archery_ammo then
			return nil, "bad ammo"
		end
	end
	if type and weapon.archery ~= type then return nil, "bad type" end
	return weapon, ammo
end

Re: [1.0.0] Clock

Posted: Tue Feb 19, 2013 11:06 pm
by lukep
Yes, but currently I would need to do self:hasArcheryWeapon(), self:hasDealWeapon()... self:hasXXXWeapon() if I want all of the bases covered. There isn't a generic _M:hasWeapon() that I could find.

Re: [1.0.0] Clock

Posted: Sat Jun 07, 2014 1:33 pm
by Zireael
Does this work with 1.1.5 or 1.2.0?

Re: [1.0.0] Clock

Posted: Tue Jun 10, 2014 5:38 am
by Waladil
Just so you know, Zirael, the Chronometer addon does still work fine as of 1.2.1. I don't know if that's the same addon with a different name or a completely different addon with the same goal, but I see you asked about that on it's own addon page (I was gonna link you to it but I guess you already found it :P).

In fact, I sometimes consider "adopting" the Chronometer by re-releasing it as a 1.2.1 addon -- I don't think any of the original coders are still active, and I wouldn't claim to have any credit to the code of it. Just to get it up higher on the addons list and on Steam Workshop.

Re: [1.0.0] Clock

Posted: Wed Mar 25, 2015 2:27 am
by Morikal
My clock is placed in the very lower right hand corner, underneath the un-movable UI elements (the ones to lock/unlock UI elements, show game log, etc).

Is there a way to move it?