The above video goes away if you are a member and logged in, so log in now!

 Would you like to get all the newest Gaming News fromQJ.NET in your email each day? Want to learn more about the team who brings you the QJ news?

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; no prob man...

 Tweet
1. no prob man

2. Would this work?
Code:
```time = Timer:new()
score = 0

while true do

if time = time + 1 then
score = score + 5
end```
(i just wrote that)

3. Originally Posted by MaSt3r_ShAk3
Would this work?
Code:
```time = Timer:new()
score = 0

while true do

if time = time + 1 then
score = score + 5
end```
(i just wrote that)
nope that won't work. if I knew sorta what you were trying to accomplish I can try and help.

4. i dont think so because the timer is in miliseconds and the highest framerate is 60 fps so then time is never time+1 but more. you can also just use time as a variable and increment it by 1 each time it goes through the loop.

5. Originally Posted by Slasher
nope that won't work. if I knew sorta what you were trying to accomplish I can try and help.
I want it that every half second the score increases by 5

@altair- how would I do that? just put score = score + 1 at the bottom of the loop?

6. This would work:
Code:
```when true do

if time/1000=timeold/1000 +1 then
score = score + 5
end

"more code here"

timeold=time
end```
Notice: Put "timeold=time" at the end of the loop
BTW Maybe you need to make it like this:
Code:
`if time/1000>=timeold/1000 +1 then`
Because the loop is probably not precisely 1 second or a multiple of that. This wont affect the rest of the game because the timer will keep running so you still get 5 points per second. Hope thats clear

NVM the var-thing I didn't know you wanted to do that after each second

7. Ok.. would i do time = timer:new() before the loop? or store a nil value in time

8. yeah time = timer:new() before the loop. Also you should start the timer at the beginning of the game. SO maybe something like this:
Code:
```if start==false then
time:start()
start==true
end```

9. I get, Error: attempt to index global 'timer' (a nil value)...

10. ok i forgot i just used your code but its like this:
time=Timer.new()

11. i got this error whats rong?
C:\Documents and Settings\Mori\Desktop\lua \luaplayerwindows>luaplay er rock.lua
error: rock.lua:41: Argument error: The Controls functions take no arguments (an
d also, must be called with a colon from an instance: e g mycontrols:left().

12. show the rest of your code and atleast line 41

13. its the one you helped me w/

14. wtf??? this is annoying "error: Calling 'new' on bad self (number expected, got table)" its reffering to the time = Timer:new()

15. ah, ill hold off on score til the 2nd release

16. did you read my last post on that? Its on the bottom of the page before this.
I sain it should be:
time=Timer.new()

17. Yeah... I still got errors But I realized I do need it to increase speed every 10 seconds...
Code:
`Error: Calling 'new' on bad self (number expected, got table)`
its referring to the time = Timer:new()

18. its time=Timer.new() NOT time = Timer:new() note the point instead of the double colon

19. Ah, lemme try it out...

Error: Attempt to perform arithmetic on global 'time' (a userdata value)

20. i cant get a pause to work... what i would like is for ex

screenrint(10, 20, "BLALALALAL" color1)
-- Have it pause for x amount of time then play the next line

21. You have to add a screen.waitVblankStart() and put your delay in the (). Keep in mind 60 will have a 1 second delay

22. that is what did but it seems to add up all the time and have ya wait in the begining

23. Do you want the same interval between each string?

24. nope could that be why?

25. Well, if you wanted different intervals you would be putting screen.waitVblankStart() after every string. Then putting screen.flip() at the end... post ur code

26. k here it is:
----joke
white= Color.new(225,225,225)
screen.flip()
screenrint(10, 10, "Opening Flash0", white)
screen.waitVblankStart(12 0)
screenrint(10, 20, "Cant Open... Starting Brute Force", white)
screen.waitVblankStart(12 0)
screen.waitVblankStart(10 )
screenrint(10, 35, "980341809314789312489132 748913298478913", white)
screen.waitVblankStart(10 )
screenrint(10, 40, "324902023423043204023490 234023943204932", white)
screen.waitVblankStart(5)
screenrint(10, 50, "Flash0 Open.. Shuting Down will cuas a brick.", white)
screen.waitVblankStart(20 )
screenrint(10, 60, "Flash0:/vsh is being delited", white)
screen.waitVblankStart(60 )
screenrint(10, 70, "There you Go Pricked PSP", white)
screen.waitVblankStart(5)
screenrint(10, 80, "Enjoy By-By now", white)
screen.waitVblankStart(30 )
screen.flip()

27. Code:
```----joke
white= Color.new(225,225,225)

while true do

screen:print(10, 10, "Opening Flash0", white)
screen.waitVblankStart(120)
screen.flip()

screen:print(10, 20, "Cant Open... Starting Brute Force", white)
screen.waitVblankStart(120)
screen.flip()

screen.waitVblankStart(10)
screen.flip()

screen:print(10, 35, "9803418093147893124891327 48913298478913", white)
screen.waitVblankStart(10)
screen.flip()

screen:print(10, 40, "3249020234230432040234902 34023943204932", white)
screen.waitVblankStart(5)
screen.flip()

screen:print(10, 50, "Flash0 Open.. Shuting Down will cuas a brick.", white)
screen.waitVblankStart(20)
screen.flip()

screen:print(10, 60, "Flash0:/vsh is being delited", white)
screen.waitVblankStart(60)
screen.flip()

screen:print(10, 70, "There you Go Bricked PSP", white)
screen.waitVblankStart(5)
screen.flip()

screen:print(10, 80, "Enjoy By-By now", white)
screen.waitVblankStart(30)
screen.flip()

end```
try that...

28. no error it just does not show any thing

29. What?? That doesnt make sense...

30. there is no text on the psp it did not print to screen

Page 53 of 342 First ... 3 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 103 153 ... Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

All times are GMT -8. The time now is 07:39 AM.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY