QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

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; Originally Posted by MagicianFB http://www.lua.org/pil/index.html#P3 http://luaplayer.org/functions.txt k thanx...

Reply
 
LinkBack Thread Tools
Old 10-04-2005, 08:08 AM   #31

Rock Star
 

 
Join Date: Aug 2005
Location: CT| FW: 4.01 M33-2
Posts: 11,844
Trader Feedback: 0
Default

k thanx
__________________

TeamOverload is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 09:08 AM   #32

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

In Lua tutorial 2 you can display pic's when you push a button. But how do I do so the image doesn't disapear directly after a stop pushing the button??I want the picture/text to stay there.

And how do I change the size of the text/numers in my program??

Thanks in advance!
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 09:18 AM   #33

Rock Star
 

 
Join Date: Aug 2005
Location: CT| FW: 4.01 M33-2
Posts: 11,844
Trader Feedback: 0
Default

can u post ur code??
__________________

TeamOverload is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 10:28 AM   #34
11th Squad Captain
 
c5cha7's Avatar
 
Join Date: Jun 2005
Location: You are here -----> 名前: アダム | 飲むコー&#1
Posts: 2,562
Trader Feedback: 0
Default HELP (Please)

Hi i really need some help here.
My new game Dragon Ball Portable is very dodgy.
It skatter's around.
Is the code alright?
(Please nobody steal this)
How can i get the Picture to move up aswell???
Code:
--c5cha7's DBP (Beta source)
--activate usb
System.usbDiskModeActivate()

--load text colors
red = Color.new(255, 0, 0)
blue = Color.new(0, 0, 255)
green = Color.new(0, 255, 0)
black = Color.new(0, 0, 0)
white = Color.new(255, 255, 255)

--Startup
intro = Sound.load("Data/Sounds/intro.wav")
luaplayer = Image.load("Data/images/lua.png")
intro:play()
screen:blit(0, 0,  luaplayer)
screen.flip(120)
screen.waitVblankStart(120)

-- Move Player

function move() 
local limit = -11 -- adjust the count limit as needed 
local pad = Controls.read() 

if (pad ~= oldpad) or (countpads > limit) then 

if pad:right() then 
playerPos = playerPos + 1 
if playerPos > 13 then playerPos = 13 end 
screen.waitVblankStart(2)
end 

if pad:left() then 
playerPos = playerPos - 1 
if playerPos < 0 then playerPos = 0 end 
screen.waitVblankStart(2)
end 

if pad:up() then 
playerPos = playerPos - 1 
if playerPos < 1 then playerPos = 1 end 
end 

if pad == oldpad then 
countpads = limit - 1 -- for repeatedly advanced 
else 
countpads = 0 -- for the first pressed 
end 
oldpad = pad 
else -- do nothing for a moment 
countpads = countpads + 1 
screen.waitVblankStart(5)
screen.waitVblankStart(4)
screen.waitVblankStart(1)
end 

end 

player = Image.load "player.png" 
playerPos = 1 
countpads = 0 

while true do 
screen:clear() 
move() 
screen:blit(32*playerPos, 120, player) 
screen.waitVblankStart() 
screen:flip() 
end
__________________
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
c5cha7 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 11:53 AM   #35

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

Sorry I forgot to post the code Here it is:
Code:
System.usbDiskModeActivate()

blue = Color.new(0, 0, 255)
orange = Color.new(223, 88, 6)
grey = Color.new(94, 97, 111)
yellow = Color.new(255, 255, 0)
black = Color.new(0, 0, 0)
white = Color.new(255, 255, 255)

x = 96
y = 96
speed = 3

while true do
screen:clear()

pad = Controls.read()

screen:print(x, y, "+", white)

if pad:select() then screen:save("screenshot.tga") end

if pad:start() then
		break
	end

if pad:analogX() < -30 then
x = x - speed
end

if pad:analogX() > 30 then
x = x + speed
end

if pad:analogY() < -30 then
y = y - speed
end

if pad:analogY() > 30 then
y = y + speed
end

   if pad:left() then
      x = x - 3
   end

   if pad:right() then
      x = x + 3
   end

   if pad:up() then
      y = y - 3
   end

   if pad:down() then
      y = y + 3
   end

   if pad:start() then
		break
	end

if pad:cross() then
screen:print(20, 18, "1", white)
end

screen.waitVblankStart()
screen.flip()

end
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:07 PM   #36
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

What are the sound limitations in lua?..

I've been trying to make some background music, but what should it be in?

I've got various wavs playing on events but they fail to play when I try to start them at the main menu. I just want some background music.

Cheers.
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:10 PM   #37
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by Bilo
What are the sound limitations in lua?..

I've been trying to make some background music, but what should it be in?

I've got various wavs playing on events but they fail to play when I try to start them at the main menu. I just want some background music.

Cheers.
They can only be wavs.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:30 PM   #38
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

