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; I am trying to get TP's tutorial in the GDI thread for 3D to work, but it's not. Here is ...
-
07-10-2007, 04:59 PM #7651QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I am trying to get TP's tutorial in the GDI thread for 3D to work, but it's not. Here is the code:
What's wrong with that? I'm interested in learning some 3D but I can't if I'm stuck here! Thanks for any help.Code:red = Color.new(255,0,0) pad = Controls.read() while true do Gu.start3d() Gu.clearDepth(0); Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT) Gum.matrixMode(Gu.PROJECTION) Gum.loadIdentity() Gum.perspective(50, 16/9, 0.5, 1000) Gum.matrixMode(Gu.VIEW) Gum.loadIdentity() walls = { {red, 3, -2, 4}, {red, 2, -2, 5}, {red, 2, -2, 5}, {red,-1,1,-1}, {red,-1,0,-1}, {red,-1,0,3}, {red,-1,1,-1}, {red,-1,0,3}, {red,-1,1,3}, {red,-1,1,3}, {red,-1,0,3}, {red,-1,0,6}, {red,-1,1,3}, {red,-1,0,6}, {red,-1,1,6}, {red,-1,1,6}, {red,-1,0,6}, {red,-1,0,10}, {red,-1,1,6}, {red,-1,0,10}, {red,-1,1,10}, {red,10,0,3}, {red,10,0,-1}, {red,10,1,-1}, {red,10,1,3}, {red,10,0,3}, {red,10,1,-1}, {red,10,0,6}, {red,10,0,3}, {red,10,1,3}, {red,10,1,6}, {red,10,0,6}, {red,10,1,3}, {red,10,0,10}, {red,10,0,6}, {red,10,1,6}, {red,10,1,10}, {red,10,0,10}, {red,10,1,6}, {red,10,0,-1}, {red,6,0,-1}, {red,10,1,-1}, {red,10,1,-1}, {red,6,0,-1}, {red,6,1,-1}, {red,6,0,-1}, {red,3,0,-1}, {red,6,1,-1}, {red,6,1,-1}, {red,3,0,-1}, {red,3,1,-1}, {red,3,0,-1}, {red,-1,0,-1}, {red,3,1,-1}, {red,3,1,-1}, {red,-1,0,-1}, {red,-1,1,-1}, {red,10,1,10}, {red,6,0,10}, {red,10,0,10}, {red,6,1,10}, {red,6,0,10}, {red,10,1,10}, {red,6,1,10}, {red,3,0,10}, {red,6,0,10}, {red,3,1,10}, {red,3,0,10}, {red,6,1,10}, {red,3,1,10}, {red,-1,0,10}, {red,3,0,10}, {red,-1,1,10}, {red,-1,0,10}, {red,3,1,10}, } Gum.matrixMode(Gu.MODEL) Gum.loadIdentity() Gum.translate(1,1,1); Gu.disable(Gu.TEXTURE_2D) Gum.drawArray(Gu.TRIANGLES, Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, walls) Gu.end3d() screen.waitVblankStart() screen.flip() end
-
07-10-2007, 06:31 PM #7652QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
have you tested it? what line does it give you an error at? what's the error
it'll help if you tell us those things
-
07-10-2007, 07:13 PM #7653
I need help on reading files. I know how to read a starting from a certain point, string.sub(mystring,9,12) , but I want to know how I can start on a specific line, like 8, or 17 or w/e.
-
07-10-2007, 07:34 PM #7654QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Right...it just shows a blank (grey) screen.
-
07-10-2007, 08:30 PM #7655
you can't have screen.flip() and screen.waitVblankStart() in the gu.
Zitat von andyauff
take those out and see if it works now :Punk:
-= Double Post =-
i tried it on windows luaplayer but it doesn't show anything both times, so i'm guessing it just doesn't support the gu on the computer... i think it should work now though...Geändert von emericaska8r (07-10-2007 um 08:34 PM Uhr) Grund: Automerged Doublepost
-
07-11-2007, 09:35 AM #7656QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
where now?
i went through the tutorials at evilmana, look at some at the Tutorial Directory and done some experimenting with lua
are there any other tutorials? where should i go now
-
07-11-2007, 10:16 AM #7657QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
try experiment :)
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
07-11-2007, 10:18 AM #7658
http://lua-users.org/wiki/TutorialDirectory
Zitat von michaelp
Is all you should ever need.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
07-11-2007, 11:30 AM #7659QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Thanks for the help, emericaska8er, but that wasn't the problem. You do need those in there. I think it was just because I had the array inside the main loop...now it is outside of it.
-= Double Post =-
Okay, new question: Is there any program where I can "draw" objects and it'll tell me the numbers for it? Or is it just sort of "guess and check"?Geändert von andyauff (07-11-2007 um 11:44 AM Uhr) Grund: Automerged Doublepost
-
07-11-2007, 11:49 AM #7660QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Elaborate on what you want to do.
-
07-11-2007, 11:50 AM #7661QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Draw 3D objects in lua...I understand your tutorial, but how did you get those numbers for the walls? Did you just sort of "guess and check" or is there a program where I can make the 3D objects and it'll spit out the coordinates?
-
07-11-2007, 12:00 PM #7662QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
http://pspupdates.qj.net/L3D-3D-Mode...g/49/aid/82009
edit: for those walls I figured it out in my head.
Oh and dl the one for 1.5
-
07-11-2007, 12:05 PM #7663
For all my 3D models I do it in notepad, no guess-and-check at all ;)
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
07-11-2007, 01:26 PM #7664QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Yeah, TP I already had that on my memory stick...and I thought about trying it, too! Thanks for the great program...do you plan to update it any further?
-
07-11-2007, 02:23 PM #7665QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Not right now. I think Blah is working on a major redo of it though.
-
07-11-2007, 02:51 PM #7666QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
That's cool.
-
07-15-2007, 12:28 PM #7667QJ Gamer Green
- Registriert seit
- Jul 2005
- Ort
- Belgium
- Beiträge
- 594
- Points
- 7.599
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Just startedlooking into LUA (total newb
) and trying to do some tutorials to learn the code
but I got a small problem, I'm using LuaDevKit (but I get the same problem with LUA player for windows) and ofcourse I started out with the pure basics, hello world :)
but when I testrun it, it just flashes the screen and closes again, how do I make it stay open so i can see the result?
arfgh, forget what i just said -_- just found it
-
07-16-2007, 12:18 AM #7668QJ Gamer Blue
- Registriert seit
- Dec 2006
- Ort
- Michigan
- Beiträge
- 116
- Points
- 3.778
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Hey there
ok? This is what i need
i need 15-25 small images (around 5 types) to scroll from the right to left
and i want it to blit random images.
What im trying to do is scroll buttons pics from right to left and when they hit the box in the middle you have to press the corresponding button.
so far i got this
Spoiler for Code:
Not much :/
Who ever replies, please dont just tell me the code can you briefly explain? Thanks in advance
-
07-16-2007, 01:11 AM #7669QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
What do you want people to briefly explain, you've told us the game you want to make, and showed us you code. What now? Are there any problems that need solving?.
Zitat von vision1
PS: You gon eat that random number? cos if u dont want it......Just Returned To The Scene...
-
07-16-2007, 05:46 AM #7670QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
shouldn't you have this at the top of your code:
so it's the not the same random number each time?Code:math.randomseed(os.time())
-
07-16-2007, 12:53 PM #7671QJ Gamer Blue
- Registriert seit
- Dec 2006
- Ort
- Michigan
- Beiträge
- 116
- Points
- 3.778
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Sorry, what i need to know is what would i do to print around 25 random images without having to type
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
screen
rint(...
-
07-16-2007, 01:19 PM #7672QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Store all the images in a table, then use a loop to print all the images.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
07-16-2007, 03:33 PM #7673QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Western Pennsylvania
- Beiträge
- 295
- Points
- 5.496
- Level
- 47
- Downloads
- 0
- Uploads
- 0
I use copy paste, but tables and all that stuff are way more organized. I just take the lazy way out, but pay for it in the end when I can't find anything...
That's me as a ninja in my avatar...SWEET!!!
Wii code: 6485-5589-0683-3700
SmashBros Code: 3566-1198-2621
mariokartWII: 3738-0052-4756
Check out my website
-
07-16-2007, 07:03 PM #7674words 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
Copy and paste? What happens when you need to display an undetermined amount of images? Say you read in all the images from the PHOTO folder.
As yaustar said
When you say 'random image', im confused. Also I'm unsure what your image sizes are and whether they should replace one another after displaying.Code:images = {} for i = 1, 25 do images[i] = Image.load("image" .. i .. ".png") end exit = false while ~exit do for i = 1, 25 do screen:blit(some X value, some y value, images[i]) end screen.waitVblankStart() screen.flip() end
...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
-
07-16-2007, 07:43 PM #7675QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i think he means display a random image in which case a small change to sg;s code:
i believe random is the name for the random function in lua although since it's been a long time since i coded in luaCode:images = {} for i = 1, 25 do images[i] = Image.load("image" .. i .. ".png") end exit = false while ~exit do screen:blit(0, 0, images[random(25)]) screen.waitVblankStart() screen.flip() end1. 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
-
07-16-2007, 10:21 PM #7676QJ Gamer Blue
- Registriert seit
- Dec 2006
- Ort
- Michigan
- Beiträge
- 116
- Points
- 3.778
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Thanks guys
By random i mean like
pictures of buttons
X O X LEFT RIGHT R1 L1 UP DOWN X X O <<not in specific order which scroll from right to left
-
07-17-2007, 12:18 AM #7677words 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
That is much more then a snippet.
I might do it in the morning (im about to go to sleep, it's 1:20 AM here...) but I think you'd get a great learning experience should you create it yourself....
...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
-
07-17-2007, 01:00 AM #7678Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
he is asking you yo create his first lua program for him like the one everyone tells you to do when your trying to learn lua?????
do it yourself or go find one that someone has made how do you expect to learn------ 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).
-
07-17-2007, 04:10 AM #7679QJ Gamer Green
- Registriert seit
- Jul 2005
- Ort
- Belgium
- Beiträge
- 594
- Points
- 7.599
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Could someone take a look at this code, for some reason I get in my Debug (working with LuaDevKit)
Exit Value: 1
usage: luaplayer script.lua
If I open another script it opens just fine, so I guess I must be not seeing something that is probably so obvious
Spoiler for Lua code:
-= Double Post =-
I eventualy found what was wrong, for some reason my filename was to big
kinda silly
I've got another problem tho
is there any decent soundsupport for LUA? or is there a way to preload my musicfiles, or is there a way to reset my timer as soon as the music starts playing.
Right now I had to use wav for my music (.xm file was the worst thing ever) and that plays, only problem is there is a delay and I need my music to be in perfect sync with my timer.Geändert von Mistabeen (07-17-2007 um 07:45 AM Uhr) Grund: Automerged Doublepost
-
07-17-2007, 11:15 AM #7680QJ Gamer Blue
- Registriert seit
- Dec 2006
- Ort
- Michigan
- Beiträge
- 116
- Points
- 3.778
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Guys chill out.
I didnt mean for you to write the whole code. I just asked how would i go about doing so and so that's why i asked that you dont just give me the code but also explain. Im not into copying and pasteing and i really do want to learn.


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