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; this question may sound dumb....I was loading a game i made, and i got an error stating: libpng: Not a ...
-
11-04-2005, 08:47 PM #241QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
this question may sound dumb....I was loading a game i made, and i got an error stating: libpng: Not a PNG file
but all my pics are PNG/png
what do i do?
-
11-04-2005, 10:03 PM #242words 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
specify if its .png or .PNG, ect.

...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
-
11-05-2005, 09:11 AM #243QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
oh i just went in Paint and re-did the extensions, thanks
Zitat von SG57
-
11-05-2005, 12:08 PM #244words 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
now bout the resizer function

...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
-
11-05-2005, 12:49 PM #245Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Wow magician posted a link for you...
F.A.L.O?
-
11-05-2005, 04:01 PM #246words 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
i dont have privelages too itsaid

...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
-
11-05-2005, 04:24 PM #247Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
O well here it is:
smile = Image.load("smiley.png")
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 1, newX do
for y = 1, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:wi dth()/newX)),math.floor(y*(theI mage:height()/newY)), 1, 1)
end
end
return newImage
end
--main program
screen:blit(0, 0, smile)
screen:blit(0, 100, scaleImage(200,100,smile) )
screen:blit(100, 0, scaleImage(20,100,smile))
screen:flip()
screen.waitVblankStart(60 0)
F.A.L.O?
-
11-05-2005, 11:23 PM #248words 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
thank you alot now ehn u said:
smile = Image.load("smiley.png")
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 1, newX do
for y = 1, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:wi dth()/newX)),math.floor(y*(theI mage:height()/newY)), 1, 1)
end
end
return newImage
end
do i just put my picture instead of "smiley.png" and it should work or do i have to mod it abit so it fits my pictures dimensions and such
also, am i basically defining the function then putting it in the loop or what cause im new to this "function" stuff for LUA everything else cool
so basically, can u just tel me how i could put my picture in their instead of smiley so i can get the hang of this function thing? thx alot if u can
==edit==
right now my dimensions of my picture are 400, 272
and where do iput the new dimensions? where you put the () after height and width next to newX and newY or what? sorry bout questions, just that ican make my game now that idont have to worry bout resizing if i can take ascreenshot when its resized lol and im done!:Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump:Geändert von SG57 (11-05-2005 um 11:29 PM Uhr)

