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 > Developer's Dungeon
The above video goes away if you are a member and logged in, so log in now!

I need a help ! (LUA code sample)

This is a discussion on I need a help ! (LUA code sample) within the Developer's Dungeon forums, part of the PSP Development Forum category; Hi everyone ! (So first..my english is soo weak so i try to do my best ! ) I really ...

Reply
 
LinkBack Thread Tools
Old 10-29-2009, 02:11 PM   #1
 
Nil3E's Avatar
 
My Mood: Amazed
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
Exclamation I need a help ! (LUA code sample)

Hi everyone ! (So first..my english is soo weak so i try to do my best ! )
I really need your help,guys...

I need a piece of LUA code....
1.Initalize WiFi connection Then
2.Connect via socket to my domain at port 80
3.Download a file (001.jpg)
4.Show 001.jpg on PSP screen
When i press a right..
The PSP going to delete 001.jpg from RAM and download 002.jpg and show it!
When i press a right..
The PSP going to delete 002.jpg from RAM and download 003.jpg and show it!
When i press left...
The PSP going to delete 003.jpg from RAm and download 002.jpg again and show it !

++You know what i mean,kind like online picture viewer...I need to run it on Lua Player HM++

I really need this piece of code guys
So please,if you help me a bit and post/send me a sample code,...I like to learn it but i spent on it 8days but nothing,im realy frustrated so please help me

Thanks again...
I hope somebody help
Nil3E is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-31-2009, 06:54 AM   #2

 
mootjeuh's Avatar
 
Join Date: Nov 2008
Posts: 322
Trader Feedback: 0
Default

could someone move this to the lua help thread ?
and btw, you could also try posting your piece of code first, then I'm sure someone would take a look at it and tell you what you're doing wrong
also, I remember posting a download function for lua here somewhere, just search for it

EDIT: here's the download function

Last edited by mootjeuh; 10-31-2009 at 07:26 AM..
mootjeuh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-31-2009, 08:07 AM   #3

Developer
 
Nielkie's Avatar
 
Join Date: Jul 2006
Posts: 549
Trader Feedback: 0
Default

I'm not usually the one to hand out code, but I was bored.
For PGE Lua:
Code:
SERVER = "example.com"
MAX = 10


downloadedImages = {} --Why delete downloaded images?

function downloadAndDisplay(imageNumber)
	local filename = string.format("%03d.jpg", imageNumber)
	if not downloadedImages[imageNumber] then
		local url = string.format("http://%s/%s", SERVER, filename)
		pge.net.getfile(url, filename)
		downloadedImages[imageNumber] = true
	end
	
	local texture = pge.texture.load(filename)
	
	pge.gfx.startdrawing()
	pge.texture.draweasy(texture, 0, 0)
	pge.gfx.enddrawing()
	pge.gfx.swapbuffers()
	
	--texture /should/ be freed by the garbage collector, it might not be.
end


function main()
	local currentImageNumber = 1
	
	assert(pge.net.init())
	
	while true do
		pge.controls.update()
		
		local load = false
		if pge.controls.pressed(PGE_CTRL_LEFT) then
			currentImageNumber = currentImageNumber - 1
			load = true
		elseif pge.controls.pressed(PGE_CTRL_RIGHT) then
			currentImageNumber = currentImageNumber + 1
			load = true
		end
		
		if load then
			if currentImageNumber < 1 then
				currentImageNumber = 1
			elseif currentImageNumber > MAX then
				currentImageNumber = MAX
			end
			
			downloadAndDisplay(currentImageNumber)
			collectgarbage()
		end
	end	
end

main()
__________________


Nielkie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-01-2009, 10:24 AM   #4
 
Nil3E's Avatar
 
My Mood: Amazed
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
Default

Oh thank you soo much guys!
You really help me a lot....
Im sorry for bad thread section

mootjeuh:Thanks for this exaple,using your sample code i found a BIG mistake in my code,so now i can fix it,BIG thanks

Nielkie: Thanks,i recently try some things in PGE-LUA and your example help me a lot,so big thanks for you,too
Nil3E is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-05-2009, 11:55 AM   #5
 
Nil3E's Avatar
 
My Mood: Amazed
Join Date: Jul 2008
Real First Name: Ondra Rehacek
Location: Czech Republic
Just Played: SIREN : Blood Curse
Posts: 38
Trader Feedback: 0
Default

Me again...
First sorry for Double post...But i have a problem again
Nielkie: Your script freezes my PSP,everytime i loaded it...can you pls look at it and tell me what im doing wrong ? i found your script very useful and i want to use it but i cant...I know shi* about PGELua,so if you cant check it and send me a ZIP archive with right player and code Thank you.....I know you dont help n00bs with code but i would be grateful

Or somebody,pls can you send me a premade LUA or pgeLUA tutorial for download a image from internet using Wi-Fi : http://nil3e.net/ondra/dlf/back.JPG and show it on the PSP screen ?
if you help im gonna send you some of my points,i really need this sample for my next project ..and again i stuck on it... :////
I would be most grateful Thanks
Nil3E is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-05-2009, 02:09 PM   #6

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,315
Trader Feedback: 0
Default

Does pge.net.getfile block?
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-05-2009, 02:45 PM   #7
 
 
Join Date: Apr 2009
Real First Name: Morgan
Location: Around black mesa.
Just Played: SMB
Posts: 83
Trader Feedback: 0
Default

yes, it does.
indrora is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
code , lua , sample

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 01:25 AM.



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