timer

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

timer

Post by wekilledbambi03 »

how exactly do you create a timer? i know its in the list of functions, but once again i have to plead stupidity.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Suggest to study the tutorial at http://forums.ps2dev.org/viewtopic.php?t=3685
You might be able to use Timer class for your work. If you need more assitance, I (or others) will be happy to help.

Have fun!
Geo Massar
Retired Engineer
nevyn
Posts: 136
Joined: Sun Jul 31, 2005 5:05 pm
Location: Sweden
Contact:

Post by nevyn »

I just feel the need to say this: No one is stupid. You might be a complete n00b, your English might even suck big time, but you're not stupid. Know that you /can/ solve any problem on your own, given sufficient time to learn. This is one of my favorite quotes:
Aaron Hillegass in 'Cocoa Programming for Mac OS X' wrote:I have all sorts of people come to my class: the bright and the not so bright, the motivated and the lazy, the experienced and the novice. Regardless, the people who get the most from the class are always the ones who remain focused at the topic at hand.

The first trick to maintaining focus is to get enough sleep. I suggest ten hours of sleep each night while you are studying new ideas. Before dismissing this idea, try it. You will wake up refreshed and ready to learn. Caffeine is not a substitute for sleep.

The second trick is to stop thinking about yourself. While learning something new, many students will think, "Damn, this is hard for me. I wonder if I am stupid." Because stupidity is such an unthinkably terrible thing in our culture, the students will then spend hours constructing arguments that explain why they are intelligent yet are having difficulties. The moment you start down this path, you have lost your focus.

I used to have a boss named Rock. Rock had earned a degree in astrophysics from Cal Tech and never had a job where he used his knowledge of the heavens. Once I asked him if he regretted getting the degree. "My absurd degree in astrophysics has proved to be very valuable," he said, "Some things in this world are just hard. When I am struggling with something, I sometimes think, 'Damn, this is hard. I wonder if I am stupid,' and then I remember that I have a degree in astrophysics from Cal Tech; I must not be stupid."

Before going any further, assure yourself that you are not stupid and that some things are just hard. Armed with this silly affirmation and a well-rested mind, you are ready to conquer Cocoa.
haust
Posts: 25
Joined: Sat Oct 01, 2005 12:37 am
Location: France

Post by haust »

nevyn, thank.
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

Post by wekilledbambi03 »

i think there is a problem with my lua player. no matter what i try it says: attempt to index global "Timer" (a nil value). i even tried the led timer from the link KawaGeo gave me. i guess im not that stupid after all if its really a problem with lua. im using 11 by the way. anyone else have this problem?
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Strange, indeed.

The global "Timer" is supposed to be there in ver. 11.

It is time for Shine's gang to investigate the problem.

I agree NOBODY is stupid enough to be stupid. :)

Just a note: Windows version is not updated yet.
Geo Massar
Retired Engineer
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

Post by wekilledbambi03 »

was this problem in version 10? i know ive had them both. i cleared a bunch of stuff off of my memory stick. i may have pu on 10 instead of 11. ill have to check.
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

Post by wekilledbambi03 »

i think i figured it out. i was launching the .lua file from file assistant. it must have an older version of lua. i tried the lua player eboot and it worked. thanks though. now back to figuring out how to create a timer.
wekilledbambi03
Posts: 31
Joined: Sat Oct 15, 2005 10:56 am

Post by wekilledbambi03 »

could something like this be used to show the timer

Code: Select all

timer = Timer.new()
...
timer:start()
...
if x+75 == bx+3800 then
	timer:stop() end
...
screen:print(120, 213, timer, red)
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

"timer" is a created object. It returns meaningless. You need to say "timer:time()" which returns a value in milliseconds.

Happy coding :)
Geo Massar
Retired Engineer
Post Reply