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; It still doesnt. It has to do with the pixel checking part. Code: gamebackground:fillRect(PixelRX + 1, PixelRY + 1, 9, ...
-
02-24-2006, 01:50 PM #541Psp Dev

- Registriert seit
- Jun 2005
- Ort
- Nebraska
- Beiträge
- 228
- Points
- 5.664
- Level
- 48
- Downloads
- 0
- Uploads
- 0
It still doesnt. It has to do with the pixel checking part.
Code:gamebackground:fillRect(PixelRX + 1, PixelRY + 1, 9, 9, red) gamebackground:fillRect(PixelLX + 1, PixelLY + 1, 9, 9, blue) Color1 = gamebackground:pixel(PixelRX , PixelRY) Color2 = gamebackground:pixel(PixelRX+11, PixelRY) Color3 = gamebackground:pixel(PixelRX, PixelRY+11) Color4 = gamebackground:pixel(PixelRX+11, PixelRY+11) Color5 = gamebackground:pixel(PixelLX, PixelLY) Color6 = gamebackground:pixel(PixelLX+11, PixelLY) Color7 = gamebackground:pixel(PixelLX, PixelLY+11) Color8 = gamebackground:pixel(PixelLX+11, PixelLY+11) timer2 = timer2 + 0.1 -- create a delay if timer2 >= 0.7 then if Color5 == red or Color5 == blue or Color6 == red or Color6 == blue or Color7 == red or Color7 == blue or Color8 == red or Color8 == blue then LastSet = 9 gameover() end end timer = timer + 0.1 -- create a delay if timer >= 0.7 then if Color1 == red or Color1 == blue or Color2 == red or Color2 == blue or Color3 == red or Color3 == blue or Color4 == red or Color4 == blue then LastSet = 12 gameover() end end
-
02-24-2006, 02:19 PM #542
hmm maybe i was wrong about what i said earlier. I saw the samething in someone elses code, but still this one is more general.
Your code is kinda difficult to understand. I get the general idea, but i don't know all the variables. For instance what is pixelRX? Does it mean the x-coordinate of the right side? But i don't know of what. Are you sure its in the pixelchecking part?
Also what error do you get?
EDIT: Never mind it just goes to game over, right?LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
02-24-2006, 02:21 PM #543
Hey Soadnation, how's your game going?
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
02-24-2006, 02:23 PM #544QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
well i got my psp confiscated at school that day. now i have it back and im gona learn tables right now. when i make a table can i have it save all the xvars in a table(with a randomly generated number behind it) and then have a movement function that just subtracts the speed from every variable withing the table? because i want them to have independent x vars but i wont them to move at the samew spped.
Geändert von soadnation (02-24-2006 um 02:27 PM Uhr)
-
02-24-2006, 03:10 PM #545Psp Dev

- Registriert seit
- Jun 2005
- Ort
- Nebraska
- Beiträge
- 228
- Points
- 5.664
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Hey Altair can you contact me Via aim or Msn. I can explain it easyer then over a forum.
Aim: El Legato Sin
Msn: [email protected]
-
02-24-2006, 04:42 PM #546
@soadnation
I just kinda learned tables todo :P. You can't just say [tablename]=[tablename]-1, unfortunately. However it's possible. You have to use a for loop. Atleast thats what i use and it works perfectly!
@MikePiP
I do have MSN. However I'm (almost) never online. Also ill be gone for a week after tomorrow afternoon (is that how you say it?), so i wont be able to help you then but afterwards i'd like to help.
Maybe you can PM me your whole code? If you thrust me with it, that is. Thats probably the fastest way for now.LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
02-24-2006, 05:14 PM #547QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
i know i couldnt just tell the table to subtract the speed but would there be a command to subtract the speed from every variable in the table?
-
02-24-2006, 08:03 PM #548QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
should be able to do that with a "for" loopi know i couldnt just tell the table to subtract the speed but would there be a command to subtract the speed from every variable in the table?My lua tutorials for PSP - www.evilmana.com/tutorials
PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/
-
02-26-2006, 12:57 AM #549
......
Zitat von Sir Crx
-
02-26-2006, 10:46 AM #550is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
guys, i can't seem to find any decent wa of making a small digital clockim trying to make a small bar for the top of my screen that shows the battery percent and the time digitally next to it, if anyone could help me that would be cool
my program keeps sayin :61 <eof> exptected near "end"
its only 61 lines long
wat does this mean? How do i fix thisGeändert von Glynnder (02-26-2006 um 12:34 PM Uhr)
-
02-26-2006, 11:56 AM #551is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
plz delete
Geändert von Glynnder (02-26-2006 um 12:33 PM Uhr) Grund: delete
-
02-27-2006, 07:30 PM #552QJ Gamer Blue
- Registriert seit
- Feb 2006
- Ort
- Portugal
- Beiträge
- 60
- Points
- 4.301
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Just a question!
How do you generate a random number?
Lets say between 0 and 100?
Just started in lua and im exploring still so sorry if its a noob question.
-
02-27-2006, 08:42 PM #553
-
02-27-2006, 09:24 PM #554QJ Gamer Blue
- Registriert seit
- Feb 2006
- Ort
- Portugal
- Beiträge
- 60
- Points
- 4.301
- Level
- 41
- Downloads
- 0
- Uploads
- 0
tnkx m8
really apreciated.
-
02-27-2006, 09:44 PM #555words 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
Your missing an 'end' at the end of your function, or you didnt close the loop, or an if statement, etc.
Zitat von Glynnder- PSPro
And I wouldnt request for battery life, digital clock, etc. Your basically asking for people to do your code, wheres the fun of that? Just make an integer that increases as the SysClock() increases and have a boolean that will determine if the integer has gone past 60 (seconds), then reset the integer to 0, and add 1 (minute) to the time (make it an integer that will display in the right hand corner). Same goes for hours.
Or just search for some app/source with it in it,
Windows Shell? possibly
...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
-
02-28-2006, 04:37 AM #556is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
I worked out the battery life but i needed the clock so thanx for sysclock()
Hod do you check if you havn't closed everything because i think there may be one thing i havnt closed
-
02-28-2006, 04:57 AM #557
show us the code so we can find it
try: add "end" onto line 61
-
02-28-2006, 06:11 AM #558QJ Gamer Blue
- Registriert seit
- Feb 2006
- Ort
- Portugal
- Beiträge
- 60
- Points
- 4.301
- Level
- 41
- Downloads
- 0
- Uploads
- 0
K when i run the small program that im making theres an error that says:function DrawSelection(choice)
if choice = 0 then
screen:blit(391,74,Select )
choice = 6
end
if choice = 1 then
screen:blit(21,74,Select)
end
if choice = 2 then
screen:blit(95,74,Select)
end
if choice = 3 then
screen:blit(169,74,Select )
end
if choice = 4 then
screen:blit(243,74,Select )
end
if choice = 5 then
screen:blit(317,74,Select )
end
if choice = 6 then
screen:blit(391,74,Select )
end
if choice = 7 then
screen:blit(21,74,Select)
choice = 1
end
return choice
end
1stprg.lua :15: 'then' expected near '='
that error is in line 15, and that's the first IF in the function.
this is my 1st program ever so im a bit noob
-
02-28-2006, 07:14 AM #559
in the if statements use == instead of =
-
02-28-2006, 08:16 AM #560QJ Gamer Blue
- Registriert seit
- Feb 2006
- Ort
- Portugal
- Beiträge
- 60
- Points
- 4.301
- Level
- 41
- Downloads
- 0
- Uploads
- 0
thanks again tuna, game menu is working graphicaly speaking, i hope i can get hrough with this
thanks again
-
03-01-2006, 03:12 AM #561is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
OK, when i get home ill post the code. Its REALLY basicbecause its not finishd
I don't really know if anyone would post this but how would i/ what is the script for making a click function for a cursor? maybe I could use collisions so when the cursor graphic collides with the button graphic and x is pressed it loads what the button links to, if something like that wont work then i can do it in other ways but it must do (crazy paint PSPaint)
thanxGeändert von Glynnder (03-01-2006 um 07:09 AM Uhr)
-
03-01-2006, 04:55 PM #562QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
im still having problems with the tqables. does anyone know a good table tutorial
-
03-03-2006, 12:48 PM #563is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
theres my code plz say why theres da eroordblue = Color.new(0, 0, 255)
red = Color.new(230, 0, 0)
pink = Color.new(255, 0 , 153)
blue = Color.new(0 , 153, 255)
orange = Color.new(255, 102, 0)
gray = Color.new(153, 153, 153)
black = Color.new(0 , 0 , 0)
white = Color.new(255, 255, 255)
screen:Print(194, 136, "loading: 0%", red)
screen.flip()
background = Image.load("images/home.png")
screen:clear()
screen:Print(194, 136, "loading 20%", pink)
screen. flip()
pstype = Image.load("images/pstypebutton.png")
screen:clear()
screen:Print(194, 136, "Loading: 40%", pink)
screen.flip()
psdraw = Image.load("images/psdrawbutton.png")
screen:clear()
screen:Print(194, 136, "Loading: 60%", pink)
screen.flip()
pscalc = Image.load("images/pscalcbutton.png")
screen:clear()
screen:Print(194, 136, "Loading: 80%", pink)
screen.flip()
links = Image.load("images/linksbutton.png")
screen:clear()
screen
rint(194, 136, "Loading: 90%", pink)
screen.flip()
apps = Image.load("images/apps.png")
screen:clear()
screen
rint(194, 136, "Loading: 100%", pink)
screen.flip()
screen.waitVblankStart(60 )
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(24 0)
while true do
screen:blit(0, 0, background, false)
pad = Controls.read()
screen
rint(465, 0, tostring(System.powerGetB atteryLifePercent()) .. "%")
end
end
-
03-03-2006, 01:11 PM #564QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Glynnder, I'm guessign its cause you have an extra end at the end of your code that's not closing nothing. Btw, instead of writing all those loading screens, just make a function for it. Like this:
Code:dblue = Color.new(0, 0, 255) red = Color.new(230, 0, 0) pink = Color.new(255, 0 , 153) blue = Color.new(0 , 153, 255) orange = Color.new(255, 102, 0) gray = Color.new(153, 153, 153) black = Color.new(0 , 0 , 0) white = Color.new(255, 255, 255) LoadingSplash=function(NUM) local COLOR=pink if NUM==0 then COLOR=red else COLOR=pink end screen:clear() screen:print(194,136, "loading: " ..NUM.. "%",COLOR) screen.waitVblankStart() screen.flip() end LoadingSplash(0) background = Image.load("images/home.png") LoadingSplash(20) pstype = Image.load("images/pstypebutton.png") LoadingSplash(40) psdraw = Image.load("images/psdrawbutton.png") LoadingSplash(60) pscalc = Image.load("images/pscalcbutton.png") LoadingSplash(80) links = Image.load("images/linksbutton.png") LoadingSplash(90) apps = Image.load("images/apps.png") LoadingSplash(100) screen.flip() screen.waitVblankStart(240) while true do pad=Controls.read() screen:blit(0,0,background,false) screenrint(465,0,tostring(System.powerGetBatteryLifePercent()) .. "%") end
-
03-03-2006, 05:32 PM #565QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
ell i gave up on the tables because i had a stroke of genuis(well kind of). i thought of a way to get it to work. right now i have the pole generation about half way done(haver it spawning 1 nicely) all i have to do is make it spawn the other ones and then add collisions(should be easy using the pspgolf code)
-
03-03-2006, 10:09 PM #566is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Cool, thanks XteticX i got rid of the xtra end and a couple of other things and now it works well
-
03-04-2006, 04:37 PM #567QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
umm can i have some help on shooting kunai for my game ok this is what i put right now i dont think its right though
if pad: circle() then
kunai = x + 4
basically it suppose to shot he kunai (which is already loaded) acorrding to naruto's direction
if he is facing >>> like that then it shoots right if he facing <<<< like that then it shoots left, any help would be appricated.. also the kunai is kunai_l (for left) and kunai_r (for right)[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
03-04-2006, 06:08 PM #568QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
i've got a bullet tutorial...may or may not help you for this. see signature below
My lua tutorials for PSP - www.evilmana.com/tutorials
PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/
-
03-04-2006, 06:08 PM #569QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
yes i took a look at this but my game is 2Demension not from a top down view.
Zitat von PSPMillionaire
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
03-04-2006, 06:24 PM #570QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
if your project isn't too big you can zip it and email it to me and i'll take a look at it. or you can post more complete code. the above code didn't tell us very much.
Geändert von PSPMillionaire (03-04-2006 um 06:27 PM Uhr)
My lua tutorials for PSP - www.evilmana.com/tutorials
PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/


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