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 SG57 Well i got it from that luabin crud, i coopied and pasted, but look past the HTML ...
-
06-03-2006, 07:15 PM #2581QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- New Zealand
- Beiträge
- 397
- Points
- 8.216
- Level
- 61
- Downloads
- 0
- Uploads
- 0
oooh i see.
Zitat von SG57
I changed it to:
screen:blit(x1, y1, Player[x].n)
But where does the Player[x].n come into it?
92% of the teenage population listens to rap music. If you're part of the 8% that listens to real music, copy and paste this into your sig.
-
06-03-2006, 08:06 PM #2582QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- New Zealand
- Beiträge
- 397
- Points
- 8.216
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I dont think I understand...
92% of the teenage population listens to rap music. If you're part of the 8% that listens to real music, copy and paste this into your sig.
-
06-04-2006, 08:12 AM #2583
Hey - anyone know a good tutorial, or other reference point (including a game) in which I can learn how to set up a sprite system?
-
06-04-2006, 11:43 AM #2584QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
a sprite system..? explain more please.
Zitat von Spiritbeast
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
06-04-2006, 11:44 AM #2585QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
remember the table i made several posts back? thats how.
Zitat von fraseyboy
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
06-04-2006, 11:55 AM #2586
Uh.. you know, sprites? I don't know how else I can put it... animated characters?
Zitat von EminentJonFrost
-
06-04-2006, 01:38 PM #2587QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you want to make an animation?
..
how new are you to this?[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
06-04-2006, 02:43 PM #2588
No, I am not a super lua noobie fresh off my first tutorial. I'll explain what I am trying to do more in depth.
Zitat von EminentJonFrost
Lets say if a character is running. The character will display a running animation, which consists of muiltiple pictures, like frames. But, this character will also have a different animation for standing, and also one for jumping. So, I'd start off my saying "if player.motion == "jumping" then display the animation for the player jumping. What I was wondering is how I can implement an animation system.
-
06-04-2006, 05:15 PM #2589
I just wanted to say to ShockD out there that you have a nice game in the making.
-
06-04-2006, 05:19 PM #2590
also, spiritbeast, now that i think about it, download shockD's PSPZelda game. In the script file found in there, he has sprites and animation. Look in there to get an idea of how to do it.
-
06-04-2006, 06:36 PM #2591
I'll take a look at that, Emerica. Thanks.
Zitat von emericaska8r
-
06-05-2006, 01:38 PM #2592QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Hey is this how this works?
Code:function check(dummy) if pad:dummy then screen:print(50, 100, "You just pressed".. dummy, black) end end then if i put something instead of dummy, it just rewrites the function with that worrd like.. check(cross) would that take out dummy and replace it with cross?.. I think thats how this works
-
06-05-2006, 02:50 PM #2593QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Yes, exept that you forgot the "()".
Zitat von montrob
Code:function check(dummy) if pad:dummy() then screen:print(50, 100, "You just pressed: ".. dummy, black) screen.blit() --Remove if not needed. end end check(cross)
Geändert von HaxxBlaster (06-05-2006 um 03:03 PM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
06-05-2006, 02:55 PM #2594QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
Zitat von montrob
really...? cool.
Zitat von HaxxBlaster
so, that makes whatever coding the is in the function able to work on any variable, and not just the one mentioned in it?
what else does the inside of the parantheses do when a function is called? I've seen this use before, just never understood it.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
06-05-2006, 04:28 PM #2595
yea same as jon frost i think thats cool. I would also like to know more about what all you can do with the inside of the parantheses things.
-
06-05-2006, 06:46 PM #2596QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Lol.. and ive been coding long functions for everysingle thing.. this will make the final of AlphaAttackPSP come alot faster!
-
06-05-2006, 09:40 PM #2597Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
you didnt know that?? i thought u did. you can also put multiple variables: such as:
Zitat von EminentJonFrost
Code:function meOwnYou(me, you, own, bob, joe, mo, umm, topspin)
and i have a (random) question:
you know how ps2/xbox games are lik 4.7GB most of the times?? well, how much of that 4.7GB are the actual SCRIPTS, as opposed to the images/vids?
just curious.Geändert von Grimfate126 (06-05-2006 um 09:42 PM Uhr)
--------------------------------------------------------------------------------------
-
06-06-2006, 06:07 AM #2598QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
dont know...
Zitat von Grimfate126
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
06-06-2006, 12:47 PM #2599QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Just a snippet of a random question function, might help some one.
Example of how to use:Code:function RandomQuestion(Q1, Q2, Q3, Q4, x, y, Color) RQnr = math.random(1,4) if RQnr == 1 then screen:print(x,y, Q1, Color) elseif RQnr == 2 then screen:print(x,y, Q2, Color) elseif RQnr == 3 then screen:print(x,y, Q3, Color) elseif RQnr == 4 then screen:print(x,y, Q4, Color) end screen.flip() end
Code:if pad:cross() then RandomQuestion("How are you today?", "Who are you?", "Can you show me some magic?", "Hmm.. What should i do with this?", 20, 20, white) screen.waitVblankStart(200) endGeändert von HaxxBlaster (06-06-2006 um 01:30 PM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
06-06-2006, 02:23 PM #2600
cool.
-
06-06-2006, 03:38 PM #2601words 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
HaxxBlaster - Bad bad function seeing as how it is 4 questions specific...
Why not expand your knowledge and that function to allow user input for how many questions via an array, then a optional parameters that match that of the arrays?
Come on now... Stretch your brain past that of the easy way...
...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
-
06-06-2006, 10:39 PM #2602QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
You don't have to tell me, i definitely know this.
It's just a very basic way of how to return one of the 4 random strings. But yes, very messy.Geändert von HaxxBlaster (06-06-2006 um 10:46 PM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
06-07-2006, 09:06 AM #2603
i have a qestion how do i get the xmb clock
-
06-07-2006, 10:45 AM #2604QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Illinois
- Beiträge
- 897
- Points
- 8.215
- Level
- 61
- Downloads
- 0
- Uploads
- 0
No LUA script error.
Whenever I try to run this script on my psp I get an error saying no lua script.
I uploaded it so someone could look at it and find out why it is not working. Right now it is a very simple game and it shoukd have a moveable player and a loading screen. The reason it is so big is because I am working on making a tileengine and I need a lot of tiles and alot of sprites.
-
06-07-2006, 11:33 AM #2605QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I flipped through the script, and what I noticed is you loaded about 190+ images, and you can reduce by using a for loop. All of those lines could be reduced.
Zitat von cwirsing
Easily do that with all the other images, and you could make ALL of that into very little. For example, you loaded tiles upto 178, you could do that like this:Code:linkswordstrikeu = {} --Make your image into a table for a = 1, 6 do linkswordstrikeu[a] = Image.load("sprites/link/linkswordstrikeu" ..a..".EXTENSION OF IMAGE") end
Just reduced that whole chunk of code into 4 lines. Just saying, and the script error, I don't know. Unless you put System.usbActiviate, (something like that) and put it in the beginning of your code, and you tried it with a 2.00+ PSP, it wouldn't work.Code:tile = {} --Make your image into a table for b = 1, 178 do tile[b] = Image.load("tiles/tile" ..b..".png") end
-
06-07-2006, 11:53 AM #2606QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Illinois
- Beiträge
- 897
- Points
- 8.215
- Level
- 61
- Downloads
- 0
- Uploads
- 0
So your saying there is nothing wrong with my script but I can reduce the size of it.
-
06-07-2006, 11:59 AM #2607QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I did not say there is nothing wrong with your script. And I quote:
Zitat von cwirsing
I said I did not know but then said about System.usbActivate. I remember somebody saying that that would not work on 2.00+ PSP's.
Zitat von PSPduh, which is me
Obviously something is wrong with your script if it is not running properly.
Try to name it script.lua instead of index.lua.
--PSPduh
-
06-07-2006, 03:20 PM #2608QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Illinois
- Beiträge
- 897
- Points
- 8.215
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I fixed the problem.
the problem was
screen:clear()
was like this
screen:clear
)
EDIT
I am trying to insert a new font into my game but I can't get it to work.
Here is the code
Code:font = Font.load("font.ttf") image:fontPrint(font, 194, 136, Loading: 0%, [color = white]) screen.flip()Geändert von cwirsing (06-07-2006 um 06:24 PM Uhr)
-
06-07-2006, 07:29 PM #2609
- Registriert seit
- Nov 2005
- Ort
- Minnesota, USA.
- Beiträge
- 36
- Points
- 4.492
- Level
- 42
- Downloads
- 0
- Uploads
- 0
I found this in the code section of the PSP-Programming website:
When it says image:fontPrint, I think it wants the variable name of a user specified image or just screen to print it on the screen image (the screen image always exists. Such as in screen:clear(), screen:blit(x,y,image source), etc.).Code:nil image:fontPrint(font, x, y, text, [color = black])
-
06-07-2006, 07:33 PM #2610QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
OK this function takes up about 300 lines, but this is basically it except for changes in X and Y values and such
I basically just made this function as a dummy..
At first i got the error "attempt to index global 'dummybb'" So i made a table for dummy
dummybb = {blow = 1, go = false}
dummybb[1] = { x = 0, y = 40, go = true}
dummybb[2] = { x = 0, y = 50, go = true}
dummybb[3] = { x = 0, y = 60, go = true}
ok.. so now
I added
check(circle)
check(cross)
check(triangle)
check(square)
in my loop, but they bombs dont blow up when they hit the building. Any help?
Code:function check(dummy) if dummybb[1].x + 49 >= house1x and dummybb[1].x + 49 <= house1x + 21 and dummybb[1].y + 20 >= house1y and dummybb[1].y <= house1y + 20 and tile1show1a == 1 then dummybb[1].go = false tile1show1a = 2 end if tile1show1a >= 2 then screen:fillRect(house1x, house1y, 21, 21, blue) screen:blit(house1x, house1y, house1R) 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