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 GuitarGod1134 Did you search for some functions. THeres probaly one to blit an image at an angle. Ok ...
-
12-27-2006, 09:08 AM #4861
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Ummm.. there is 2 ways you could do this.
Zitat von GuitarGod1134
1) Take some of the code from Snake you know from the Lua Player
;)
2) Use some of HarleyG's tuts (there in C you have to convert them to Lua script)
I would go with snake cause there is no conversion. But here is the link to HarleyG's tuts.
http://www.psp-programming.com/forum...sg2555#msg2555

-= Double Post =-
And i think it is possible to read more than one line cause ive seen some text editors......
Geändert von pspfreak9 (12-27-2006 um 09:08 AM Uhr) Grund: Automerged Doublepost
-
12-27-2006, 09:17 AM #4862QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
You can only do that using the GU..
Zitat von Freshmilk
-
12-27-2006, 12:42 PM #4863Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von head_54us
sceGumRotateX() i think.
anyway, there was a rotation snippet for lua, but its really slow, and moves the image itself. so yeah.
your best bet it to learn C/C++ ans use oslib.--------------------------------------------------------------------------------------
-
12-28-2006, 08:32 AM #4864QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Shouldn't it be around the Z axis (as long the Z axis is pointing into the screen)
Zitat von Grimfate126
-
12-28-2006, 08:33 AM #4865QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Actually I believe the function is Gum.rotateXYZ(number,numb er,number)
-
12-28-2006, 10:29 AM #4866Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Can someone help. I get an error saying loop is ingettable or not gettable (if thats a word) at line 32. Also it may contain more errors lol.
Spoiler for Siege RPG:If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-28-2006, 10:55 AM #4867QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
screen:blit(0,0,battlegro und.png)
Needs to be
screen:blit(0,0,battlegro und)
-
12-28-2006, 11:07 AM #4868Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
ok now when i run it its just a black screen but i get no errors.
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-28-2006, 11:24 AM #4869Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von TacticalPenguin
well, i was talking about the C function. also, you dont have to change all 3 axes. you can also just do one axis. like:
sceGumRotateX()
sceGumRotateY()
sceGumRotateZ()
(convert that to lua)
-= Double Post =-
Zitat von head_54us
ah, yes, thats true. i totally ignored the Z axis for some reason. but that makes total sense.
-= Double Post =-
first, change line 32 to what tactical said. then, move the screen:clear() to the top of your while true do. why? because, when you have it at the bottom, the program draws everything in your loop, then when it gets to the very end, it sees the screen:clear() and clears the entire screen to black. (which is the default color.) thus, you see nothing. have your loop like this:
Zitat von GuitarGod1134
Code:while true do screen:clear() -- all the drawing/pad/other stuff -- screen.waitVblankStart() screen.flip() end
should work.Geändert von Grimfate126 (12-28-2006 um 11:24 AM Uhr) Grund: Automerged Doublepost
--------------------------------------------------------------------------------------
-
12-28-2006, 11:40 AM #4870
Music slows the game down
I am trying to add music to my game PSPOmok. It sounds great untill I get to the actual game, then it starts to get laggy, and sounds bad. It gets worse as you add more and more pieces. Does somone know a way I may be able to get it to sound better? They are XM files BTW.
-
12-28-2006, 12:33 PM #4871
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Convert your Xm to MP3 ;)
-
12-28-2006, 12:56 PM #4872Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
thanks grimfate ill try that.
-= Double Post =-
If your asking the question I think you are then you need to use an "and" like
Zitat von JOVENASO
Or whatever function you want.Code:pad = Controls.read() if pad:cross() and pad:square() then break end
-= Double Post =-
In my game when I use a weapon the weapon blits for like a millasecond because its in "if" statements. Is there anyway I can make it blit longer??
Heres my source
Spoiler for Siege RPG:
-= Double Post =-
In my game when I use a weapon the weapon blits for like a millasecond because its in "if" statements. Is there anyway I can make it blit longer??
Heres my source
Spoiler for Siege RPG:Geändert von GuitarGod1134 (12-28-2006 um 12:56 PM Uhr) Grund: Automerged Doublepost
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-28-2006, 08:01 PM #4873
I didn't think LUA Played MP3s. o_O Are you sure it does?
Zitat von pspfreak9
-
12-28-2006, 08:10 PM #4874
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Yes of course it does
-
12-28-2006, 08:33 PM #4875
Just tried it, didn't work. LUA does not read MP3s. :/
-
12-28-2006, 08:39 PM #4876
- Registriert seit
- Sep 2006
- Beiträge
- 484
- Points
- 8.718
- Level
- 62
- Downloads
- 0
- Uploads
- 0
What!!!! Huh how did you convert it??
-= Double Post =-
Oh wait sorry my mistake
it plays WAV files try converting it to that
-= Double Post =-
Sorry about that i was was thinking of C ;)Geändert von pspfreak9 (12-28-2006 um 08:39 PM Uhr) Grund: Automerged Doublepost
-
12-28-2006, 09:11 PM #4877QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Actually with the luaplayer mod by cools it can.
-
12-29-2006, 06:55 AM #4878
Well, I don't want to waste my time recoding everything twice only to find out it didn't make it faster. So are you sure that if I use the mod to run MP3s instead of XMs, the music will run smoother? :/
Zitat von TacticalPenguin
-
12-29-2006, 05:50 PM #4879QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
Here is a useful post from Zion, creator of Linken's Quest, that teaches you how to make your game able to run in XMB:
http://www.psp-hacks.com/forums/about40812.html
just thought this was helpful and decided to post it up. :)[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-30-2006, 02:03 AM #4880QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
Hi everyone!
I'm currently working on LuaMM or LuaMusicMaker.
Right now its just a couple of mp3 sounds, which you can play at the same time.
But i need to know:
How do i load more than one mp3 sound?
It just says:
Mp3.load("my file goes here.mp3")
And Mp3.play()
How do i create more variables with it?
Sorry im not so experienced in lua...My PSP Projects:
___________________
None.
-
12-30-2006, 03:48 AM #4881QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
try thinking of it as an image sorta.
photo = Image.load(blahblah)
music = Mp3.load(blahblah)
edit - hehe i dont know how i double posted...Geändert von EminentJonFrost (12-30-2006 um 07:31 AM Uhr) Grund: Automerged Doublepost
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-30-2006, 04:04 AM #4882QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
Allright, that helped! Thx!

-= Double Post =-
Wait... now it gives me an error.
I'll just post my main script.
--Colors
white = Color.new(255, 255, 255)
--Loading
screen.waitVblankStart(60 )
screen
rint(194, 136, "Loading Images...", white)
screen.flip()
background = Image.load("bg.png")
screen:clear()
screen
rint(194, 136, "Done.", white)
screen.flip()
screen.waitVblankStart(40 )
screen:clear()
screen
rint(194, 136, "Loading Sounds...", white)
screen.flip()
Guitar = Mp3.load("guitar.mp3")
Guitar2 = Mp3.load("guitar2.mp3")
Drum = Mp3.load("drum.mp3")
screen:clear()
screen
rint(194, 136, "Done.", white)
screen.flip()
screen.waitVblankStart(40 )
screen:clear()
screen
rint(194, 136, "Loading LuaMM", white)
screen.flip()
screen.waitVblankStart(60 )
screen:clear()
screen:blit(0, 0, background, false)
screen.flip()
oldpad = Controls.read()
while true do
pad = Controls.read()
if pad:cross() then
Guitar
lay()
end
if pad:circle() then
Guitar2
lay()
end
if pad:triangle() then
Drum
lay()
end
if pad:start() then
break
end
oldpad=pad
end
The error says: "attempt to index global "drum" (a nil value)
And it says that with drum, guitar, and guitar2.Geändert von gameo (12-30-2006 um 04:04 AM Uhr) Grund: Automerged Doublepost
My PSP Projects:
___________________
None.
-
12-30-2006, 04:18 AM #4883Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Then your variables are not being loaded correctly. Check the directories and all that stuff and make sure your loading them right.
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-30-2006, 09:09 AM #4884QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- BEHIND YOU!!
- Beiträge
- 1.061
- Points
- 6.453
- Level
- 52
- Downloads
- 0
- Uploads
- 0
And you can also get rid of that screen.waitVblankStart(60 ) in the beginning of your code. It is pointless to have that there.
[url=http://xs.to][img]http://xs313.xs.to/xs313/07106/wmnp8z.png[/img][/url]
What's a recovery.elf
[QUOTE=iball]
He's the one that fixes Santa's sleigh when it breaks down[/QUOTE]
[QUOTE=Deturbanator]why are we allowed to see the whole flesh and being of the boob but we MUST blur out the tit?[/QUOTE]
[PRE][B]sg57 i love you for turning on the light of homebrew when i was in the darkness of sony[/b][/pre]
-
12-30-2006, 10:07 AM #4885QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
I have it to make the loading a little serious... else you wont reach to see anything.
But the problem is, there is NO error! I don't know why it says so.My PSP Projects:
___________________
None.
-
12-30-2006, 01:52 PM #4886words 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
Guitargod - Somehow I think it wouldve told him it couldnt find/load the MP3 when loading it, not playing it *rolls eyes*
gameo - I havent messede with the MP3 capable Lua Player library before, but Im positive a sound effect, such as a drum or guitar, should be played using the Sound System (WAV). Convert the MP3's to WAV, get a good sound + good size, and do a simple:
Oh and your doing that whole oldpad new pad thing pretty obviously wrong ('pad' isnt even being manipulated at all...)Code:guitar = Sound.load("guitar.wav") ... guitar:play()
...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
-
12-31-2006, 02:50 AM #4887QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
I did that when i was using LuaPlayer v0.18.
Zitat von SG57
They gave me the error: ERROR Loading sound.
So i started on Luaplayer v0.20 and converted them to Mp3's.My PSP Projects:
___________________
None.
-
12-31-2006, 03:42 AM #4888Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Ok ok . gosh just made that guess by the look of his erros. and besides mp3's are usually used for background music not really for game sounds. theres another way to load wav files it says in evilmana. did u try that way?
Spoiler for What evilmana has to say..:
http://evilmana.com/tutorials/lua_tutorial_10.phpIf you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
12-31-2006, 04:15 AM #4889QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
A little more confusing, but i may just try that...
My PSP Projects:
___________________
None.
-
01-01-2007, 10:14 AM #4890QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Hi, I need help with my highscore saving code. I have a file called scorefile in the same directory as this file is:
function saveHighscore()
file = io.open(scorefile, "w")
if file then
file:write(score[1].s1)
file:close()
end
end
function loadHighscore()
file = io.open(scorefile, "r")
if file then
oldhigh = file:read("*n")
file:close()
end
end
I have this code too:
if score[1].s1 > oldhigh then
saveHighscore()
end
I get the error:
Error: level1.lua:112: bad argument #1 to 'open' (string expected, got nil)
Thanks,
Nicko01


LinkBack URL
About LinkBacks
Mit Zitat antworten
thanks

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum