Page 1 of 1

yrest(xxx) question

Posted: Tue Aug 11, 2015 4:58 pm
by pugzilla
how long is a hours time if i use yrest(xxxx)

thanks!

Re: yrest(xxx) question

Posted: Tue Aug 11, 2015 5:02 pm
by Bill D Cat
Well, yrest(1000) is 1 second. So it would be 60 seconds * 60 minutes * 1000 = 3,600,000

Optionally, you can use player:rest(3600) which will rest for the same time, but will awaken and fight back if attacked.

Re: yrest(xxx) question

Posted: Tue Aug 11, 2015 6:10 pm
by pugzilla
ok thanks for the info

Re: yrest(xxx) question

Posted: Tue Aug 11, 2015 11:29 pm
by lisa
you can even use maths in the function itself

yrest(1000*60*60)

saves having to remember big numbers, only need to remember 1000 is for 1 second.

Re: yrest(xxx) question

Posted: Wed Aug 12, 2015 2:57 am
by BlubBlab
Yean but those a function that are already in MM1

Code: Select all

-- Convert hours to timer value
function hoursToTimer(hours)
	return math.floor( hours * 3600000 );
end

-- Convert minutes to timer value
function minutesToTimer(minutes)
	return math.floor( minutes * 60000 );
end

-- Converts seconds to timer value
function secondsToTimer(seconds)
	return math.floor( seconds * 1000 );
end