Zeige Ergebnis 8.131 bis 8.160 von 10238
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; Awesome thanks!...
-
11-27-2007, 03:43 AM #8131
Awesome thanks!
-
11-27-2007, 09:25 AM #8132Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
thanks i will do it in 3d then, i hope your all looking forward to it i am lol
Zitat von Nielkie
wow i didn't realize that 3d was so easy i thought it would be much harder i spent some time messing around with the different functions e.g. views rotation zoom and things like that and it is pretty simple i think that i should have a poc out for ut lua very soon
thanksGeändert von FaT3oYCG (11-27-2007 um 02:49 PM Uhr)
------ 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).
-
11-27-2007, 12:10 PM #8133QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Ah, I see. Thanks a lot. I figured it would have to do with using tables- that's definitely one thing I need to learn more about.
Zitat von TuxThePenguin
-
11-27-2007, 02:51 PM #8134Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
hey andy use this link for some good tuts on tables and how they work it also shows the two different methods of using tables http://www.evilmana.com/tutorials/lua_tutorial_05.php
Zitat von andyauff
------ 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).
-
11-27-2007, 02:52 PM #8135
Funny I couldn't get the script I put together to work it kept giving me a Wrong number of vertexes or something like that error.
Zitat von FaT3oYCG
-
11-27-2007, 03:23 PM #8136Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
hmm first off i modified the 3d cube example to understand what each function did
here is my modified code
now for my question i am reading a file and i have the string how would i say read from a certain point in that string until another point say 5 letters in a 20 letter sentence thanks EDIT: nvm i found out how to do it i used string.sub(string, start, finish) thanks ne wayCode:red = Color.new(255, 0, 0) green = Color.new(0, 255, 0) blue = Color.new(0, 0, 255) black = Color.new(0, 0, 0) white = Color.new(255, 255, 255) gray = Color.new(128, 128, 128) cyan = Color.new(100, 255, 255) sqre = 0 trng = 0 lr = 0 logo = Image.createEmpty(64, 64) logo:clear(gray) logo:print(20, 20, "Lua", black) logo:print(10, 40, "Player", black) cube = { {0, 0, red, -1, -1, 1}, -- 0 {2, 0, red, -1, 1, 1}, -- 4 {2, 2, red, 1, 1, 1}, -- 5 {0, 0, red, -1, -1, 1}, -- 0 {2, 2, red, 1, 1, 1}, -- 5 {0, 2, red, 1, -1, 1}, -- 1 {0, 0, red, -1, -1, -1}, -- 3 {2, 0, red, 1, -1, -1}, -- 2 {2, 2, red, 1, 1, -1}, -- 6 {0, 0, red, -1, -1, -1}, -- 3 {2, 2, red, 1, 1, -1}, -- 6 {0, 2, red, -1, 1, -1}, -- 7 {0, 0, green, 1, -1, -1}, -- 0 {2, 0, green, 1, -1, 1}, -- 3 {2, 2, green, 1, 1, 1}, -- 7 {0, 0, green, 1, -1, -1}, -- 0 {2, 2, green, 1, 1, 1}, -- 7 {0, 2, green, 1, 1, -1}, -- 4 {0, 0, green, -1, -1, -1}, -- 0 {2, 0, green, -1, 1, -1}, -- 3 {2, 2, green, -1, 1, 1}, -- 7 {0, 0, green, -1, -1, -1}, -- 0 {2, 2, green, -1, 1, 1}, -- 7 {0, 2, green, -1, -1, 1}, -- 4 {0, 0, blue, -1, 1, -1}, -- 0 {2, 0, blue, 1, 1, -1}, -- 1 {2, 2, blue, 1, 1, 1}, -- 2 {0, 0, blue, -1, 1, -1}, -- 0 {2, 2, blue, 1, 1, 1}, -- 2 {0, 2, blue, -1, 1, 1}, -- 3 {0, 0, blue, -1, -1, -1}, -- 4 {2, 0, blue, -1, -1, 1}, -- 7 {2, 2, blue, 1, -1, 1}, -- 6 {0, 0, blue, -1, -1, -1}, -- 4 {2, 2, blue, 1, -1, 1}, -- 6 {0, 2, blue, 1, -1, -1}, -- 5 } plane = { {blue, -8, -3, 0}, {cyan, 8, 3, 0}, {blue, 8, -3, 0}, {cyan, 8, 3, 0}, {blue, -8, -3, 0}, {cyan, -8, 3, 0}, } while true do Gu.start3d() -- clear screen Gu.clearDepth(0); Gu.clear(Gu.COLOR_BUFFER_BIT+Gu.DEPTH_BUFFER_BIT) -- setup projection and view matrices Gum.matrixMode(Gu.PROJECTION) Gum.loadIdentity() Gum.perspective(75, 16/9, 0.1, 4000) Gum.matrixMode(Gu.VIEW) Gum.loadIdentity() -- setup matrix for triangle Gum.matrixMode(Gu.MODEL) Gum.loadIdentity() Gum.translate(0, 0, -5); -- draw triangle without texture Gu.disable(Gu.TEXTURE_2D) Gum.drawArray(Gu.TRIANGLES, Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, plane) -- setup texture Gu.enable(Gu.BLEND) Gu.blendFunc(Gu.ADD, Gu.SRC_ALPHA, Gu.ONE_MINUS_SRC_ALPHA, 0, 0) Gu.enable(Gu.TEXTURE_2D); Gu.texImage(logo) Gu.texFunc(Gu.TFX_MODULATE, Gu.TCC_RGBA) Gu.texEnvColor(white) Gu.texFilter(Gu.LINEAR, Gu.LINEAR) Gu.texScale(1, 1) Gu.texOffset(0, 0) Gu.ambientColor(white) -- setup matrix for cube Gum.matrixMode(Gu.MODEL) Gum.loadIdentity() Gum.translate(0, 0, -3); Gum.rotateXYZ(sqre, trng, lr) -- draw cube Gum.drawArray(Gu.TRIANGLES, Gu.TEXTURE_32BITF+Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, cube) degr = (Gu.PI/180) if Controls.read():square() then sqre = sqre + (10 * degr) end if Controls.read():circle() then sqre = sqre - (10 * degr) end if Controls.read():triangle() then trng = trng + (10 * degr) end if Controls.read():cross() then trng = trng - (10 * degr) end if Controls.read():l() then lr = lr + (10 * degr) end if Controls.read():r() then lr = lr - (10 * degr) end Gu.end3d() if Controls.read():start() then screen:clear() break end screen.waitVblankStart() screen.flip() endGeändert von FaT3oYCG (11-27-2007 um 03:49 PM Uhr)
------ 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).
-
11-27-2007, 03:26 PM #8137QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Yeah, those (the evilmana ones) are basically the only tutorials I have used (besides one tut for 3D). I need more in-depth explanations of the table functions such as table.getn and the use if "i". I'll be checking out lua.org and other good resources when I get a chance. Thanks for the consideration though, even if I have already gone through that tutorial! :)
Zitat von FaT3oYCG
-
11-27-2007, 03:51 PM #8138Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
oh ok well the table.getn() command and such are easy to use you almost never need to use them unless you are creating a file browser which i can post an example of if you want and ill add in some comments explaining what each function does
------ 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).
-
11-27-2007, 03:55 PM #8139QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
That's okay, I think I understand, I just need to practice using them. Thanks.
-
11-27-2007, 04:05 PM #8140Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
ok no probs if you need help or get stuck you know where to come
------ 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).
-
11-27-2007, 04:08 PM #8141QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Seriously? You think this is simple stuff?
Zitat von hakk3r
You're making it pretty obvious that you've done little to no coding yourself...[I fail @ life]
-
11-27-2007, 04:12 PM #8142
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
You use table.getn in MANY more situations than a filebrowser. Wanna run through every entry of a table? Wanna find out how many of something you have? etc
table.getn returns the number of items in the given table.
For the whole i thing, look at the lua-users.org for loop tutorial.Code:table1 = {3,2,4,5,6,3,5} print(table.getn(table1)) --will print 7 table2 = {{1,2,3},{4,5,6},{7,8,9}} print(table.getn(table2)) --will print 3
Tables: http://lua-users.org/wiki/TablesTutorial
For loops: http://lua-users.org/wiki/ForTutorial
-
11-27-2007, 04:16 PM #8143Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i didn't say that there weren't more uses i said you hardly ever need to do something like that except for in file browsers
------ 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).
-
11-27-2007, 06:34 PM #8144
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
By hardly ever, you were implying that filebrowsers were one of the very select few applications of table.getn when in fact filebrowsers are just one of several implementations of it. I use it in almost every program I make.
-
11-27-2007, 09:48 PM #8145QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Same here.
Zitat von TuxThePenguin
In a game, for example, it's easy to just chuck all objects in a table and loop through them to render them. That also makes it easy to construct levels and make a level editor.
-
11-28-2007, 09:51 AM #8146
I never said it would be simple. All I said was I want a tutorial. Also why aren't you flaming the guy who said:
Zitat von FreePlay
Durr
Zitat von FaT3oYCG
-
11-28-2007, 10:03 AM #8147Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
FreePlay is ten times smarter than you'll ever be. Lua isn't the language (for PSP) to learn how to make a model with a high number of polygons walk around. Sure the cube sample is easy but that involves barely any physics.
-
11-28-2007, 12:41 PM #8148Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
hmm let me think i understand lua i havent just started learning it - i ask for places to learn, and try to fix my own mistakes if i dont have time or i cant fix it myself then i will post here before asking someone like freeplay for an example 3d world where i can walk arround - as that in its self would take a while to make
Zitat von hakk3r
and as i do have previous experience i will find it easier to use the basic 3d commands and learn how to use the advanced ones so unless you are going to make a 3d game or something
shut up !!!!!------ 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).
-
11-28-2007, 02:28 PM #8149
I was just saying that freeplay doesn't need to be such a jerk just because he knows more than us.
-
11-28-2007, 03:45 PM #8150QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Okay, so I have used TuxThePenguin's advice for blitting multiple images using a cursor, and it works great. But now I need to be able to erase whichever one is underneath the cursor when another button is pressed. I have tried using the table.remove function, which works, but it needs a number for which entry to delete. I don't know which entries are which... I simply need to erase whichever one is underneath the cursor. Would there be a way to do something like that without too much stress?
-
11-28-2007, 03:46 PM #8151lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
You miss need to shut up.
Zitat von FaT3oYCG
Your saying how 3d is soooo easy yet I bet you cant do any more than a cube example if that without looking at the already made one. Also, no you do not understand Lua.
-
11-29-2007, 11:39 AM #8152
Have you learned 3D? If not then how do you know its soo easy. If so then I'm sorry I asked.
-
11-29-2007, 03:17 PM #8153
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
I dont have much time right now to scribble up some code but here's what I can tell you you should be aiming at
-When button is pressed, start a for loop (for i = 1, table.getn(placedimgs) do)
-In that for loop, check if the mouse is over that image by comparing placedimgs[i].x and y and the cursor x and y and the width/height of placed image
if the cursor IS over that image then
table.remove(placedimngs, i)
break
end
-
11-29-2007, 04:13 PM #8154QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I see. I will try that for sure. Thanks a lot.
-
11-29-2007, 04:54 PM #8155
Are you coding Lua or HTML?
Zitat von FaT3oYCG
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
11-30-2007, 09:57 AM #8156Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
lua obv soz about that it is the way the forum put it,
Zitat von Judas
its supposed to be
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).
-
12-02-2007, 09:08 AM #8157QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Is there a function to completely empty a table?
EDIT: Nevermind, I figured it out.Geändert von andyauff (12-02-2007 um 09:43 AM Uhr)
-
12-02-2007, 10:23 AM #8158
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
tablename = {}
lol
-
12-02-2007, 12:03 PM #8159QJ Gamer Blue
- Registriert seit
- Jan 2007
- Ort
- U.S.
- Beiträge
- 405
- Points
- 7.014
- Level
- 55
- Downloads
- 0
- Uploads
- 0
huh. :Argh:
-
12-02-2007, 12:22 PM #8160
- Registriert seit
- Nov 2007
- Beiträge
- 12
- Points
- 2.876
- Level
- 32
- Downloads
- 0
- Uploads
- 0
lemme guess, you were doing something like
for i = 1, table.getn(table) do
table.remove(table,i)
end


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