Global gtime
on enterframe
gTime = _system.time()
end
on exitframe
if gTime = _system.time() then
go to the frame
else
go to frame 2
end if
end
On enter frame I have it look at the clock and on exit frame if it is
different then it rotates the buttons on the next frame(2). How can I get this
code to ignore the minutes and only look at the hour? So again it will only go
to the next frame when it sees an hour change and not minute change.
Thanks
-Lars
on getHour()
tOldItem = _player.itemDelimiter
_player.itemDelimiter = ":"
tTime = _system.time()
if tTime.item[2].word[2] = "PM" then
tTime = integer(tTime.item[1]) + 12
else
tTime = integer(tTime.item[1])
end if
_player.itemDelimiter = tOldItem
return tTime
end
AstrO wrote:
> You could use soemthing like this:
>
> on getHour()
> tOldItem = _player.itemDelimiter
> _player.itemDelimiter = ":"
> tTime = _system.time()
> if tTime.item[2].word[2] = "PM" then
> tTime = integer(tTime.item[1]) + 12
> else
> tTime = integer(tTime.item[1])
> end if
> tTime = integer(tTime.item[1]) + tMod
> _player.itemDelimiter = tOldItem
> return tTime
> end
>
> The above will return the hour as an integer.
>
> AstrO
on getHour()
tOldItem = _player.itemDelimiter
_player.itemDelimiter = ":"
tTime = _system.time()
if tTime.item[2].word[2] = "PM" then
tTime = integer(tTime.item[1]) + 12
else
tTime = integer(tTime.item[1])
end if
tTime = integer(tTime.item[1]) + tMod
_player.itemDelimiter = tOldItem
return tTime
end
The above will return the hour as an integer.
AstrO
Thanks for the help
-Lars
property pTimer, pDelay
on beginSprite
pDelay=60*60*1000 -- 60min*60sec*1000ms
pTimer=the milliseconds
end beginSprite
on exitFrame
if the milliseconds-pTimer>=pDelay then
pTimer=the milliseconds
-- one hour is up
end if
end exitFrame
Andrew
You can use the itemDelimiter to parse filenames by setting
itemDelimiter to a backslash (\) in Windows or a colon (:) on the
Macintosh. Restore the itemDelimiter character to a comma (,) for normal
operation.
/end
What the itemDelimiter lets me do is access a section of the
_system.time() string. By default the itemDelimiter is ',' and if I
wanted to get item 2 of this string '1234,32,435,2123,564' it would
return '32'. In out case I've set the itemDelimiter to ':' so that I can
get the hour and min of the time string which looks something like this
'3:24 PM'. When I ask for item 1 it returns this '3' when I ask for item
2 it returns this '24 PM'. Just for note word 2 of the time string
should always be either 'PM' or 'AM' so it's easy to convert 12 hour
time into 24 hour.
I hope this is what you were looking for.
AstrO
So again, thanks for breaking it down for me. I did read the help file but
didn't uderstand it to well, your breakdown helped. I looked at the timer idea
but I already have a timer running. I don't know if you can have 2 timers
running at the same time. At this point I don't need to turn it into military
time since it seems like your code will work.
thanks again, Lars