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; as i said, there is no exact error message or line.....luaplayer just does not detect when the user presses start. ...
-
01-25-2007, 09:03 AM #5251QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
as i said, there is no exact error message or line.....luaplayer just does not detect when the user presses start.
I.E. You're at the main menu and you press start to start the app. however, the script does not do anything, just as if you had not pressed start or the controls detection was not there. i think that this could be the placement of my code.
-
01-25-2007, 09:29 AM #5252QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
edit. oops my bad
Geändert von myschoo (01-25-2007 um 11:10 AM Uhr)
[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]
-
01-25-2007, 10:59 AM #5253Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
It works fine for me on Luaplayer Windows, so the problem is most likely in your function countForm() since I had to take that out to run the code. Also, why do you always read the controls again to check for the start button? You could have done the same thing that you do when you check for the select button. You should also realize that since you don't clear the screen in this loop except when start is pressed, anything you blit when you press start will stay there (it will probably be flashing).
Zitat von parm289
-
01-25-2007, 12:03 PM #5254QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you only put "a" in the parantheses for screen
Zitat von parm289
rint(). you forgot coordinates and text color
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-25-2007, 12:42 PM #5255QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
That is the link to the full package/app that i have so far. It's a preview of whats coming next, but mainly its for people to help and look at the code.Code:http://www.sendspace.com/file/e16i9e
Eminent: i changed that a while ago, it was just one of my tests.
If you guys dont wanna d/l the whole package and just want to take a look at the countForm(), here it is:
a has already been declared as a = 0.Code:function countForm() if pad:r( ) then a = a+1 end if pad:l( ) then a = a-1 end screen:fontPrint(comic,0,0,a,white) screen.flip( ) screen.waitVblankStart(300) end
again, thanks for your help.
-
01-25-2007, 01:11 PM #5256
yea sorry i hadn't been on the computer in a while. i am going to try the PSpbrew first, and then if i don't get it i'll do that. thanks
Zitat von Dr.Gringo
-
01-25-2007, 01:54 PM #5257QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
Great card game....My WIP's - Egyptian Ratscrew
just had to say that lol good luck with it
Geändert von parm289 (01-25-2007 um 02:07 PM Uhr)
-
01-25-2007, 02:00 PM #5258
lol thanks. it hasn't been getting very much attention because of the super mario brothers game, but its coming along
Zitat von parm289
oh, and @ Dr.Gringo, i got it working using the PSPbrew, but thanks anyway!
-
01-25-2007, 02:06 PM #5259QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
no problem, i'm looking forward to it (*cough*beta test*cough* lol)!
anyway, i finally got the start button to be detected. it was the placement of the actual function countForm() declaration....
However, i still need to find out how to obtain a variable's contents as a string. For example, if a = 0, and i want to print the value of a to the screen, i don't know how to get the "0" value. I'm guessing from xml, javascript, and html experience that its an escape function, but I could be wrong. Either way, i have no clue if escape functions are even present in lua. I googled for help on this, but couldnt find any.
Again, thanks for your help and sorry for so many questions...I just have to get this ironed out before i can move on to the rest of my app.
EDIT: Looking around a little more, i found this:
I tried this as:
Zitat von evilmana.com forums
...but i still got the same result: a blank screen. I'm pretty sure this is how to turn the variable into a string, and i think this is the way to use it. I'm going to try it like this:Code:aString = tostring(a) screen:print(0,0,aString,white) screen:flip() screen.waitVblankStart(300)
and i'll report back.Code:tostring(a) screen:print(0,0,aS,white) screen:flip() screen.waitVblankStart(300)
EDIT2: Nope, the second way still returns a blank screen....I'll look around to see if i can find some info on it.
EDIT3: Well, i finally got it to work, and sorry for the epic post. This is the code i used:
Just so people can see how it works....now im gonna try to pull this app off tonight....Code:function countForm() local a = 0 if pad:r( ) then a = a+1 end if pad:l( ) then a = a-1 end aString = tostring(a) screen:fontPrint(comic,20,20,aString,white) screen.flip( ) screen.waitVblankStart(300) end
Geändert von parm289 (01-25-2007 um 02:37 PM Uhr)
-
01-25-2007, 02:47 PM #5260
yes! i am releasing my game today! the download link is below.
any criticisms and suggestions will be appreciated.
http://www.sendspace.com/file/csasz4
-
01-25-2007, 03:35 PM #5261QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
hmmmm.....i've been trying to get triangle to exit, and i've looked around the net and found that on the newer luaplayers, the only way to exit to the xmb is by loading an invalid .png. if anyone has the link to it or knows where i can find it, can you please post it? thanks!
-
01-25-2007, 03:38 PM #5262QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I need the same thing, so I used a mod of luaplayer released by cools:
http://forums.ps2dev.org/viewtopic.php?t=6858
the command is System.Quit()
(note the capitals,, as always)
-
01-25-2007, 03:44 PM #5263QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
i dont get it
Zitat von code
when i press left
it doesnt display the pic
-
01-25-2007, 03:44 PM #5264QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
psphakkor: i saw that in my searches, but i figured that most people would not have the luaplayer .20 mod, so i would need to something else.
wait - if i compile my game using pspbrew with the System:Quit() command, will it work? I.E. if my game is in eboot form and i call System.Quit(), will it exit to the xmb, or does the script have to be running under the luaplayer mod?
-
01-25-2007, 03:58 PM #5265QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
take out the screen.flip(), you already have one at the bottom. you dont need another. lol
Zitat von HeaD_ShOt
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-25-2007, 05:32 PM #5266
i think if you edited the eboot.pbp given from the luaplayer mod that it might work, i'm not sure
Zitat von parm289
-= Double Post =-
anybody ever tried that?Geändert von emericaska8r (01-25-2007 um 05:32 PM Uhr) Grund: Automerged Doublepost
-
01-25-2007, 06:43 PM #5267lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
System:Quit will need the LUA Player .20 Mod
I think only users who have this mod can use this function properly.
-
01-25-2007, 06:51 PM #5268words 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
Head_shoT - AS suggested, remove the screen.flip(). That will display the picture, and right after that, it reaches another screen.flip, and basically 'turns off' what you just drew to the screen (the image). The reason it doesnt even flash is because the screen hasnt met a vertical sync to start displaying it...

