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; player:width Do you really mean player.width? That for b loop is kind of useless. You're blitting the screen and then ...
-
03-13-2006, 02:23 PM #691QJ Gamer Green
- Registriert seit
- Jan 2006
- Beiträge
- 508
- Points
- 5.382
- Level
- 47
- Downloads
- 0
- Uploads
- 0
Do you really mean player.width?player:width
That for b loop is kind of useless.
You're blitting the screen and then clearing it. You're essentially doing nothing to the screen. ???
-
03-13-2006, 02:27 PM #692Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Im not sure. I based that part off of PSPMillionaire's tutorials. I'll try it later though. (Doing homework right now, or at least im supposed to ;) )
Geändert von Mast3r_Shak3 (03-13-2006 um 02:32 PM Uhr)

--XBL Gamertag: PhenoM904--
-
03-13-2006, 02:34 PM #693QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Altair, i get the error on line 314 whidch is thise line
also I'm pretty sure the error is only in the loadhighscore function because earlier I had called the function at the start and then had it print the highscore(so you knew what u had to beat) and it gave me the error that it cant display nil.Code:if write==1 then loadHighscore() if high<score then high=score saveHighscore() write=2 end end
-
03-13-2006, 02:35 PM #6946201ymereJ

- Registriert seit
- Jul 2005
- Ort
- Baltimore
- Beiträge
- 588
- Points
- 7.062
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Code:if write==1 then loadHighscore() if high<score then high == score saveHighscore() write=2 end end
-
03-13-2006, 02:53 PM #695Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Can anyone recommend (and link if possible) a good text editor?

--XBL Gamertag: PhenoM904--
-
03-13-2006, 02:59 PM #696QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
that wotn work because im not comparing the high variable and score variable right there. im assigning the high variable the value of the score variable because the save function saves the high variables
Zitat von Jeremy1026
-
03-13-2006, 03:13 PM #697Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Yeah, but with that. You are reassigning the high variable. Even though thats not how you would do it normally, I would give it a try

--XBL Gamertag: PhenoM904--
-
03-13-2006, 03:15 PM #698QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Zitat von MaSt3r_ShAk3
will get the width of the image "player"Code:player:width()
of course normally i would do something like
Code:player.width = player:width()
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-13-2006, 03:22 PM #699Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Hmm... But can anyone help me out with that error? My code is on the page before this. (And the reason that segment of code is there is to prevent the character from going offscreen when I move him)

--XBL Gamertag: PhenoM904--
-
03-13-2006, 03:47 PM #700Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
Check the first PSPMillionaire tutorial. It has a great highlighter for Context programmer's editor. I love it.
Zitat von MaSt3r_ShAk3
Zitat von Noriko
-
03-13-2006, 03:47 PM #701QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
player:width should be player:width() :PHmm... But can anyone help me out with that error? My code is on the page before this. (And the reason that segment of code is there is to prevent the character from going offscreen when I move him)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-13-2006, 03:49 PM #702Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hey guys! How do you make a picture overlap another picture? I have a normal picture and when you press a button the old picture is supposed to dissapear and a new one come. help please!
-
03-13-2006, 03:51 PM #703Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
Try that.Code:black=Color.new(0, 0, 0) player={} player[1]={x=240, y=250} screenwidth=480 - player:width() while true do screen:blit(0, 0, background, false) screen:blit(player[1].x,player[1].y,player) for a=0,10 do screen:blit(45*a, 45*b, spike) end for b=0,0 do screen:blit(45*a, 45*b, spike) end pad = Controls.read() screen:clear() if pad:left() then player[1].x = player.x - 2 end if pad:right() then player[1].x = player.x + 2 end screen.waitVblankStart() screen.flip() end
Zitat von Noriko
-
03-13-2006, 03:53 PM #704QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
make some variables at the beginning of your program to store the images.
myImage = Image.load("yeahyeah.png" )
newImage = Image.load("newimage.png" )
in your code for your x button use something like
if pad:cross() then myImage = newImage end
make sure your blitting command is outside of the pad:cross() statement
ex... screen:blit(100,100,myIma ge)Geändert von PSPMillionaire (03-13-2006 um 03:56 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/
-
03-13-2006, 03:57 PM #705Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
I think he did in his loading screen scipt, otherwise where would "player" come from in the second screen:blit? Either that or there is some made up image loading names going around here.
Zitat von Noriko
-
03-13-2006, 04:17 PM #706Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
thanks but I ran into a problem. When I run it and press the button, the top of the old image flickers at the top of the new image. Help please! Oh and how do you make it so the old image reappears when you let go of the button?
Zitat von PSPMillionaire
Geändert von Greenskull (03-13-2006 um 04:20 PM Uhr)
-
03-13-2006, 04:21 PM #707QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
to make it reappear put your blit command inside your pad:cross statement
could make these variables at the top of your code, or use the last, i forgot them lol..
imageOne = Image.load("whatever.png" )
imageTwo = Image.load("whatever.png" )
then your pad:cross() could look like so..
if pad:cross() then
screen:blit(100,100,image One)
else
screen:blit(100,100,image Two)
end
make sure you use screen:clear() in your while true do loop, right after it starts is a good place.Geändert von PSPMillionaire (03-13-2006 um 04:26 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/
-
03-13-2006, 04:32 PM #708Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
sorry I'm just learning to code. I need to put a while true statement? Can you show me waht you mean please?
Zitat von PSPMillionaire
-
03-13-2006, 04:41 PM #709QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
however your programming is looping, put the screen:clear() in the loop.
paste your code if you want, and still dont understandMy 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-13-2006, 04:45 PM #710Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
mind if I PM it to you? I don't want anyone stealing my idea...
Zitat von PSPMillionaire
-
03-13-2006, 04:45 PM #711QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
I know but thats what i want it to do. in my save funtion it saves the variable high. so if i didnt assign high the value of score to it it would save the same score as before. also you cant use == when its not part of a condition. so when i put that in it gives me an error telling me it wanted a = instead of a ==
Zitat von MaSt3r_ShAk3
-
03-13-2006, 05:26 PM #712Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Hmm... I successfully got the error to go away! Now I get the error "Attempt to call method "width" a nil value. Do I need to assign a direct value to "screen:width" intead of "480-player:width"?

--XBL Gamertag: PhenoM904--
-
03-13-2006, 05:27 PM #713Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
^^^^^
Zitat von PSPMillionaire
Zitat von Noriko
-
03-13-2006, 05:34 PM #714Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
NEVERMIND
and errors are evil
--XBL Gamertag: PhenoM904--
-
03-13-2006, 05:55 PM #715QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i have a question=-)
when using luaplayerwindows how do i get it to read images?1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
03-13-2006, 05:57 PM #716Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
what do you mean "Read"?
Zitat von slicer4ever
-
03-13-2006, 05:58 PM #717Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
In ConTEXT editor, how do you use the lua.chl?
EDIT: agh, nevermind I found out how... This coding stuff makes me all confused lol
--XBL Gamertag: PhenoM904--
-
03-13-2006, 06:01 PM #718QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
every time i use a script it always say: Image.load: Error loading image.
so how do i get it to load the image?1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
03-13-2006, 06:05 PM #719Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Post your script

--XBL Gamertag: PhenoM904--
-
03-13-2006, 06:08 PM #720QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i just want it to read my pics thats all but if what i have in mind doesn't work then i well post it
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been


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