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 Jeremy1026 in a standalone eboot the "break" command simply restarts the lua application. Ohhh ok. Then I have ...
-
08-10-2006, 07:33 PM #3151QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Ohhh ok. Then I have no idea.
Zitat von Jeremy1026
-
08-10-2006, 07:51 PM #31526201ymereJ

- Registriert seit
- Jul 2005
- Ort
- Baltimore
- Beiträge
- 588
- Points
- 7.062
- Level
- 55
- Downloads
- 0
- Uploads
- 0
it is actually a good thing to have in your code as u edit, so u dont have to reboot your game to test the changes, just press start. gets rid of the time it takes to display the gameboot.
Zitat von PSPduh
-
08-11-2006, 07:10 PM #3153Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
actually "break" doesnt exit the program. it only exits the loop. so if u had two loops, it would transfer the control to the other loop.
-= Double Post =-
okay, n00b question:
this is my code:
Code:-- loaded images health1 = 100 health2 = 100 hit1 = "false" hit2 = "false" -- added the bullet stuff function collision() for g = 1, 10 do if (BulletInfo[g].x < Player[2].x + 32) and (BulletInfo[g].x > Player[2].x) and (BulletInfo[g].y < Player[2].y + 32) and (BulletInfo[g].y + 5 > Player[2].y) then BulletInfo[g].firing = false hit2 = "true" end end for h = 1, 10 do if (BulletInfo2[h].x < Player[1].x + 32) and (BulletInfo2[h].x > Player[1].x) and (BulletInfo2[h].y < Player[1].y + 32) and (BulletInfo2[h].y > Player[1].y) then BulletInfo2[h].firing = false hit1 = "true" end end end function health() if health1 < 0 then health1 = 0 end if health2 < 0 then health2 = 0 end if (hit1 == "true") then health1 = health1 - 10 hit1 = "false" end if (hit2 == "true") then health2 = health2 - 10 hit2 = "false" end if health1 == 0 then screen:clear() screen:blit(0, 0, win2) fire = false end if health2 == 0 then screen:clear() screen:blit(0, 0, win1) fire = false end end while true do collision() health() screen.waitVblankStart() screen.flip() end
the problem is, even if one bullet hit the enemy, his health goes all the way down to 0 insted of just lowering by 10.
help.Geändert von Grimfate126 (08-11-2006 um 07:10 PM Uhr) Grund: Automerged Doublepost
--------------------------------------------------------------------------------------
-
08-11-2006, 07:28 PM #3154I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
How about in your function collision, instead of "hit2 = "true"" or "hit1 = "true"", just put, health1 = health1 - 10

-
08-11-2006, 07:37 PM #3155Developer

- Registriert seit
- Feb 2006
- Ort
- Tauranga, New Zealand
- Beiträge
- 355
- Points
- 5.162
- Level
- 46
- Downloads
- 0
- Uploads
- 0
You can exit from LuaPlayer using os.exit()
I never saw the point of that function when you could just use os.exit()
Zitat von LMelior

-
08-11-2006, 07:41 PM #3156I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
Darnet! I wished I known that earlier. Too late now, I've already coded the program. It would be too much work to put that in. Guess I'll have to settle with the home button.
Zitat von TheEmulatorGuy

-
08-11-2006, 07:44 PM #3157Developer

- Registriert seit
- Feb 2006
- Ort
- Tauranga, New Zealand
- Beiträge
- 355
- Points
- 5.162
- Level
- 46
- Downloads
- 0
- Uploads
- 0
This gives me more incentive to kill the people who gave the wrong advice.
Zitat von Access_Denied

-
08-11-2006, 07:51 PM #3158Developer

- Registriert seit
- Jun 2006
- Ort
- USA, Virginia
- Beiträge
- 580
- Points
- 5.650
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Hey, i just said the break function didnt work.. im no uber leet progger so dont kill me, BTW, does that acctualy work?
-
08-11-2006, 07:56 PM #3159Developer

- Registriert seit
- Feb 2006
- Ort
- Tauranga, New Zealand
- Beiträge
- 355
- Points
- 5.162
- Level
- 46
- Downloads
- 0
- Uploads
- 0
I wasn't referring to you. Yes, it does work. I use it in ID3PSP.
Zitat von Branin

-
08-11-2006, 08:25 PM #3160Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
then the same thing happens.
Zitat von Access_Denied
--------------------------------------------------------------------------------------
-
08-11-2006, 08:30 PM #31616201ymereJ

- Registriert seit
- Jul 2005
- Ort
- Baltimore
- Beiträge
- 588
- Points
- 7.062
- Level
- 55
- Downloads
- 0
- Uploads
- 0
you would be adding like, 4 lines of code at most, 10 times...
Zitat von Access_Denied
-
08-11-2006, 09:04 PM #3162I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
No, I would have to reconfigure 2 menus and change graphics again, and I've already had to do it twice, so I'm tired of doing it.

-
08-11-2006, 10:41 PM #3163is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
I was gonna reccomend system.quit
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-11-2006, 11:04 PM #3164Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
im trying to add a timer in my script, but i put this in :
but i getcounter = Timer.new()
counter:start()
if counter > 1000 then
screen
rint(12,0,"> 1", black)
end
wtf?! ive used timers before but this has never happenederror: fight.lua:16: attempt to compare number with userdata
-
08-11-2006, 11:10 PM #3165is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
sorry, i cant help you, i've never used a timer in anything, cos i do games not apps, its not really used in apps.
But i will be using it in luamainframe2What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-11-2006, 11:11 PM #3166QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
@Noobkiller, it's because you are comparing the timer itself. It needs to be:
Code:if counter:time() > 1000 then --do stuff here end
-
08-11-2006, 11:16 PM #3167QJ Gamer Blue
- Registriert seit
- Jul 2006
- Ort
- Alabama
- Beiträge
- 142
- Points
- 4.241
- Level
- 41
- Downloads
- 0
- Uploads
- 0
if counter:time() > 1000 then
-
08-12-2006, 05:16 AM #3168is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
already bin answered