Well in that case, there is something wrong as the background audio I have wont play and it's a wav.
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:31 PM   #39
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by Bilo
Well in that case, there is something wrong as the background audio I have wont play and it's a wav.
Post your script.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:35 PM   #40

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

Anyone who can help me with my qustion above??
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:42 PM   #41
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by SodR
Anyone who can help me with my qustion above??
Put the print flip and clear in the if's for the buttons to conrol position.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:43 PM   #42
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

Script at start -

sensiblesnd= Sound.load("sensible.wav" )

script to initiate sound -

sensiblesndlay()

Last edited by Bilo; 10-04-2005 at 12:45 PM..
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:51 PM   #43

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

Quote:
Originally Posted by MagicianFB
Put the print flip and clear in the if's for the buttons to conrol position.
Could you write an example please? I doesn't exactly undrstand what you mean.
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:52 PM   #44
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by Bilo
Script at start -

sensiblesnd= Sound.load("sensible.wav" )

script to initiate sound -

sensiblesndlay()
I don't now, that should work.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 12:59 PM   #45
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

Hmm.. must be the sound file as if I replace one of my other sounds with it, then that sound fails to initiate too.
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 01:27 PM   #46
 
lingon's Avatar
 
Join Date: Sep 2005
Posts: 122
Trader Feedback: 0
Default

I'm having fat-as problem with this really simple thing. But im a noob so...=)
anyway how can I make it so that the program can "back" one screen so that I for instance after pressing a button can go back to the titelscreen?
lingon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 01:36 PM   #47
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

um...

if pad:triangle() then
mainmanu()
end

Something like that, main menu being a function previously set.
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:19 PM   #48
Advanced PSP Coder
 
Virtue's Avatar
 
Join Date: Oct 2005
Location: Down South
Posts: 426
Trader Feedback: 0
Default

Can anyone post an example using a function such as the main menu? Thanks so much.
__________________
[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]
Virtue is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:33 PM   #49

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

well im working on something extremely minor, but it wont load. I keep getting an error.

..........

I got it up and running
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week

Last edited by cools; 10-06-2005 at 01:56 PM..
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:42 PM   #50
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

screen:blit(=210, 1, "monopoly")

that should be

screen:blit(210, 1, monopoly)
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:55 PM   #51
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by cools
well im working on something extremely minor, but it wont load. I keep getting an error.

Code:
System.usbDiskModeActivate()
black = Color.new(0, 0, 0)
monopoly = Image.load("monopolyboard2.png")
screen:blit(=210, 1, "monopoly")
screen:flip()
screen:print(272, 1, "Monopoly Board", black)
screen.flip()
while true do
screen.waitVblankStart()
end
There's an unnecessary "=" when you blit the image.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:55 PM   #52

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

Quote:
Bilo screen:blit(=210, 1, "monopoly")

that should be

screen:blit(210, 1, monopoly)
I tried that and i got

error: index.lua:4: bad argument #2 to 'blit' (Image expected, got s
tring)
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 02:58 PM   #53
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by cools
I tried that and i got

error: index.lua:4: bad argument #2 to 'blit' (Image expected, got s
tring)
monopoly shouldn't be in quotes.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 03:01 PM   #54

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

Thank You I have finally got it to load where I want IT!!!
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 03:02 PM   #55
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

Quote:
Originally Posted by cools
I tried that and i got

error: index.lua:4: bad argument #2 to 'blit' (Image expected, got s
tring)
I said it shouldn't be in quotes.

If you look at what I posted.
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 04:43 PM   #56

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

im sorry that is my mistake...
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 05:16 PM   #57
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

lol, it's alright mate, don't be sorry

Hope your scriptin's going well
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 05:24 PM   #58
Advanced PSP Coder
 
Virtue's Avatar
 
Join Date: Oct 2005
Location: Down South
Posts: 426
Trader Feedback: 0
Default

Can anyone explain how to make a Lua program availible to boot outside Lua? Like with an ebbot, so its in the list of games on the Memory Stick? Thanks!
__________________
[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]
Virtue is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 05:27 PM   #59
 
Bilo's Avatar
 
Join Date: Sep 2005
Location: In your garage
Posts: 73
Trader Feedback: 0
Default

Pull the eboot's from another lua app.

Then edit the eboot in the (%) folder to change the icon/name.

Thats it.

There's probably a different way but this way works.

Last edited by Bilo; 10-04-2005 at 05:30 PM..
Bilo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2005, 06:35 PM   #60
NDS Mod
 
MagicianFB's Avatar
 
Join Date: Jul 2005
Location: w00+land
Posts: 645
Trader Feedback: 0
Default

Quote:
Originally Posted by Virtue
Can anyone explain how to make a Lua program availible to boot outside Lua? Like with an ebbot, so its in the list of games on the Memory Stick? Thanks!
Do you mean like Lowser?
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
MagicianFB is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
code , lib , lua , luaplayer , noobs , programming , psp programming , scripting , thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 12:28 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us