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; Originally Posted by Grimfate126 hey youaresam, i dunt understand the math.ceil function much.. so howo can you do this? if ...

 Tweet
1. Originally Posted by Grimfate126
hey youaresam, i dunt understand the math.ceil function much.. so howo can you do this? if analog stik moves LEFT, the speed = speed-1 . if analog stik moves RIGHT, then speed = speed+1. thx!
math.ceil(number) returns the valuse put in, and if there is any decimal value, it goes up one. like:
5 would be 5
5.1 would be 6
5.7 would be 6
8 would be 8
8.4 would be 9

I just came up with a formula that would return 1 or -1 based on if the number was positive or negative. Yeah, its a bit confusing, but it should work.

2. Originally Posted by bronxbomber92
can any explain how i could ask a question in my lua game? i am gonna be making a trivia game (no details) and for example i might wanna ask "who is the president of the U.S." then i would give for options for an answer (mutiple choice) so i would be like "a- george bush, b-clinton, c- bob villa, d- Bronxbomber92" can any1 help me out with this? thanks
look at PSPMillionaire,, that show you what you want

3. Originally Posted by youresam
math.ceil(number) returns the valuse put in, and if there is any decimal value, it goes up one. like:
5 would be 5
5.1 would be 6
5.7 would be 6
8 would be 8
8.4 would be 9

I just came up with a formula that would return 1 or -1 based on if the number was positive or negative. Yeah, its a bit confusing, but it should work.
can u tell me the code pls?

4. Originally Posted by youresam
I'll help you out tomorrow after school, what exactly do you want it to do?
i want do make one text appear with out delay , and then make another text appear but with a seperate group so i need to put screen.flip again etc or make it with the same group
I think i missing a code that is not at http://wiki.ps2dev.org/psp:lua_player:functions

5. Originally Posted by Grimfate126
can u tell me the code pls?
what do want the "code" to do? your question makes no sense because wtf is a code?!!

6. Originally Posted by natan333
i want do make one text appear with out delay , and then make another text appear but with a seperate group so i need to put screen.flip again etc or make it with the same group
I think i missing a code that is not at http://wiki.ps2dev.org/psp:lua_player:functions
Ok...
Here, this will display "Hello", then if you press cross, it will say "Goodbye" for 1 second.

green = Color.new(0,255,0)
while true do
screen:clear()
screen:print(10,10,"Hello ",green)
screen:clear()
screen:print(10,10,"Goodb ye",green)
screen.flip()
screen.waitVblankStart(60 )
end
screen.waitVblankStart()
screen.flip()
end

And, yes, the tutorial Shine wrote has everything you need. Back when I learned, Shines tutorials were half way done! (And of course, there were NO other LuaPlayer tutorials what-so-ever)

7. Originally Posted by siqq
what do want the "code" to do? your question makes no sense because wtf is a code?!!
im sorry. :Cry: :Cry:

my codeso far)

Code:
```speed = 0

if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
end
end```
i want it so that when the analog stik goes LEFT, the speed will decrease, and when it goes RIGHT, the speed will increase.

thx for ur help(yoursam), and sry for pissing u off(sigg)

8. Originally Posted by Grimfate126
im sorry. :Cry: :Cry:

my codeso far)

-code-

i want it so that when the analog stik goes LEFT, the speed will decrease, and when it goes RIGHT, the speed will increase.

thx for ur help(yoursam), and sry for pissing u off(sigg)
I already showed you my formula.

height = height + math.ceil(1/dx)

Modify it to your needs. Basically, if dx is positive, it adds 1 to height. if its negative, it subtracts 1 from height.

OR if you want to add or subtract more, just put a number at the end. For example, to add or subtract 4, do this:

height = height + math.ceil(1/dx)4

9. im new to lua but i do know javascript and you forgot to declare 2 of your variables cursorx and cursory

10. Originally Posted by siqq
im new to lua but i do know javascript and you forgot to declare 2 of your variables cursorx and cursory
that was just PART of my code.;) i have already defined the varibles. and thx yoursam!

11. Originally Posted by youresam
I already showed you my formula.

height = height + math.ceil(1/dx)

Modify it to your needs. Basically, if dx is positive, it adds 1 to height. if its negative, it subtracts 1 from height.

OR if you want to add or subtract more, just put a number at the end. For example, to add or subtract 4, do this:

height = height + math.ceil(1/dx)4
hey. i tried this:
Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
speed = speed+math.ceil(1/dx)
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
end
end```
but it only ADDS 1 to speed when i move RIGHT, and does nothing when i move left. wtf?? sry, i know im really n00bish, and ty for being patient with me, but i have no idea how to make this work.

BTW: i have deifned all my variables.

12. Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
speed = speed+math.ceil(1/dy)
end
end```
Umm.. what is the variable you want to change? You dont have a formula in there...

