forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to do something frequently ?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
justatest



Joined: 19 Dec 2005
Posts: 10

PostPosted: Mon Jan 09, 2006 5:25 pm    Post subject: how to do something frequently ? Reply with quote

i hope to do a thing in every 2 sec . or some how .

but lua seem have no interrupt etc . i read some codes . but still not get the meaning .

screen.waitVblankStart(4) seem some like this . some one pls give me some more detail ?
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Mon Jan 09, 2006 5:39 pm    Post subject: Reply with quote

screen.waitVblankStart(4) is a timer that halts all code for x ammount of time. Each numerical digit works in MS so if you wanted it to wait 2 seconds you would give it a timeout of 200(or 2000) depending on how long you wanted to wait. 200 I believe is 2 seconds.
Back to top
View user's profile Send private message
MikeHaggar



Joined: 18 Jul 2005
Posts: 116

PostPosted: Tue Jan 10, 2006 3:05 am    Post subject: Reply with quote

Um... VBlanking happens 60 times a second me thinks (60FPS/60Hz or whatever), so screen.waitVblankStart(120) would be 2 seconds?
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Tue Jan 10, 2006 3:13 am    Post subject: Reply with quote

Use system.sleep(x) function instead, x in milliseconds.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Tue Jan 10, 2006 12:28 pm    Post subject: Reply with quote

Waiting a specific time i always use a timer only because its far more relyable to do it that way vs halting everything going on.
Back to top
View user's profile Send private message
LordCthulu



Joined: 29 Dec 2005
Posts: 11

PostPosted: Wed Jan 11, 2006 12:10 am    Post subject: Reply with quote

Hey romero can you give me a quick example of using a timer like that?
I tried using a timer for animation but I couldn't get it to work. Thanks in advance ^^;
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Wed Jan 11, 2006 12:15 am    Post subject: Reply with quote

for a limitation do.. if timer:start() > 30 then
pretty much.. it limites that timer to 30ms .. giving you a fps based animation or etc.. timer:reset() resets the timer.. the rest of the information can be found on the wiki
Back to top
View user's profile Send private message
LordCthulu



Joined: 29 Dec 2005
Posts: 11

PostPosted: Wed Jan 11, 2006 8:52 am    Post subject: Reply with quote

Ok I was checking for something other than timer:start(), probably why. Thanks ^^;
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group