Zeige Ergebnis 6.901 bis 6.930 von 10238
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; Ok i tried that table.remove and it didnt work, and now im stuck again...
-
04-17-2007, 06:41 PM #6901QJ Gamer Gold
- Registriert seit
- Nov 2006
- Ort
- ...
- Beiträge
- 2.080
- Points
- 11.942
- Level
- 71
- Downloads
- 0
- Uploads
- 0
Ok i tried that table.remove and it didnt work, and now im stuck again
-
04-17-2007, 07:22 PM #6902QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
How would I make an image stay.
if pad:triangle() then
screen:blit(0, 236, start, true)
screen.flip()
end
That will work while I hold it down, but I want it to stay once its pressed once.
-
04-17-2007, 07:22 PM #6903
table.remove is so simple..
Zitat von Urameshi
-= Double Post =-
Use a bool variable.
Zitat von yumCOOKIEZZ
Geändert von Yonathan_Jantis (04-17-2007 um 07:22 PM Uhr) Grund: Automerged Doublepost
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 07:26 PM #6904QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
aka if pad:triangle() then showtheimage = true end
if showtheimage then screen:blit(x,y,theimage) end
-
04-17-2007, 07:33 PM #6905QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Thanks ;D
(I'm gonna try to cut down on questions -.-)
-= Double Post =-
When I did that it gives the same effect. The image is loading a lot of times and giving problemness.Geändert von yumCOOKIEZZ (04-17-2007 um 07:40 PM Uhr) Grund: Automerged Doublepost
-
04-17-2007, 07:46 PM #6906
..
in the begining
showstart = false
..main..
showstart = pad:triangle() or showstart
...
if showstart then screen:blit(0, 236, start, true) end牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 07:54 PM #6907words 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
Yonathan - Wouldn't 'showstart = pad:triangle()' do the same as his first method (where it shows only when held), as if tirnagle isn't being pressed, than return false, making showstart false, making it not blit hte image...

...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
-
04-17-2007, 08:00 PM #6908
Read the whole thing..
Zitat von SG57
showstart = pad:triangle() or showstart
btw this is youresam :P牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 08:07 PM #6909QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
And since it's an or statement, only one part must be true to make it true. So if showstart is already true it will remain true.
-
04-17-2007, 08:28 PM #6910QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
HIYA im back to the scene:)...
can anyone tell me how to make a menu selector go to right and left instead of up and down? coz my app will make too many menu...;)
-
04-17-2007, 08:42 PM #6911
*sigh*
Zitat von ai3gtmc
Change the coordinates.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 08:43 PM #6912QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I got what I wanted to work. When you scroll over the image, it will change. When you scroll off, it changes back. One problem is when ON the image itself theres a bit of lag and the cursor moves slowly. Is there any way to prevent this?
I can still work around it but it would be helpful to fix.
-
04-17-2007, 08:47 PM #6913QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
if i change coords i still need to use the up and down not right and left button right?>.<
Zitat von Yonathan_Jantis
-
04-17-2007, 08:49 PM #6914
Err...what?
Zitat von yumCOOKIEZZ
-= Double Post =-
...how are the buttons a problem??
Zitat von ai3gtmc
Geändert von Yonathan_Jantis (04-17-2007 um 08:49 PM Uhr) Grund: Automerged Doublepost
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 08:53 PM #6915QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
hmm my menu selection is a lil big.... so i want an up and down,left and right selection..
-
04-17-2007, 08:58 PM #6916
oh, and, thats a bit more complicated
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-17-2007, 09:00 PM #6917QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
yeah lol thats y i asked.. if its just the coords i wont ask lol
-
04-17-2007, 09:18 PM #6918QJ Gamer Blue
- Registriert seit
- Apr 2007
- Beiträge
- 81
- Points
- 3.525
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Zitat von Yonathan_Jantis
Uhg...How do I explain it...
There are 2 images. Exactly the same in size, shape, ect. Just some differing in colors. One will display no matter what. One will display when I scroll over to it. When the cursor (what I use to move with the analog) is over the image, the second image is written on top of the first.
Why am I explaining?...Heres the code.
showstart = false
if x > 0 and x < 50 and y >236 and y < 272 then showstart = true end
if x > 50 and y < 236 then showstart = false
if showstart then
starton = Image.load ("images/Start-Over.png")
screen:blit (0, 236, starton, true)
else
screen:blit(0, 236, start, true)
end
-
04-17-2007, 09:42 PM #6919words 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
tuhm... Simply change all 'down()' to 'left()' and all 'up()' to 'right()'. If you structure each menu option from left to right, you wont need to redo the entire menu code.
Guy above me - its cause you continually load your Start-Over.png once on it. Simply move it out of the infinite loop, not in your if statement.
...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
-
04-17-2007, 10:02 PM #6920QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
ok thx sg ill try after i buy a battery
-
04-18-2007, 12:02 AM #6921Monster Masher
- Registriert seit
- Jun 2006
- Ort
- Behind you...
- Beiträge
- 265
- Points
- 5.084
- Level
- 45
- Downloads
- 0
- Uploads
- 0
Id like to take this opporuntity to draw back to my problem
I get an error that in the collision if "attempt to index field "?" null value". There is a asteroidmed array, en_2 is equal to 1, there are several bullets, no_bull is the amount of bullets, there is an asteroidmed[1] and it has x and y coordinates, same as the bullet. However i see no difference with this code and my other one:Code:function MedCol() for y=1,en_2 do for u=1,no_bull do if asteroidmed[y].x+24>bullet[u].x and asteroidmed[y].x<bullet[u].x+6 and asteroidmed[y].y+24>bullet[u].y and asteroidmed[y].y<bullet[u].y+6 then score=score+20 asteroidsm[en_3+1]={x=asteroidmed[y].x, y=asteroidmed[y].y, width=32, height=32, vspeed=(math.random(0,1))-(math.random(0,2)), hspeed=(math.random(0,1))-(math.random(0,2))} en_3=en_3+1 asteroidmed[y].x=489346983 bullet[u].x=-99999999999 end end end end
Apart from the names. any help?!Code:function Collision() for f=1,en_1 do for g=1, no_bull do if asteroid[f].x+32>bullet[g].x and asteroid[f].x<bullet[g].x+6 and asteroid[f].y+32>bullet[g].y and asteroid[f].y<bullet[g].y+6 then score=score+20 asteroid[en_2+1]={x=asteroid[f].x, y=asteroid[f].y, width=32, height=32, vspeed=(math.random(0,1))-(math.random(0,2)), hspeed=(math.random(0,1))-(math.random(0,2))} en_2=en_2+1 asteroid[f].x=489346983 bullet[g].x=-99999999999 end end end end
I have tried a lot of things. What does the error mean? Uncalled table/variable?
-= Double Post =-
Never mind, I fixed that error (finally)Geändert von xmex (04-18-2007 um 12:47 AM Uhr) Grund: Automerged Doublepost
-
04-18-2007, 05:55 AM #6922QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
you can make menu with tables...
Zitat von ai3gtmc
so you will have only for example 5 lines on the screen which could be changed with left right[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-18-2007, 10:34 AM #6923QJ Gamer Blue
- Registriert seit
- Jul 2006
- Ort
- Upstate, NY USA
- Beiträge
- 121
- Points
- 4.349
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Could someone please explain how to make looping Backgrounds on a menu. Say 3 bgs' showing for 3 seconds a piece. If thats possible...
Thanks for the help guys :)
-
04-18-2007, 10:48 AM #6924Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
forget the fact that its a menu and ask yourself, how would I make a 3 frame animation? Theres craploads of tutorials out there that will help you with this, or look into the animlib.
-
04-18-2007, 11:01 AM #6925Monster Masher
- Registriert seit
- Jun 2006
- Ort
- Behind you...
- Beiträge
- 265
- Points
- 5.084
- Level
- 45
- Downloads
- 0
- Uploads
- 0
Is there a way to draw an image at an angle?
-
04-18-2007, 11:06 AM #6926QJ Gamer Blue
- Registriert seit
- Jul 2006
- Ort
- Upstate, NY USA
- Beiträge
- 121
- Points
- 4.349
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Zitat von KleptoOne
Damn... In the time it took you to write that you could have just copy/pasted the code snippet for me...
But I'll google animlib, to see what I can find out about it. Thanks for the heads up on that. :)
-
04-18-2007, 11:10 AM #6927Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Not really, unless you texture the image to triangles using the GU, then you can scale and rotate all you want. The only way I know of to do it without the GU is to copy the image pixel by pixel, running it through an algorithm that will angle it, but this process is so slow that you would have to buffer the created images into some type of array and it would eat up your memory quick depending on the size of the image.
-= Double Post =-
The reason I said that was because a lot of the newer programmers are getting lazy. When I was learning I would read everything I could get my hands on to figure something out, and if I needed help on something I always asked regarding the concept and not the code, because its the concepts that will allow you to jump into pretty much any language and be productive.
Zitat von psp phd
Chances are you already realize this and you're just being lazy, which I understand, but I personally can't promote.Geändert von KleptoOne (04-18-2007 um 11:15 AM Uhr) Grund: Automerged Doublepost
-
04-18-2007, 11:34 AM #6928QJ Gamer Blue
- Registriert seit
- Jul 2006
- Ort
- Upstate, NY USA
- Beiträge
- 121
- Points
- 4.349
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Zitat von KleptoOne
Actually, I have wrote a simple project in LUA and have since decided to pick up C instead. (I just needed something to get my feet wet with all this)
But - I thought it would be nice to do a 10 min. spiff up the lua project.
Lua was good to get comfortable with the basic concepts of programming. But I don't want to stuff my brain up with a bunch of info I'm never going to use again. LOL. C is much different from Lua. And the rules of C are what I have begin studying. Why confuse myself with more Lua stuff? I just wanted a quick code snippet to polish up & end my lua project. Then I dont plan on using Lua anymore...
EDIT: And I'm far from lazy bud... This is a hobby for me. I work 40+ hrs a week.
-
04-18-2007, 12:57 PM #6929
hii there people, im makings some test, and i im in a way to make more eficient process i have.... ok i have a value in a variable and i want another variable.. to be a poiter of the last one...soo..if:
var1 = 10
var2 = pointer of var1... then
when i do var1 = 20.. var2 automatically takes the var1 value... how can i do that ?
also i want to do this:
var1 ={x=1,y=1}
var2 ={x=2,y=2}
var3 = {{pointer of var1},{pointer of var2}}
soo when i change the values of var1.x the var3[1].x actomatically takes the value... how to do this in lua ? the point is that i wont redefine the var3 each time the others change his value.
-
04-18-2007, 02:00 PM #6930Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
A simple animation is the same regardless of the language that you use. You find a way to judge time and cycle through the images based on that. Also, none of us are being paid to do this, so given that its a hobby why would you want to cheat yourself of the learning process and ask for ready made code? I guarentee you that if you learned how to animate in lua, it would help you in C.
Zitat von psp phd


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