Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von Grimfate126 hey youaresam, i dunt understand the math.ceil function much.. so howo can you do this? if analog ...
-
04-20-2006, 12:31 PM #1741
math.ceil(number) returns the valuse put in, and if there is any decimal value, it goes up one. like:
Zitat von Grimfate126
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.
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 12:56 PM #1742<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
look at PSPMillionaire,, that show you what you want
Zitat von bronxbomber92
-
04-20-2006, 01:02 PM #1743Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
can u tell me the code pls?
Zitat von youresam
--------------------------------------------------------------------------------------
-
04-20-2006, 01:11 PM #1744
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
Zitat von youresam
I think i missing a code that is not at http://wiki.ps2dev.org/psp:lua_player:functions
please write a code
Bequiet!!!
I'm learning cc©cc
-
04-20-2006, 01:58 PM #1745
- Registriert seit
- Apr 2006
- Ort
- Bay Area, California
- Beiträge
- 26
- Points
- 4.133
- Level
- 40
- Downloads
- 0
- Uploads
- 0
what do want the "code" to do? your question makes no sense because wtf is a code?!!
Zitat von Grimfate126
-
04-20-2006, 02:07 PM #1746
Ok...
Zitat von natan333
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)
pad = Controls.read()
if pad:cross() then
screen:clear()
screen:print(10,10,"Goodb ye",green)
screen.flip()
screen.waitVblankStart(60 )
end
if pad:start() then break 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)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 02:07 PM #1747Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
im sorry. :Cry: :Cry:
Zitat von siqq
my code
so far)
i want it so that when the analog stik goes LEFT, the speed will decrease, and when it goes RIGHT, the speed will increase.Code:speed = 0 pad = Controls.read() dx = pad:analogX() dy = pad:analogY() if math.abs(dx) > 32 then cursorx = cursorx + dx / 64 end if math.abs(dy) > 32 then cursory = cursory + dy / 64 end end
thx for ur help(yoursam), and sry for pissing u off(sigg)--------------------------------------------------------------------------------------
-
04-20-2006, 02:09 PM #1748
I already showed you my formula.
Zitat von Grimfate126
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)4Geändert von youresam (04-20-2006 um 02:14 PM Uhr)
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 02:14 PM #1749
- Registriert seit
- Apr 2006
- Ort
- Bay Area, California
- Beiträge
- 26
- Points
- 4.133
- Level
- 40
- Downloads
- 0
- Uploads
- 0
im new to lua but i do know javascript and you forgot to declare 2 of your variables cursorx and cursory
-
04-20-2006, 03:16 PM #1750Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
that was just PART of my code.;) i have already defined the varibles. and thx yoursam!
Zitat von siqq
--------------------------------------------------------------------------------------
-
04-20-2006, 03:42 PM #1751Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hey. i tried this:
Zitat von youresam
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.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

BTW: i have deifned all my variables.Geändert von Grimfate126 (04-20-2006 um 03:45 PM Uhr)
--------------------------------------------------------------------------------------
-
04-20-2006, 03:45 PM #1752
Umm.. what is the variable you want to change? You dont have a formula in there...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牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 03:49 PM #1753Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
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.
Zitat von youresam
--------------------------------------------------------------------------------------
-
04-20-2006, 03:58 PM #1754
like that?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牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 04:17 PM #1755Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
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:
Zitat von youresam
if analog stick moves right, then speed increases, if i move it left, then speed decreases.--------------------------------------------------------------------------------------
-
04-20-2006, 04:44 PM #1756
Whoops, I had my formula wrong, sorry. This will add or subtract 1.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
Or, if you want it to be the more you push the analog, the faster it moves, just use speed = speed + (dx/64)牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 05:26 PM #1757QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
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
E: thats about it=-)1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
04-20-2006, 05:32 PM #1758Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von youresam
thx! tat worked!--------------------------------------------------------------------------------------
-
04-20-2006, 05:34 PM #1759QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
offtopic --
grim i read your sig sorry but not sure what h2so4 it is?
--sorry bout offtopicness1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
04-20-2006, 05:44 PM #1760
h2so4 = sulfuric acid.
Zitat von slicer4ever
grim: glad it works!牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 05:50 PM #1761QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
ok well anywho can any1 answer my question?
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
04-20-2006, 06:03 PM #1762
Sure. Dont make it online.
Any more questions?牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 11:19 PM #1763QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
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 helphello 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
E: thats about it=-)1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
04-20-2006, 11:35 PM #1764is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
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....What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-21-2006, 12:08 AM #176511th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
I also have a small question redgarding wifi
Zitat von Glynnder- PSPro
.
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
.
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-21-2006, 12:59 AM #1766is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
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!What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-21-2006, 01:36 AM #176711th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Why o why did my friend update
Zitat von Glynnder- PSPro
...
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
...
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-21-2006, 03:58 AM #1768
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:
Zitat von youresam
http://lordlaurin.lo.funpic.de/devbo....php?p=457#457
Hope that helps.LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-21-2006, 07:43 AM #1769is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
when did youresame say that.
And sorry c5cha but i cnt help u on that, i dont think there is.What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-21-2006, 10:12 AM #1770sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
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...


LinkBack URL
About LinkBacks
Mit Zitat antworten


Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum