Page 2 of 2

Re: Need help understanding timers and counters.

Posted: Wed Sep 19, 2012 11:40 pm
by sevenbirds
Hello everyone,

I just wanted to chime in and say that this worked wonderfully. I implemented this in a maze full of ogres and had a friends test it out. It really got him sweating! Thanks for creating awesome posts guys.

Re: Need help understanding timers and counters.

Posted: Thu Sep 20, 2012 1:46 am
by Komag
sounds great - it's always good news to hear something works the right way!

Re: Need help understanding timers and counters.

Posted: Sat Sep 22, 2012 5:44 pm
by davehca
Grimwold wrote:Awesome! Thanks for the quick reply. Somehow I missed the getValue hook when reading the reference.

I had to make one change to your script to get it to work, as hudPrint was expecting a string.

Code: Select all

function printTime()
  hudPrint(tostring(time_01:getValue()))
end
I couldn't get this to work. I created a timer; timer_1 is it's ID in the Inspector. Reading the above, I tried

hudPrint(tostring(timer_1:getValue()))

but it returns "attempt to call method 'getValue' (a nil value)"

So what I am doing wrong?

Re: Need help understanding timers and counters.

Posted: Sat Sep 22, 2012 6:34 pm
by Montis
What you're doing wrong is that timers don't have a getValue() method. Grimwold was referring to "time", which was a counter.

http://www.grimrock.net/modding/scripting-reference/

Re: Need help understanding timers and counters.

Posted: Sat Sep 22, 2012 6:42 pm
by davehca
[quote="Montis"]What you're doing wrong is that timers don't have a getValue() method. Grimwold was referring to "time", which was a counter.

d'oh! :oops:

Thanks.