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 , maybe some ppl are gonna find me anoying but no one is ever answering this is my code: ...
-
05-07-2006, 05:15 PM #2131
OK , maybe some ppl are gonna find me anoying but no one is ever answering this is my code:
but my prob is how do i make an other command next time i press it like this:Code:if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 1 then Select:play() Drawcard = 1 end if Drawcard == 1 then drawCard() Points = Points + Pointstwo end
I wounld be glad if somone help's ME.Code:if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 1 then Select:play() Drawcard = 2 end if Drawcard == 2 then drawCardthree() Points = Points + Pointstwo + Pointsthree end
-
05-07-2006, 05:28 PM #2132Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von ZereoX
you could make a integer:
then do:Code:a = 0
so then "a" will be 2. and so on.Code:if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 1 then a = a+1 Select:play() Drawcard = a end
im not 100% that will work, but it shouldGeändert von Grimfate126 (05-07-2006 um 05:43 PM Uhr)
--------------------------------------------------------------------------------------
-
05-07-2006, 05:35 PM #2133
Tkz il try later on.
Other question how do i make a screenshot whit WindowsLUAplayer?
-
05-07-2006, 05:36 PM #2134TheMarioKartersGuest
Yeah, Grimfate126, that would work.
-
05-07-2006, 05:39 PM #2135QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
With the windows one, use this:
Zitat von ZereoX
Or I think it could be done like this also:Code:screen:save("screenshot.tga")
Then just open up the screenshot in paint. And I also think you could put .png if you dont like .tgaCode:if pad:cross() then screen:save("screenshot.tga") end
EDIT-Thanks monotrob!Geändert von PSPduh (05-07-2006 um 05:43 PM Uhr)
-
05-07-2006, 05:42 PM #2136Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von PSPduh
u can use tga?? i use .png--------------------------------------------------------------------------------------
-
05-07-2006, 05:44 PM #2137QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I just edited it. :) Yea because in the luaplayer windows, if you open up the test, then scroll all the way down to the bottom of it, it has that line. Plus it comes bundled with the screenshot.tga of the test program.
-
05-07-2006, 05:47 PM #2138Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von PSPduh
cool, i didnt kno that.:) i dunt use it anyway.
p.s. 700th post. yay!!!--------------------------------------------------------------------------------------
-
05-07-2006, 05:48 PM #2139
TKz work il use png next time
-
05-07-2006, 05:49 PM #2140Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von ZereoX
does the code work??or have u not tried it yet?--------------------------------------------------------------------------------------
-
05-07-2006, 05:49 PM #2141TheMarioKartersGuest
Yeah, png is better than tga.
-
05-07-2006, 06:41 PM #2142
grim when i start my game the 3 card's are already on the table i don't even have to press x. big prob.
-
05-07-2006, 06:43 PM #2143Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von ZereoX
can u pm me your whole code? im confused.--------------------------------------------------------------------------------------
-
05-07-2006, 06:49 PM #2144
here is my draw function: W and V are ranfom functions
here is my Hit and stand code:Code:function drawCard() if W == 1 then screen:blit(55, 165, Aceclover) elseif W == 2 then screen:blit(55, 165, Acediamond) elseif W == 3 then screen:blit(55, 165, Aceheart) elseif W == 4 then screen:blit(55, 165, Acespade) elseif W == 5 then screen:blit(55, 165, Twoclover) elseif W == 6 then screen:blit(55, 165, Twodiamond) elseif W == 7 then screen:blit(55, 165, Twoheart) elseif W == 8 then screen:blit(55, 165, Twospade) elseif W == 9 then screen:blit(55, 165, Threeclover) elseif W == 10 then screen:blit(55, 165, Threediamond) elseif W == 11 then screen:blit(55, 165, Threeheart) elseif W == 12 then screen:blit(55, 165, Threespade) elseif W == 13 then screen:blit(55, 165, Fourclover) elseif W == 14 then screen:blit(55, 165, Fourdiamond) elseif W == 15 then screen:blit(55, 165, Fourheart) elseif W == 16 then screen:blit(55, 165, Fourspade) elseif W == 17 then screen:blit(55, 165, Fiveclover) elseif W == 18 then screen:blit(55, 165, Fivediamond) elseif W == 19 then screen:blit(55, 165, Fiveheart) elseif W == 20 then screen:blit(55, 165, Fivespade) elseif W == 21 then screen:blit(55, 165, Sixclover) elseif W == 22 then screen:blit(55, 165, Sixdiamond) elseif W == 23 then screen:blit(55, 165, Sixheart) elseif W == 24 then screen:blit(55, 165, Sixspade) elseif W == 25 then screen:blit(55, 165, Sevenclover) elseif W == 26 then screen:blit(55, 165, Sevendiamond) elseif W == 27 then screen:blit(55, 165, Sevenheart) elseif W == 28 then screen:blit(55, 165, Sevenspade) elseif W == 29 then screen:blit(55, 165, eightclover) elseif W == 30 then screen:blit(55, 165, eightdiamond) elseif W == 31 then screen:blit(55, 165, eightheart) elseif W == 32 then screen:blit(55, 165, eightspade) elseif W == 33 then screen:blit(55, 165, Nineclover) elseif W == 34 then screen:blit(55, 165, Ninediamond) elseif W == 35 then screen:blit(55, 165, Nineheart) elseif W == 36 then screen:blit(55, 165, Ninespade) elseif W == 37 then screen:blit(55, 165, Tenclover) elseif W == 38 then screen:blit(55, 165, Tendiamond) elseif W == 39 then screen:blit(55, 165, Tenheart) elseif W == 40 then screen:blit(55, 165, Tenspade) elseif W == 41 then screen:blit(55, 165, Jackclover) elseif W == 42 then screen:blit(55, 165, Jackdiamond) elseif W == 43 then screen:blit(55, 165, Jackheart) elseif W == 44 then screen:blit(55, 165, Jackspade) elseif W == 45 then screen:blit(55, 165, Queenclover) elseif W == 46 then screen:blit(55, 165, Queendiamond) elseif W == 47 then screen:blit(55, 165, Queenheart) elseif W == 48 then screen:blit(55, 165, Queenspade) elseif W == 49 then screen:blit(55, 165, Kingclover) elseif W == 50 then screen:blit(55, 165, Kingdiamond) elseif W == 51 then screen:blit(55, 165, Kingheart) elseif W == 52 then screen:blit(55, 165, Kingspade) end end function drawCardthree() if V == 1 then screen:blit(70, 165, Aceclover) elseif V == 2 then screen:blit(70, 165, Acediamond) elseif V == 3 then screen:blit(70, 165, Aceheart) elseif V == 4 then screen:blit(70, 165, Acespade) elseif V == 5 then screen:blit(70, 165, Twoclover) elseif V == 6 then screen:blit(70, 165, Twodiamond) elseif V == 7 then screen:blit(70, 165, Twoheart) elseif V == 8 then screen:blit(70, 165, Twospade) elseif V == 9 then screen:blit(70, 165, Threeclover) elseif V == 10 then screen:blit(70, 165, Threediamond) elseif V == 11 then screen:blit(70, 165, Threeheart) elseif V == 12 then screen:blit(70, 165, Threespade) elseif V == 13 then screen:blit(70, 165, Fourclover) elseif V == 14 then screen:blit(70, 165, Fourdiamond) elseif V == 15 then screen:blit(70, 165, Fourheart) elseif V == 16 then screen:blit(70, 165, Fourspade) elseif V == 17 then screen:blit(70, 165, Fiveclover) elseif V == 18 then screen:blit(70, 165, Fivediamond) elseif V == 19 then screen:blit(70, 165, Fiveheart) elseif V == 20 then screen:blit(70, 165, Fivespade) elseif V == 21 then screen:blit(70, 165, Sixclover) elseif V == 22 then screen:blit(70, 165, Sixdiamond) elseif V == 23 then screen:blit(70, 165, Sixheart) elseif V == 24 then screen:blit(70, 165, Sixspade) elseif V == 25 then screen:blit(70, 165, Sevenclover) elseif V == 26 then screen:blit(70, 165, Sevendiamond) elseif V == 27 then screen:blit(70, 165, Sevenheart) elseif V == 28 then screen:blit(70, 165, Sevenspade) elseif V == 29 then screen:blit(70, 165, eightclover) elseif V == 30 then screen:blit(70, 165, eightdiamond) elseif V == 31 then screen:blit(70, 165, eightheart) elseif V == 32 then screen:blit(70, 165, eightspade) elseif V == 33 then screen:blit(70, 165, Nineclover) elseif V == 34 then screen:blit(70, 165, Ninediamond) elseif V == 35 then screen:blit(70, 165, Nineheart) elseif V == 36 then screen:blit(70, 165, Ninespade) elseif V == 37 then screen:blit(70, 165, Tenclover) elseif V == 38 then screen:blit(70, 165, Tendiamond) elseif V == 39 then screen:blit(70, 165, Tenheart) elseif V == 40 then screen:blit(70, 165, Tenspade) elseif V == 41 then screen:blit(70, 165, Jackclover) elseif V == 42 then screen:blit(70, 165, Jackdiamond) elseif V == 43 then screen:blit(70, 165, Jackheart) elseif V == 44 then screen:blit(70, 165, Jackspade) elseif V == 45 then screen:blit(70, 165, Queenclover) elseif V == 46 then screen:blit(70, 165, Queendiamond) elseif V == 47 then screen:blit(70, 165, Queenheart) elseif V == 48 then screen:blit(70, 165, Queenspade) elseif V == 49 then screen:blit(70, 165, Kingclover) elseif V == 50 then screen:blit(70, 165, Kingdiamond) elseif V == 51 then screen:blit(70, 165, Kingheart) elseif V == 52 then screen:blit(70, 165, Kingspade) end end
Code:if pad:up() and oldpad:up() ~= pad:up() then Command = Command-1 end if pad:down() and oldpad:down() ~= pad:down() then Command = Command+1 end if Command > 3 then Command = 0 end if Command < 0 then Command = 3 end if Command == 0 then screen:blit(350,175,Selector) else if Command == 1 then screen:blit(360,195,Selector) else if Command == 2 then screen:blit(343,215,Selector) else if Command == 3 then screen:blit(350,235,Selector) end end end end if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 1 then Select:play() Drawcard = 1 end if Drawcard == 1 then drawCard() Points = Points + Pointstwo end if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 0 then Select:play() Dealerdraw = 1 end if Dealerdraw == 1 then dealerDrawtwo() Special = 1 end if Special == 1 then Dealerpoints = Dealerpoints+Dealerpointstwo end if Special == 1 then pointsCalculate() screen:print(0,0,"Press [] to Restart",white) screen:print(0,10,"Press O to Return",white) if pad:square() then dofile("game.lua") end if pad:circle() then dofile("script.lua") end end if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 2 then Select:play() <-----Didn't do nothing yet end if pad:cross() and oldpad:cross() ~= pad:cross() and Command == 3 then Select:play() <-----Didn't do nothing yet end
-
05-07-2006, 09:59 PM #2145
- Registriert seit
- Jul 2005
- Beiträge
- 36
- Points
- 4.622
- Level
- 43
- Downloads
- 0
- Uploads
- 0
Thanks :) Guess the loops will get quite big, but the PSP is fast enough for that :Jump:
Zitat von Altair
-
05-08-2006, 04:40 AM #2146QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
ZereoX, if youre using notepad, then you can do this.
In notepad, while editing your script, press CTRL and F.
Then search for ALL your function's names.
Look for any stray functions you called outside of an 'if' statement.
If that doesnt work. Post all your code again, except put all your functions in bold. It makes looking for errors or hiccups easier. :icon_smil Heck, doing that, you might find the problem.
EDIT - Oh yea, and what does "Command" equal in the beginning when you start?Geändert von EminentJonFrost (05-08-2006 um 09:09 AM Uhr)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-08-2006, 11:04 AM #2147Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Does anyone know where I can find a tutorial on sidescrolling. I am going to create one for psp-programming, however I need something to reference.