...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
-
01-26-2007, 02:56 AM #5269QJ Gamer Green
- Registriert seit
- Jan 2006
- Ort
- Melb, Aus
- Beiträge
- 530
- Points
- 5.923
- Level
- 49
- Downloads
- 0
- Uploads
- 0
i made this thread: http://forums.qj.net/f-psp-developme...ken-91010.html but it doesn't seem to be getting a whole lot of attention. could someone from here take a look at it. i tried the first lua tutorial and i can't get it working... :Cry:
i just wanna create...
All help apreciated!
-
01-26-2007, 03:09 AM #5270
theres a problem with your player, are you suing version 20? if so, redownload it and try the script again.i made this thread: http://forums.qj.net/f-psp-developme...ken-91010.html but it doesn't seem to be getting a whole lot of attention. could someone from here take a look at it. i tried the first lua tutorial and i can't get it working...
i just wanna create...
All help apreciated!
-
01-26-2007, 03:45 AM #5271QJ Gamer Green
- Registriert seit
- Jan 2006
- Ort
- Melb, Aus
- Beiträge
- 530
- Points
- 5.923
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Zitat von eyece
k will do and report back
Success! i can't believe it was that simple! thanks!Geändert von *Ollie* (01-26-2007 um 04:18 AM Uhr)
-
01-26-2007, 11:09 AM #5272QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
okay i have another question
when i am writing the path of a bullet
here is my attempt
i jsut want the bullet to move to the left side
Zitat von code
with this i never get the bullet to show
-
01-26-2007, 11:25 AM #5273QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
try thisCode:bullet = Image.load("bullet.png") Bullet = { x = 180, y = 128, image = bullet } function moveBullet() Bullet.x = Bullet.x - 5 end[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]
-
01-26-2007, 11:55 AM #5274QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
you merely forgot to blit it (or post that you did, if you did)
Zitat von HeaD_ShOt
Code:screen:blit(Bullet.x, Bullet.y, Bullet.image)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-26-2007, 12:15 PM #5275QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
eminent:
he can do that in while true do part cant he[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]
-
01-26-2007, 12:34 PM #5276
he just doesn't know if he does have that in his code or not. if he does already than not loading the image is the problem since both of those things aren't shown
Zitat von myschoo
-
01-26-2007, 01:20 PM #5277QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
that was it
how did i not notice that
thanks
<edit>
dumb errors
now i am having trouble wtih my AI
with teh error...
Zitat von code
Zitat von error message
Geändert von HeaD_ShOt (01-26-2007 um 02:20 PM Uhr)
-
01-26-2007, 03:14 PM #5278QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
well for one, i believe math.random() requires two numbers. (a minimum and a maximum). also, you have two "if stallchase == 1"s, which is redundant.
Zitat von HeaD_ShOt
...though it would be much more helpful if you said what line the error was, and pointed that line out. you might find the problem yourself...lolCode:math.randomseed(os.time() ) Player = { x = 205, y = 120, img = earth} Enemy = { x = 0, y = 120, img = ufo } function chasePlayer() stallchase = math.random(1,2) if stallchase == 1 then if Enemy.x > 205 then Enemy.x = Enemy.x - 2 elseif Enemy.x < 205 then Enemy.x = Enemy.x + 2 end if Enemy.y > 120 then Enemy.y = Enemy.y - 2 elseif Enemy.y < Player.y then Enemy.y = Enemy.y + 2 end end end[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-26-2007, 03:16 PM #5279
without a line number, i can only assume the error occurred at the first:
if stallchase == 1 then
witch would mean your random() is a dud.
edit:
to slow :PGeändert von eyece (01-26-2007 um 03:38 PM Uhr)
-
01-26-2007, 03:32 PM #5280QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
there is no line number for this error...


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