-= Double Post =-
Code:-- default options]] options = { navspeed = 1, autoscroll = "on", netlib = "off", wavlib = "off", bmplib = "off", diskmode = "off", start2quit="on", lowbattpercent = 3, overclock = "off", scetrick = "yes" } -- possible options for menu possibleOptions = { navspeed = { displayName = "NavSpeed", values = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }, autoscroll = { displayName = "Auto-Scroll", values = { "on", "off" } }, netlib = { displayName = "Load Netlib", values = { "on", "off" } } wavlib = { displayName = "Load Wavlib", values = { "on", "off" } } bmplib = { displayName = "Load bmplib", values = { "on", "off" } } diskmode = { displayName = "USB at start", values = { "on", "off" } } start2quit = { displayName = "Start restarts luaplayer", values = { "on", "off" } } lowbattpercent = { displayName = "Low battery %", values = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } } overclock = { displayName = "Overclock PSP?", values = { "off", "222", "266", "333" } } scetrick = { displayName = "Using __SCE__ trick?", values = { "yes", "no" } } }
why isn't this working?
-= Double Post =-
anybody?Geändert von Glynnder (08-12-2006 um 05:16 AM Uhr) Grund: Automerged Doublepost
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-12-2006, 05:27 AM #31696201ymereJ

- Registriert seit
- Jul 2005
- Ort
- Baltimore
- Beiträge
- 588
- Points
- 7.062
- Level
- 55
- Downloads
- 0
- Uploads
- 0
whats you error glynnder?
-
08-12-2006, 05:36 AM #3170is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
sys.lua:24: '}' expected to close '{' at line 11 near 'bmplib'
line 11 is bmplib = {
displayName = "Load bmplib",
values = { "on", "off" } }
but even when i quote that so line 11 is diskmode or whatever, it still doesnt workGeändert von Glynnder (08-12-2006 um 05:47 AM Uhr)
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-12-2006, 06:18 AM #3171QJ Gamer Green
- Registriert seit
- Feb 2006
- Ort
- www.ultimatetalkforums.com Games, RPG, quickchat and more!
- Beiträge
- 532
- Points
- 8.746
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Ok...i decided to start coding again...but i need help...i need someone to help me make a 2 player simple game like...hmm...just a screen with lots of dots and 2 players withg a points count for each one and they collect the dots...and theres a timer at the top...please pm me if you will make this game...but lead me through it...so take it as a learning expirience...so whatever you do tell me what and how and what it does....
please pm me...thx[CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
[CENTER] [/CENTER]
[CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
[CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
[CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
[CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]
[COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]
-
08-12-2006, 06:26 AM #3172is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
shouldn't you do that to help familiarise yourself with the code again?
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-12-2006, 06:48 AM #3173Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
This just completely freezes my PSP in Luaplayer 0.20. What version do you use it in?
Zitat von TheEmulatorGuy
EDIT: I just tried System.Quit() using Cools' Luaplayer 0.20 and it works. So maybe Luaplayer 0.17dk2 didn't need that function but Luaplayer 0.20 mod by Cools does?Geändert von LMelior (08-12-2006 um 07:00 AM Uhr)
-
08-12-2006, 06:49 AM #3174is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
nothing seems to work in 0.20
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
08-12-2006, 07:04 AM #3175Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Oh yeah, as for your problem Glynnder (if you didn't fix it yet), you stopped using commas after each table entry.
-
08-12-2006, 10:30 AM #3176I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I have a question about reading .txt files. I have a program that reads an entire .txt file. That works fine. But, when it prints to the screen, it's one longe line. Is there a way that I can make it skip to the next line forming a paragraph?
Also, in the .txt file, I have it in paragraph form. But when it prints to the screen, at the end of the first line, I see a Musical note symbol and a big "O" printed in black with a white square around it. Does anyone know what that is?
-
08-12-2006, 10:45 AM #3177words 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
1. LUA Player is limited to that (see why LUA sucks dirt?) so you must make your own 'return' function, very easy though.
2. That musical note thing is *nix operator character of '\n' meaning 'newline'. ('\b' backspace, '\t' tab, etc.)...
I will make you such a function once I go and learn how LUA makes 2d arrays, to parse the 'text' you put in into a 2d array, and for every music note found, skip a line down and keep printing... Sorry i cant right now though, I didnt learn all of LUA's syntax back when i only knew it...
Until then, back to 3d Zelda clone......
...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
-
08-12-2006, 10:51 AM #3178Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hmm... my timer is f uped...... i put it after the loop, and it goes like 4 then 8 then 12 then 6 wtf? doesnt it go by thousands? and why is mine going by ones? i used :
counter = Timer.new()
counter:start()
if counter:time() > 4000 then
screen
rint(40,30,"> 4000",black)
counter:reset(0)
end
-
08-12-2006, 10:55 AM #3179I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
I think you put these lines before the loop.
counter = Timer.new()
counter:start()
-
08-12-2006, 11:15 AM #3180Asleep...

- Registriert seit
- Oct 2005
- Beiträge
- 1.383
- Points
- 11.516
- Level
- 70
- Downloads
- 0
- Uploads
- 0
im about to commit suicide from stupidity
last question:
how can i make a random number load... i.e a number bettween 1 and 3 eighter 1, 2, or 3 ?


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