...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
-
11-06-2005, 08:50 AM #249QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
My analog+D-pad movement script
I have been working with a movement script for my game, analog doesn't move make my character move in all directions, only left, right, up and down. how do i make it so moves anyway i push that analog?
here is my coding:
Code:System.usbDiskModeActivate() sprite = Image.load("jet2.png") menubg = Image.load("menubg.png") red = Color.new(255, 0, 0) black = Color.new(0, 0, 0) -- Players current X coord pcXpos = 30 -- Players current Y coord pcYpos = 115 -- Show the X/Y coords to adjust the movement #'s screen:print(0, 0, tostring(pcXpos), red) screen:print(0, 0, tostring(pcYpos), red) function updateMove(xPos, yPos) --{ analogPad = Controls.read() dx = analogPad:analogX() dy = analogPad:analogY() -- Up if dx > -60 and dx < 40 and dy == -128 or analogPad:up() then pcYpos = pcYpos - 4 playerDirection = "up" end -- Left if dy > -25 and dy < 40 and dx == -128 or analogPad:left() then pcXpos = pcXpos - 4 playerDirection = "left" end -- Down if dx > -40 and dx < 40 and dy == 127 or analogPad:down() then pcYpos = pcYpos + 4 playerDirection = "down" end -- Right if dy > -35 and dy < 45 and dx == 127 or analogPad:right() then pcXpos = pcXpos + 4 playerDirection = "right" end -- Check to see if player is off screen if pcXpos >= 431 then -- Subtract sprite width pcXpos = 430 elseif pcXpos < 0 then pcXpos = 00 end if pcYpos >= 234 then -- Subtract sprite height pcYpos = 232 elseif pcYpos < 0 then pcYpos = 00 end --} end while true do screen:clear(black) updateMove() screen:blit(0, 0, menubg) screen:blit(pcXpos, pcYpos, sprite) pad = Controls.read() if pad:start() then break end screen.waitVblankStart() screen.flip() end
-
11-06-2005, 10:50 AM #250Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Same way you are doing it, just add some more if's for other analog posistions..
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-06-2005, 04:20 PM #251QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
oh ok, i was just checking
Zitat von Virtue
what if i wanted all way directional movement?
would i have to keep adding if statements?Geändert von monster356 (11-06-2005 um 04:23 PM Uhr)
-
11-06-2005, 04:21 PM #252QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
new question!
well, how would i make a projectile(an arrow) spawn from my character when i press X? it only goes in one direction too, just if you wanted to knowGeändert von monster356 (11-06-2005 um 04:23 PM Uhr)
-
11-06-2005, 04:57 PM #253QJ Gamer Gold
- Registriert seit
- Jul 2005
- Ort
- GA | Banned: 3 | Warned: 3
- Beiträge
- 2.253
- Points
- 12.479
- Level
- 73
- Downloads
- 0
- Uploads
- 0
okay, i did this
musicbg = Sound.load("music.wav")
musicbg
lay()
Music.volume(128)
but is doesnt work!
Also, what monster said, i would like to know that too!
-
11-07-2005, 08:50 AM #254
Okay, how do I make it so that when I press for exampel the X button on a small picture of a circle then the picture changes to a cross? =)
-
11-07-2005, 08:54 AM #255
I have an error string 6 on my user lua for 2.0. It also says there is an unexpected symbol, even after I installed the patch. Could this be because I put the new Pspmillionaire in the applications folder?
-
11-08-2005, 10:16 AM #256
Know what I mean?
-
11-08-2005, 10:18 AM #257Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
For Monsters thing, you just blit an image a little bit to the right of the characters x posistion, and then add a x = x + 3 or something to the bullets x posistion, so it will increase and go to the right.
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-08-2005, 11:49 AM #258QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
can someone help me it keeps saying its running the script but nuttin comes up
i am using lua the latest lua
heres my code
System.usbDiskModeActivat e()
blue=Color.new(0,0,255)
oldinput = Controls.read()
input = Controls.read()
screen:clear()
gun1=Image.load("pics/gun1.png")
gun2=Image.load("pics/gun2.png")
gun3=Image.load("pics/gun3.png")
gun4=Image.load("pics/gun4.png")
gun5=Image.load("pics/gun5.png")
gun6=Image.load("pics/gun6.png")
gun7=Image.load("pics/gun7.png")
gun8=Image.load("pics/gun8.png")
gun9=Image.load("pics/gun9.png")
gun10=Image.load("pics/gun10.png")
gun11=Image.load("pics/gun11.png")
gun12=Image.load("pics/gun12.png")
gun13=Image.load("pics/gun13.png")
gun14=Image.load("pics/gun14.png")
gun15=Image.load("pics/gun15.png")
gun16=Image.load("pics/gun16.png")
gunlist = {gun1, gun2, gun3, gun4, gun5, gun6, gun7, gun8, gun9, gun10, gun11, gun12, gun13, gun14, gun15, gun16}
listpos = 1
function readinput()
input = Controls.read()
if input:oldinput() then
if input:left() and listpos > 1 then
listpos = listpos - 1
end
if input:right() and listpos < table.getn(gunlist) then
listpos = listpos + 1
end
oldinput = input
end
function drawgun()
screen:blit(0,0,gunlist[listpos])
screen.flip()
end
while not input:start() do
read:input()
drawgun()
screen.waitVblankStart()
screen:clear()
end
endGeändert von slicer4ever (11-08-2005 um 12:06 PM Uhr)
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
-
11-08-2005, 02:01 PM #259QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
if that doesn't work i'll let you know
Zitat von Virtue
EDIT: this is my code:
there is something wrong with it, when i press X it shows my missle like pratically offscreen, it just appears over there
Code:if pad:cross() then bombX = pcXpos bombY = pcYpos while bombX < 480 do screen:clear(black) screen:blit(0, 0, menubg) screen:blit(pcXpos, pcYpos, sprite) screen:print(0, 20, tostring(dx), red) --analog coords screen:print(20, 20, tostring(dy), red) --analog coords screen:blit(bombX, bombY, missile) bombX = bombX + 5 --Controls missile speed end endGeändert von monster356 (11-08-2005 um 02:13 PM Uhr)
-
11-09-2005, 10:06 AM #260Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Edit - Nevermind
Zitat von slicer4ever
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-09-2005, 03:48 PM #261QJ Gamer Bronze
- Registriert seit
- Nov 2005
- Ort
- UK
- Beiträge
- 56
- Points
- 4.496
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Ok i have a question. This code works perfectly fine but i dont know how to continue from this point onwards.
Pad buttons.
How do i clear the buttons once they have been used so that the next time X is pressed, it will display a complete new line of text not "This Is The X Button And The Colour Used Is Green".
Code:System.usbDiskModeActivate() screen:clear() green = Color.new(0, 255, 0) red = Color.new(255, 0, 0) blue = Color.new(0, 0, 255) pink = Color.new(255, 20, 147) yellow = Color.new(255, 255, 0) A = "This Is The X Button And The Colour Used Is Green" B = "This Is The [] Button And The Colour Used Is Red" C = "This Is The O Button And The Colour Used Is Blue" D = "This Is The Button And The Colour Used Is Pink" E = "This Is The Start Button And X O [] Will Now Appear" while true do pad = Controls.read() pad2 = Controls.read() if pad:cross() then screen:clear() screen:print(10, 10, A, green) screen.flip() screen.waitVblankStart(60) screen:clear() screen.flip() end if pad:square() then screen:clear() screen:print(10, 20, B, red) screen.flip() screen.waitVblankStart(60) screen:clear() screen.flip() end if pad:circle() then screen:clear() screen:print(10, 30, C, blue) screen.flip() screen.waitVblankStart(60) screen:clear() screen.flip() end if pad:triangle() then screen:clear() screen:print(10, 40, D, pink) screen.flip() screen.waitVblankStart(60) screen:clear() screen.flip() end if pad:start() then screen:clear() screen:print(10, 50, E, yellow) screen.flip() screen.waitVblankStart(120) screen:print(10, 10, A, green) screen:print(10, 20, B, red) screen:print(10, 30, C, blue) screen:print(10, 40, D, pink) screen:print(10, 50, E, yellow) screen.flip() screen.waitVblankStart(500) screen:clear() screen.flip() end end
-
11-09-2005, 04:58 PM #262Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
You need to make a counting function so that every time you press x its the var + 1
so the var would be:
count = 0
Then you would use:
If pad:cross() then count=count+1 end
And to display stuff to the screen you would put:
If count==1 then screen
rint(x, y, "whatever")
elseif count==2 then screen
rint(x, y, "more text here")
end
--and so on
F.A.L.O?
-
11-09-2005, 05:18 PM #263QJ Gamer Bronze
- Registriert seit
- Nov 2005
- Ort
- UK
- Beiträge
- 56
- Points
- 4.496
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Thanks :)
-
11-09-2005, 05:24 PM #264QJ Gamer Bronze
- Registriert seit
- Nov 2005
- Ort
- UK
- Beiträge
- 56
- Points
- 4.496
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Is it possable to do an If inside an IF in lua?
-
11-09-2005, 05:33 PM #265Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Yes ^
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-09-2005, 06:22 PM #266QJ Gamer Gold
- Registriert seit
- Jul 2005
- Ort
- GA | Banned: 3 | Warned: 3
- Beiträge
- 2.253
- Points
- 12.479
- Level
- 73
- Downloads
- 0
- Uploads
- 0
is there any way to make the lua aplication exit to the psp menu? other than the HOME button?
-
11-09-2005, 06:42 PM #267Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Not that I know of, no.
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-09-2005, 07:01 PM #268QJ Gamer Bronze
- Registriert seit
- Nov 2005
- Ort
- UK
- Beiträge
- 56
- Points
- 4.496
- Level
- 42
- Downloads
- 0
- Uploads
- 0
NVM Got It :)
Geändert von SSJGaz (11-09-2005 um 07:48 PM Uhr)
-
11-09-2005, 10:03 PM #269QJ Gamer Gold
- Registriert seit
- Jul 2005
- Ort
- GA | Banned: 3 | Warned: 3
- Beiträge
- 2.253
- Points
- 12.479
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Edited
NVRM
-
11-10-2005, 07:13 PM #270QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
virtue u said nvm to my post sorry for being gon for a day or 2 but what were you ganna say??? and if anyone wants to see my problem just go back a page thy
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


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