-
05-08-2006, 11:05 AM #2148
It wouldn't really be your tut then would it? :S
D:
-
05-08-2006, 11:14 AM #2149Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
IM not using the whole thing, just need some for reference, and dont worry I will give credit

-
05-08-2006, 11:21 AM #2150
Well there are not any that i know of.
D:
-
05-08-2006, 11:25 AM #2151Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Well then I guess I might just have to right the whole thing on my own from scratch, lol.

-
05-08-2006, 11:29 AM #2152
Well it will help alot of people, when i get time i'll write up some tutorials for that site.
D:
-
05-08-2006, 11:46 AM #2153Rock Star

- Registriert seit
- Aug 2005
- Ort
- CT| FW: 4.01 M33-2
- Beiträge
- 11.844
- Points
- 70.899
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Ya I know, but I definately dont know everything there is about sidescrolling

-
05-08-2006, 11:47 AM #2154
Well maybe you should write one when you get more experience.
D:
-
05-08-2006, 11:52 AM #2155QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
If a value is nil, and i would like to skip it.
Like a picture blit, likte this:
Is there any way to make this work?Code:if LoadLastSave == true then screen:blit(35, 117, LastSave, 0, 0, 238, 107, 0) elseif return false then screen:print(35, 117,"Coulden't load: " ..Name, black) end
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 12:02 PM #2156QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
how about:
Zitat von HaxxBlaster
that should workCode:if LoadLastSave == true then screen:blit(35, 117, LastSave, 0, 0, 238, 107, 0) elseif LoadLastSave == false then screen:print(35, 117,"Coulden't load: " ..Name, black) end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-08-2006, 12:06 PM #2157QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
You don't even know the rest of the code.
If i should have it like that, i have to have another "retrun if false"
to check if it's not able to show, oterwise it will load it stright.[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 12:12 PM #2158QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
For people to help you, you have to tell them everything you believe they should know. :)
Zitat von HaxxBlaster
As for the extra "return if false" code. Why not put it?[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-08-2006, 12:20 PM #2159QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I am just asking if there is a "return" command that really works, i know everything else.
I am asking for commands, not code.[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
05-08-2006, 12:23 PM #2160QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
I'm sorry to say I dont know..
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]


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