13. Originally Posted by youresam
Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
speed = speed+math.ceil(1/dy)
end
end```
Umm.. what is the variable you want to change? You dont have a formula in there...
i want to change speed. everything else works fine, but when i move the analok stick right, it add to the speed, BUT when i move it left, it does nothing to the speed.

14. Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
speed = speed+math.ceil(1/dx)
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
speed = speed+math.ceil(1/dy)
end
end```
like that?

15. Originally Posted by youresam
Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
speed = speed+math.ceil(1/dx)
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
speed = speed+math.ceil(1/dy)
end
end```
like that?
if i do that, then when i move the analog stick right, it add 1 and if i move it down, it also adds 1. BUT what i want, is this:

if analog stick moves right, then speed increases, if i move it left, then speed decreases.

16. Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
speed = speed+ math.ceil(dx/128)
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
end
end```
Whoops, I had my formula wrong, sorry. This will add or subtract 1.
Or, if you want it to be the more you push the analog, the faster it moves, just use speed = speed + (dx/64)

17. hello ever1 well if havent seen i've been working on a game: pspaintball and recently released v 0.1 so i want to implement wifi within the next few versions and i remeber a while back seeing sometin about lua wifi libary's now then heres my question:

A: fanjita got wifi for lua to work in 2.1+ correctly?
B:are there any tut's yet made for how to implement wifi into lua
C: if so where
D:anyway to check if it works or not as of i don't have a wifi connection spot

18. Originally Posted by youresam
Code:
```if math.abs(dx) > 32 then
cursorx = cursorx + dx / 64
dudex = dudex + dx/64
speed = speed+ math.ceil(dx/128)
end

if math.abs(dy) > 32 then
cursory = cursory + dy / 64
dudey = dudey + dy/64
end
end```
Whoops, I had my formula wrong, sorry. This will add or subtract 1.
Or, if you want it to be the more you push the analog, the faster it moves, just use speed = speed + (dx/64)

thx! tat worked!

19. offtopic --
grim i read your sig sorry but not sure what h2so4 it is?

--sorry bout offtopicness

20. Originally Posted by slicer4ever
offtopic --
grim i read your sig sorry but not sure what h2so4 it is?

--sorry bout offtopicness
h2so4 = sulfuric acid.

21. ok well anywho can any1 answer my question?

22. Sure. Dont make it online.

Any more questions?

23. hello ever1 well if havent seen i've been working on a game: pspaintball and recently released v 0.1 so i want to implement wifi within the next few versions and i remeber a while back seeing sometin about lua wifi libary's now then heres my question:

A: has fanjita got wifi for lua to work in 2.1+ correctly?
B:are there any tut's yet made for how to implement wifi into lua
C: if so where
D:anyway to check if it works or not as of i don't have a wifi connection spot
i was asking if some people could direct me to where i could learn this stuff i at least arg never mind this is surpose to be a help thread and yea you apparently can't help

24. A.fanjita HAS got wifi to wor for lua, i think it saeemed to for me and im 2.6
B. You dont need tut's, get netlib.
C. search the dl section for netlib
D. Thats dumb you cant check if it works then unless you get some beta tester's which you'd need to anyway.
E. Of course you could also use infrared....

25. Originally Posted by Glynnder- PSPro
A.fanjita HAS got wifi to wor for lua, i think it saeemed to for me and im 2.6
B. You dont need tut's, get netlib.
C. search the dl section for netlib
D. Thats dumb you cant check if it works then unless you get some beta tester's which you'd need to anyway.
E. Of course you could also use infrared....
I also have a small question redgarding wifi .
I wanna implent 2 Player into a certain game,
BUT i dont have 2 PSP's and neither doe's my friend.
I Do however have WifiMax if that can help??

Sorry i just woke up .

26. if you have one psp and ur frend has on psp then borrow it.

either that or get a beta tester with 2 psp's to test it 4 ya!

27. Originally Posted by Glynnder- PSPro
if you have one psp and ur frend has on psp then borrow it.

either that or get a beta tester with 2 psp's to test it 4 ya!
Why o why did my friend update ...
he doesn't even have GTA .
I guess i will need to get some beta testers.
Also is there a way Lua can verify the psp's mac address?
or anything so i can check that its on a certain psp.
If not then thats okay as i can do it in C anyways ...

28. Originally Posted by youresam
Hey guys, I got a quick question. (And, whoever helps me with this scores a cool 500 points)

I need to know more about object orientation, and maybe an example on how to use the variable "self". And whats a metatable?
Ok I have never used this, but this guy is pretty good with LUA i might say, here's a tut about classes and metatables and other stuff:
http://lordlaurin.lo.funpic.de/devbo....php?p=457#457

Hope that helps.

29. when did youresame say that.

And sorry c5cha but i cnt help u on that, i dont think there is.

30. can any1 help me out and tell me wat this error is? error: script.lua:41: <eof> expected near `end'

it came up when i tried using windows lua player...

Page 59 of 342 First ... 9 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 109 159 ... 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 10:14 AM.

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