Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 10, 2012, 01:14:55 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Welcome to PSP-Programming.com
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: Screen:Blit Image Loading Error  (Read 1420 times)
Hadesminion13
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1
224.39 points

View Inventory
Send Money to Hadesminion13

View Profile
« on: August 27, 2010, 03:25:54 PM »

Every time I try to load my script with LPE v8 on my PSP I get this exact error:

Code:
Error: index.lua:27: bad argument #3 to 'blit' (number expected, got boolean)
Press start to restart

I'm usually able to fix errors in Lua by myself, since I've done some Lua before, but I just can't seem to figure out what's wrong. I've highlighted the line in question and the image I defined to appear with it. Anyone know what's wrong?

Here's my code:

-----------------------------------------------------------------------------------------------
black = Color.new(0, 0, 0)
white = Color.new(255, 255, 255)
darkred = Color.new(201, 0, 0)
PsPBGImg = Image.load("images/DrumsetNoLit.png")
BassKick01 = Wav.load("sounds/BassKick01.wav", 1)
CymbalBellShort = Wav.load("sounds/CymbalBellShort.wav", 2)
CymbalCustMed = Wav.load("sounds/CymbalCustMed.wav", 3)
DrumRimHit = Wav.load("sounds/DrumRimHit.wav", 4)
SnareHit01 = Wav.load("sounds/SnareHit01.wav", 5)
SnareHit02 = Wav.load("sounds/SnareHit02.wav", 6)
YBeechCust01 = Wav.load("sounds/YBeechCust01.wav", 7)
YBeechCust02 = Wav.load("sounds/YBeechCust02.wav", Cool

screen:print(190, 130, "Welcome to Drum Pad", darkred)
screen:print(190, 140, "Program by HadesMinion", darkred)
screen:print(190, 150, "Scripted in Lua", darkred)
screen.flip()
screen.waitVblankStart(300)

screen:clear()
screen:print(190, 130, "Loading...", darkred)
screen:print(15, 250, "Controls are displayed on Drum Pad", darkred)
screen:print(15, 260, "Once DP Loads, Press Select for a screen shot.", darkred)
screen.flip()
screen.waitVblankStart(300)

screen:clear()
screen.flip()

while true do
   screen:blit(0, 0, PsPBGImg, false)
   pad = Controls.read()
   
if pad:l() then
   CymbalBellShort.play(false, 2)
   waitVblankStart(60)
end

if pad:r() then
   CymbalCustMed.play(false, 3)
   waitVblankStart(60)
end

if pad:left() then
   SnareHit01.play(false, 5)
   waitVblankStart(60)
end

if pad:circle() then
   SnareHit02.play(false, 6)
   waitVblankStart(60)
end

if pad:right() then
   YBeechCust02.play(false, Cool
   waitVblankStart(60)
end

if pad:square() then
   DrumRimHit.play(false, 4)
   waitVblankStart(60)
end

if pad:down() then
   BassKick01.play(false, 1)
   waitVblankStart(60)
end

if pad:cross() then
   YBeechCust01.play(false, 7)
   waitVblankStart(120)
end

if pad:start() then
   screen:save("screenshot.png")
end

if pad:select() then
   break
end
end
-----------------------------------------------------------------------------------------------


What I'm doing is making a small Drum Pad application, but I can't get the image for the pad to show up. This is a very early... EARLY stage version. The final will have certain parts light up when you press the corresponding button, etc, and maybe have more instruments, but for now I have to find out what the f*ck is wrong with my code Sad

PS: I couldn't use CODE tags because the COLOR tags wouldn't show up.
« Last Edit: August 27, 2010, 03:28:47 PM by Hadesminion13 » Logged


w00tguy123
Jr. Member
**

Karma: +45/-6
Offline Offline

Posts: 63
2096.09 points

View Inventory
Send Money to w00tguy123

View Profile
« Reply #1 on: August 27, 2010, 10:47:36 PM »

Well, the error is obvious - You're not allowed to pass a boolean to the third argument of the blit() function. I can see how it's a little confusing though, because i'm pretty sure you're allowed to that (skipping the 4 arguments that determine which part of the image you want to blit), but I think LPE has special rules that could cause this. Just take out the "false" thing in second red line and you should be fine. Does the image have transparency and you want it to be opaque instead? If you do, then it's still possible, but you have to fill in the 4 arguments that come before "false".
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.349 seconds with 25 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com