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; Zitat von bronxbomber92 d*m*, does any1 else know how to give only one chance to answer a question and either ...
-
04-22-2006, 08:16 AM #1801sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
can anyone help me out here plz? thanks
Zitat von bronxbomber92
-
04-22-2006, 08:16 AM #180211th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Be alittle more precise and i think i can help :icon_wink .
Zitat von natan333
I dont really understand at the moment?
FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-22-2006, 08:18 AM #1803Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
post the code
Zitat von bronxbomber92

--XBL Gamertag: PhenoM904--
-
04-22-2006, 08:22 AM #1804sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
ok here it is
btw there isnt any bugs in it now, i just need to know wat i asked before...Code:green = Color.new(0, 255, 0) black = Color.new(0, 0, 0) red = Color.new(255, 0, 0) blue = Color.new(0, 0, 255) white = Color.new(255, 255, 255) -- Questions 1 questionOne = "Who hit the most homeruns ever?" --answers 1 answerOne = "down = Babe Ruth" answerTwo = "right = Hank Aaron" answerThree = "left = Barry Bond" answerFour = "up = Sammy Sosa" --****Main Loop**** while true do screen:clear() pad = Controls.read() screen:print(80, 100, questionOne, blue) screen:print(150, 200, answerOne, white) screen:print(150, 215, answerTwo, white) screen:print(150, 230, answerThree, white) screen:print(150, 245, answerFour, white) if pad:down() then screen:print(150, 110, "sorry, incorrect.", red) end if pad:right() then screen:print(150, 110, "Your Correct!", green) end if pad:left() then screen:print(150, 110, "sorry, incorrect.", red) end if pad:up() then screen:print(150, 110, "sorry, incorrect.", red) end screen.flip() screen.waitVblankStart() end
Geändert von Bronx (04-22-2006 um 08:25 AM Uhr)
-
04-22-2006, 08:32 AM #1805
I mean If i put this code
Zitat von c5cha7
the hello will only move right if a press the circle button becuaseCode:letterPos = {} letterPosx = 200 letterPosy = 100 while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() if pad:circle() then letterPosx = letterPosx + 2 end screen:print(letterPosx, letterPosy, "HELLO", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() endis included.Code:if pad:circle() then letterPosx = letterPosx + 2 end
my question is: is there a code to replease theto make it move right with out pressing any button ?Code:if pad:circle() then letterPosx = letterPosx + 2 end
Geändert von natan333 (04-22-2006 um 08:35 AM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-22-2006, 08:41 AM #1806
- Registriert seit
- Nov 2005
- Ort
- Minnesota, USA.
- Beiträge
- 36
- Points
- 4.492
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Natan333 -
Do you mean that you just want the "HELLO" to move by itself? If so, then you just replace "pad:circle()" with "true". So the code would look like this.
Code:letterPos = {} letterPosx = 200 letterPosy = 100 while true do blue = Color.new(0,200,350) screen:clear() pad = Controls.read() if true then letterPosx = letterPosx + 2 end screen:print(letterPosx, letterPosy, "HELLO", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() end
-
04-22-2006, 08:44 AM #180711th Squad Captain
- Registriert seit
- Jun 2005
- Ort
- You are here -----> 名前: アダム | 飲むコー
- Beiträge
- 2.562
- Points
- 26.490
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Argh...
Zitat von Jeffery
You beat me to it
.
but yea, i think he means that?
unless you mean if you press select it
will keep moving even is select isn't holded?FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
Currently Working On: - Flashmod V2.50 - Flashmod V2.60
Currently Drinking: Coffee! - 私はコーヒーを飲む
Chao Garden: DEMO v0.6
Chao Garden V0.5b Review!
-
04-22-2006, 08:51 AM #1808
Thanks Jeffery , thats what i needed to know, If true is to move then false is to stop right ?
like. if its moving, i plan to make it stop after 5 seconds, to do it i put something like
?Code:screen.waitVblankStart(50) False
Bequiet!!!
I'm learning cc©cc
-
04-22-2006, 11:52 AM #1809is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
youd say something like:
-- top of the script
movehello = true
if movehello == true then
letterPosx = letterPosx + 2 end
screen
rint(letterPosx, letterPosy, "HELLO", blue)
screen.waitVblankstart(50 )
movehello = false
endWhat did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-22-2006, 11:56 AM #1810sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
PLZ help! all i want is to know how to move on to a new question if the question before that was answered correct?!?!?! can some1 plz help me?????
Zitat von bronxbomber92
-
04-22-2006, 12:28 PM #1811Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von bronxbomber92
u could have a function for each question. like:
THEN u could make a variable like:Code:function questionOne() -- your question code--
then, when the person preses up down, or whatever, u put:Code:questionanswered = false
and then put:Code:questionanswered = true
where function questionTwo() is your second question... and so on.Code:if questionanswered == true then function questionTwo() end
hope i helped:)--------------------------------------------------------------------------------------
-
04-22-2006, 12:36 PM #1812sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
ok get wat ur saying but how would i make questionOne when printed on the screen say the actual qustion? do u have msn messenger? wa it be possoble if u type up an example plz? thanks for ur help!
Zitat von Grimfate126
-
04-22-2006, 01:00 PM #1813Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
my msn account is :
Zitat von bronxbomber92
[email protected]
can u come on now?--------------------------------------------------------------------------------------
-
04-22-2006, 01:04 PM #1814sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
yeah i can come on now!
edit- mine is [email protected] add me
Geändert von Bronx (04-22-2006 um 01:07 PM Uhr)
-
04-22-2006, 04:02 PM #1815QJ Gamer Green
- Registriert seit
- Jul 2005
- Ort
- Michigan
- Beiträge
- 104
- Points
- 5.046
- Level
- 45
- Downloads
- 0
- Uploads
- 0
bronxbomber, the best way to do this is using arrays. The following example will proceed to the next question if correct and go back to question 1 if incorrect:
Edit: Edited so that there's a 2-second delay before loading the next question, allowing for seeing whether the answer was right or not.Code:green = Color.new(0, 255, 0) black = Color.new(0, 0, 0) red = Color.new(255, 0, 0) blue = Color.new(0, 0, 255) white = Color.new(255, 255, 255) totalquestions=1 questions = {} answerOne = {} answerTwo = {} answerThree = {} answerFour = {} correctanswer = {} questions[1] = "Who hit the most homeruns ever?" answerOne[1] = "down = Babe Ruth" answerTwo[1] = "right = Hank Aaron" answerThree[1] = "left = Barry Bond" answerFour[1] = "up = Sammy Sosa" correctanswer[1]=2 i=1 while i<=totalquestions do screen:clear() screen:print(80, 100, questions[i], blue) screen:print(150, 200, answerOne[i], white) screen:print(150, 215, answerTwo[i], white) screen:print(150, 230, answerThree[i], white) screen:print(150, 245, answerFour[i], white) inputreceived=0 screen.flip() screen.waitVblankStart() while inputreceived==0 do pad = Controls.read() if pad:down() then screen.flip() if correctanswer[i]==1 then screen:print(150, 110, "You're Correct!", green) else screen:print(150, 110, "Sorry, incorrect.", red) i=0 end inputreceived=1 end if pad:right() then screen.flip() if correctanswer[i]==2 then screen:print(150, 110, "You're Correct!", green) else screen:print(150, 110, "Sorry, incorrect.", red) i=0 end inputreceived=1 end if pad:left() then screen.flip() if correctanswer[i]==3 then screen:print(150, 110, "You're Correct!", green) else screen:print(150, 110, "Sorry, incorrect.", red) i=0 end inputreceived=1 end if pad:up() then screen.flip() if correctanswer[i]==4 then screen:print(150, 110, "You're Correct!", green) else screen:print(150, 110, "Sorry, incorrect.", red) i=0 end inputreceived=1 end end i = i+1 screen.flip() screen.waitVblankStart(120) end
Edit again: I have no idea why that huge space is showing up between "12" and "0"
Edit again: Forgot to initialize the arrays.Geändert von darkshadow88 (04-22-2006 um 06:15 PM Uhr)
[QUOTE=Gutya]I think it's getting a bit stupid people posting 'I don't know' or 'I've never messed with that before', it's a waste of time. It's like buzzing in on a quizshow only to say 'I dunno...'.[/QUOTE]
-
04-22-2006, 04:11 PM #1816sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
wow i had no idea how to do that! could u possibly explain that for me in a pm? thanks a lot!
Zitat von darkshadow88
-
04-23-2006, 12:31 PM #1817
Zitat von Glynnder- PSPro
1st it takes the 50 to appear the word, 2nd it takes 50 to move each 2 pixel.Code:letterPos = {} letterPosx = 200 letterPosy = 100 while true do blue = Color.new(0,200,350) movehello = true screen:clear() pad = Controls.read() if movehello == true then letterPosx = letterPosx + 2 end screen:print(letterPosx, letterPosy, "HELLO", blue) screen.waitVblankStart(50) movehello = false if pad:select() then break end screen.flip() screen.waitVblankStart() end
the thing is that "screen.waitVblankStart(5 0)" work for the word and the false , is there a way to make "screen.waitVblankStart(5 0)" separate from the HELLo word and Work only for the False ?
can you correct it please? so it starts normally and stops at 50Geändert von natan333 (04-23-2006 um 12:40 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-23-2006, 03:54 PM #1818
Guys i have a question: there is a kinda of a circle object, but the hole image is a square, the white is outside of the circle and blue is inside the circle. I saw some pictures that is a circle ones, and the outside of the circle have a color to make it invisivel (like make the outside bellow of any picture that comes), so other colors can go above it and repleace the white with other picture above it
. what could the Hue, Sat, Lum, Red, Green, Blue could be ?Geändert von natan333 (04-23-2006 um 04:01 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-23-2006, 05:14 PM #1819Developer

- Registriert seit
- Mar 2006
- Ort
- Guadalajara
- Beiträge
- 958
- Points
- 7.499
- Level
- 57
- Downloads
- 0
- Uploads
- 0
I want to know that!!!!!!!!
Zitat von JOVENASO

Current projects:
- pspshootoutsv0.4
- PSPIRATESv6 :D
- Kindom Hearths: Sora´s Adventure V0.2
- PSPirates Alarm Clock v0.3
- Changos!: fall of the army-ITS ALIVE AND WORKING (coming soon)
PSPMEX DevTeam.
-
04-23-2006, 06:50 PM #1820Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
Yes...it's really easy....
Zitat von MEXICANSNAKE
That will make it so that if X and O are pressed at the same time, and ONLY if they are pressed at the same time, it will do something. It works with any button combnation and also with more than 2 buttons. For example:Code:pad=Controls.read() if pad:cross() and pad:circle() then do something end
also works.Code:pad=Controls.read() if pad:cross() and pad:circle() and pad:square() and pad:triangle() and pad:up() and pad:down() and pad:left() and pad:right() and pad:l() and pad:r() and pad:start() then do something end
Zitat von Noriko
-
04-23-2006, 07:06 PM #1821
can some edit this code
and make the hello move smooth ?Code:letterPos = {} letterPosx = 200 letterPosy = 100 blahblah = Font.createProportional() blahblah:setPixelSizes(0, 32) while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() analogX = pad:analogX() analogY = pad:analogY() if analogX > 80 then letterPosx = letterPosx + 3 end if analogX < -80 then letterPosx = letterPosx - 3 end if analogY > -80 then letterPosy = letterPosy + 3 end if analogY < 80 then letterPosy = letterPosy - 3 end screen:fontPrint(blahblah, letterPosx, letterPosy, "Hello", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() end
thx
between, can someone also edit the code below and show how can i make the font change from 32 to 40 when press L trigger? ( I tried to add L trigger at "font create" and "set pixel", it only gave me a error =( )Geändert von natan333 (04-23-2006 um 07:10 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-23-2006, 07:49 PM #1822Developer

- Registriert seit
- Mar 2006
- Ort
- Guadalajara
- Beiträge
- 958
- Points
- 7.499
- Level
- 57
- Downloads
- 0
- Uploads
- 0
thanx guy i really need that to use it with my shootouts game!!!
Zitat von PSPHax0r9

Current projects:
- pspshootoutsv0.4
- PSPIRATESv6 :D
- Kindom Hearths: Sora´s Adventure V0.2
- PSPirates Alarm Clock v0.3
- Changos!: fall of the army-ITS ALIVE AND WORKING (coming soon)
PSPMEX DevTeam.
-
04-24-2006, 05:41 AM #1823
Guys, wast this supposed to work ?
The thing i want to do is to make the Hello size change only if i press R button.Code:letterPos = {} letterPosx = 200 letterPosy = 100 ----------------------------------------------- puffa = Font.createProportional() puffa:setPixelSizes(0, 32) ----------------------------------------------- while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() ----------------------------------------------- if pad:r() blahblah = puffa then end ----------------------------------------------- analogX = pad:analogX() analogY = pad:analogY() if analogX > 80 then letterPosx = letterPosx + 3 end if analogX < -80 then letterPosx = letterPosx - 3 end if analogY > -80 then letterPosy = letterPosy + 3 end if analogY < 80 then letterPosy = letterPosy - 3 end screen:fontPrint(blahblah, letterPosx, letterPosy, "Hello", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() end
i think it will have to use true and false codes
can anybody show me how to do it ?Geändert von natan333 (04-24-2006 um 05:48 AM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-24-2006, 08:21 AM #1824is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
onething to remember with the:
pad=Controls.read()
if pad:cross() and pad:circle() then
do something
end
is that if you have another script that uses pad:cross() then say
if pad:cross() and not pad:circle() then
other script here
end
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-24-2006, 10:40 AM #1825
i though this was the right code for R trigger to add 20 font to the Hello word so the font will change it to 40 and pressing R trigger again to give me font 60, but it gives me error :Cry:Code:letterPos = {} letterPosx = 200 letterPosy = 100 blahblah = Font.createProportional() blahblah:setPixelSizes(0, 20) while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() if pad:r() then blahblah:setPixelSizes(0, + 20) end analogX = pad:analogX() analogY = pad:analogY() if analogX > 80 then letterPosx = letterPosx + 3 end if analogX < -80 then letterPosx = letterPosx - 3 end if analogY > -80 then letterPosy = letterPosy + 3 end if analogY < 80 then letterPosy = letterPosy - 3 end screen:fontPrint(blahblah, letterPosx, letterPosy, "Hello", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() end
can somebody help me pls?Geändert von natan333 (04-24-2006 um 10:49 AM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-24-2006, 11:31 AM #1826
i have another question:
how can i make the "screen.waitVblankStart(5 0)" work only inside the ------ lines?Code:letterPos = {} letterPosx = 200 letterPosy = 100 blahblah = Font.createProportional() blahblah:setPixelSizes(0, 20) while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() ---------------------------------------------- if pad:r() then screen:clear() screen:print(194,136, "Blue Team Wins", blue) screen.flip() screen:print(240,250, "Press Select to Exit", blue) screen.flip() screen.waitVblankStart(50) end ----------------------------------------------- analogX = pad:analogX() analogY = pad:analogY() if analogX > 80 then letterPosx = letterPosx + 3 end if analogX < -80 then letterPosx = letterPosx - 3 end if analogY > -80 then letterPosy = letterPosy + 3 end if analogY < 80 then letterPosy = letterPosy - 3 end screen:fontPrint(blahblah, letterPosx, letterPosy, "Hello", blue) if pad:select() then break end screen.flip() screen.waitVblankStart() end
and not slow down the moving "Hello" word when you move it with the analog stick ?
i m trying to do this sinse i 1st stared studing this but still cant figure it out howBequiet!!!
I'm learning cc©cc
-
04-24-2006, 03:32 PM #1827QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
how to you code AI in Lua? (for a side scroller)
[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]
-
04-24-2006, 03:43 PM #1828sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
yeah i would like to know that also?!?!
Zitat von <
-
04-24-2006, 04:03 PM #1829Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
me 2!
Zitat von bronxbomber92
--------------------------------------------------------------------------------------
-
04-24-2006, 05:17 PM #1830
need help fast
i need to make the background of a png image transparent is this possible and if so how do i do it


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