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; no because the dpad is not the triangle, square, circle, cross, l, r, start, select, home, note, screen, vol up, ...
-
05-02-2008, 03:35 AM #8551Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
no because the dpad is not the triangle, square, circle, cross, l, r, start, select, home, note, screen, vol up, vol down or analougue buttons it is the directional pad
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
05-02-2008, 05:25 AM #8552QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Yeah, sry turtlesPwN I didn't think of that last night, thanks for improving it
-= Double Post =-
By the way, i don't know if any of you have seen my post, but I am in need for some grafix artists,and/or a co programer for a Zelda game I'm working on in lua. PM me if your interested, or just reply on this threadGeändert von PSProgramer (05-02-2008 um 05:28 AM Uhr) Grund: Automerged Doublepost
-
05-02-2008, 02:28 PM #8553QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Umm, klepto, what exactly was wrong with how I did it, and what exactly did you fix? Nothing?
edit: oops typo what->wasGeändert von TurtlesPwn (05-03-2008 um 07:56 AM Uhr)
-
05-02-2008, 02:32 PM #8554Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
yeah like i said i would also like to add that people use the word pad and oldpad because it is quicker to do instead of typing the whole thing every time using Dpad just makes it take longer it has an extra letter and you have to press the shift key even if it was all in lowercse it would still be wrong because every button on the psp is not the Dpad it is the controls hence Controls.read() incase you didnt know Dpad stands for directional pad so all you managed to do was give some bad advice no offense
Zitat von FaT3oYCG
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
05-03-2008, 07:02 AM #8555
Thanks. For the fastest with anwser me. What abotu that one.
I'll want to creat a drum app. I wnt to load my sound and associate them to a name. Then I want to, if i push X, per exemple, play the sound associate to "kick" bu tonly once. Do u know how i have to do that.
I alerdy try but i wasn'n able.
-
05-03-2008, 07:57 AM #8556QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
If you can't figure that out, stop attempting to create anything. Besides, drum and soundboard apps have already been beaten to death.
-
05-03-2008, 10:33 AM #8557QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
look I am all against people putting don new programers for trying, but I might have to kinda agree with TurtlesPwn. I mean there are already a TON of drum and sound apps, so I mean unless you are like dead-set on making this, I would sugest making something else. But thats just me.
-
05-03-2008, 11:09 PM #8558Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
The point I was trying to make was that what you were doing was the same in concept as what the previous coder was doing. Your if conditional logic was slightly different, but nothing revolutionary. Your statement of his way being "horrible" got under my skin, since your method displayed nothing novel. Plus it was late and I was cranky.
Zitat von TurtlesPwn
-
05-04-2008, 04:47 AM #8559QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Alright, I have a question, hehe, How would I go about unbliting an object. Let me explain, I want like a coin on the screen right, so the character can collect it. I can do that part. But I want to have it disapear when the character walks over the coin. Also how can you put the coins randomly in a selected space like in only in a 100x100 invisible box?? thanx aton
-PSProgramer
-
05-04-2008, 06:04 AM #8560QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
My method was made to accomplish the same thing as his method, but he was using if pad:cross() and oldpad:cross() ~= pad:cross() then, which makes three function calls to the input data while only really needing two.
Zitat von KleptoOne
PSProgrammer - make a table with the items x, y, image, and a variable indicating whether it has been picked up. when it has not been picked up, blit it and check if the player is over it. then when it is picked up, stop blitting it and stop checking if the player is over it.
-
05-04-2008, 10:01 AM #8561QJ Gamer Blue
- Registriert seit
- Apr 2008
- Beiträge
- 497
- Points
- 4.268
- Level
- 41
- Downloads
- 0
- Uploads
- 0
thanx turtlesPwn
-
05-06-2008, 03:23 AM #8562
- Registriert seit
- Jan 2008
- Beiträge
- 8
- Points
- 2.761
- Level
- 32
- Downloads
- 0
- Uploads
- 0
What does the System.startOSK() function in LuaPlayerHM 6.x do? Does it start the sony OSK or some other one?
And if it uses the Sony, how do you use that OSK in a program?
-
05-06-2008, 07:43 AM #8563Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
PSProgramer-
It should work, I'm using this method On my PSP-SuperMarioBros. game to blit blocks :)Code:Coin_Start = 1 Coin_End = 2 Coin_1 = {} Coin_1.x = 10 Coin_1.y = 10 Coin_1.visible = "true" Coin_1.img = Coin Other Variables function Coin() for a = Coin_Start, Coin_End if Coin_1.visible = "true" then screen:blit(Coin_1[a].x, Coin_1[a].y, Coin_1[a].img) end end end Other Functions if Player.x == 10 and Player.y == 10 then Coin_1.visible = "false" end Other ENDING STUFF
remember to call the function
Code:Coin()
-
05-06-2008, 07:51 AM #8564Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Zitat von PSPMod999
then text_output is whatever the user typed soCode:text_output = System.startOSK("name1", "name2")
would show that text on the screenCode:screen:print(10, 10, text_output)
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
05-06-2008, 08:04 AM #8565Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I'm guessing name1 and name2 are variables?
-
05-06-2008, 08:46 AM #8566Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
no you have to put them in though otherwise it wont work i think that they are displayed when the osk is shown
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
05-06-2008, 11:14 AM #8567
I would do something like this instead;
Zitat von dan369
you could stick the row/col calcs inline and remove two local vars, i left it in as it helps explain what I am doing, but for non tutorial code I would do it as one line of code inside the screen:blit...Code:g_Coins = {} g_Coins[ (10 * 1000) + 10 ] = 1 other functions....... local i for i in pairs(g_Coins) do local col = i % 1000 local row = (i - col) / 1000 -- the subtraction stops turning it into decimals -- and removes need for math.floor etc -- unless your lua is compiled for integer numbers only screen:blit(row, col, Coin) end
to 'delete' a coin set its entry to nil like. also you would need to do screen bounds checking etc etc etc. setting something to nil deletes that entry in the table.
thus we just deleted the coin at row 10, column 13.Code:g_Coins[ (10 * 1000) + 13 ] = nil
Oh, the 1000 stuff is assuming 1000 columns per row. If your map is < 1000 tiles wide your safe :)
why are you using true and false as strings and not the built in lua constants?
Lua's tables are powerful. use them. I hope your Zelda game isn't full of the above type of coding, all those if statements and extra table entries like your coin example. Use the power of iterators and table hashes that lua gives you!
You could just abstract g_Coins into a generic table and have each row/col entry point to its sprite, eg:
Code:g_Overlays= {} g_Overlays[ (10 * 1000) + 10 ] = Mushroom g_Overlays[ (10 * 1000) + 11 ] = CoinSprite local i, sprite for i, sprite in pairs(g_Overlays) do screen:blit((i - (i%1000)) / 1000 , i % 1000 , sprite) end-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
05-06-2008, 11:56 AM #8568QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
The name1 and name2 are the text already in the osk display, and what it says on the osk. For example, "Type text here" and "Sony's OSK". Try it out and you'll see what I mean.
-
05-06-2008, 01:05 PM #8569Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
df - True, it's an alternate method using math. I don't use much math, i'll gunna take a look into using some
-
05-08-2008, 03:32 AM #8570
- Registriert seit
- Jan 2008
- Beiträge
- 8
- Points
- 2.761
- Level
- 32
- Downloads
- 0
- Uploads
- 0
Thx for the help, FaT3oYCG.
-
05-09-2008, 07:39 PM #8571
- Registriert seit
- Mar 2008
- Beiträge
- 40
- Points
- 2.784
- Level
- 32
- Downloads
- 0
- Uploads
- 0
can anyone help out?
I keep getting this error when using my program:
:8: '=' expected near 'button'
here is line 8:
Code:System.buttonPressed(1) If button == "yes" then UMD.ripISO("ms0:/ISO/9660.ISO") end
I read many tutorials and the functions.txt that came with luaplayerHM v6.6.
Can anyone help?
-
05-09-2008, 08:04 PM #8572words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Use the Lua Help Thread plz...
And you capitalized the 'If', make the I lowercase.
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
05-09-2008, 08:16 PM #8573
- Registriert seit
- Mar 2008
- Beiträge
- 40
- Points
- 2.784
- Level
- 32
- Downloads
- 0
- Uploads
- 0
sorry about the thread thing and i will try what u suggested.
Zitat von SG57
i forgot that LUA is case sensitive
-
05-09-2008, 08:18 PM #8574Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Lol, you're kidding? There's actually a LUAplayer function to rip an ISO?
I wonder what Shine would have thought about making that as easy as one line.
-
05-09-2008, 08:18 PM #8575words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
"Lua"? heh, now don't go thinking Lua's syntax is so unique ;)
Art - Personally, I'm losing more and more respect for Lua users by the update ;)
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
05-09-2008, 08:21 PM #8576
- Registriert seit
- Mar 2008
- Beiträge
- 40
- Points
- 2.784
- Level
- 32
- Downloads
- 0
- Uploads
- 0
thx!
It worked, now my program is 100% working now!!!
thanks for ur help!!!
Note: its not a bricker!
-= Double Post =-
there is, and it works 100%!!!
Zitat von Art
dumps really fast! used it may times and i all games have worked 100%!
btw luv ur time baby app, but i have a slim, so i use time machine and it works well!Geändert von omegaridley (05-09-2008 um 08:23 PM Uhr) Grund: Automerged Doublepost
-
05-09-2008, 08:31 PM #8577
- Registriert seit
- Mar 2008
- Beiträge
- 40
- Points
- 2.784
- Level
- 32
- Downloads
- 0
- Uploads
- 0
background
I want to make a background to my app insted of a black screen, how do I do so?
i need some codes, can anyone help out?
-
05-09-2008, 08:37 PM #8578QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
simply load whatever background image you want to use than have that be the first image you blit to the screen
i havent used lua in a long time so i don't remeber the load command but i do remeber the blit:
screen:blit(0, 0, bg) <--correct me if i'm wrong anyone
anyways bg is the image and simple google lua image loading commands, or go back a page or two in this thread until you see someone who has loaded an image1. 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
-
05-09-2008, 08:47 PM #8579Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Well mine wasn't as simple to code as:"Lua"? heh, now don't go thinking Lua's syntax is so uniqueI hated the idea of one on a forum. Now there can be hundreds of them.Code:RipISO(); // Please
Thanks. Funny I thought Time Machine would stuff up the graphics.btw luv ur time baby app, but i have a slim, so i use time machine and it works
-
05-09-2008, 09:18 PM #8580
- Registriert seit
- Mar 2008
- Beiträge
- 40
- Points
- 2.784
- Level
- 32
- Downloads
- 0
- Uploads
- 0
nvm i got it already, u were right though, thx for ur help!
Zitat von slicer4ever


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