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; there is one thing that i m stuck at this is the code Code: blue=Color.new(0,153,225) screen:print(200, 100, "Hello!", blue) screen:flip() ...
-
04-19-2006, 02:13 PM #1711
there is one thing that i m stuck at
this is the code
I want to put a word with out delay, then make another word appear after like 2 second but cant figure it out =(Code:blue=Color.new(0,153,225) screen:print(200, 100, "Hello!", blue) screen:flip() screen.waitVblankStart(30) screen:print(200, 50, "Hello!", blue) screen:flip() while true do screen.waitVblankStart() end
if i put screen:flip() 2 times, it will disable the 1st word and make the other one appear
Please Help!
Laught if you think this is noobish(I dont care) I m new using this
but not new at making hacks for pc games
Geändert von natan333 (04-19-2006 um 02:16 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 02:17 PM #1712
For some reason the "screen.waitVblankStart(3 0)" doesn't really pause. Atleast its not working for me. Even if i put in 1 million its like there is just a "screen.waitVblankStart() "?Code:blue=Color.new(0,153,225) timer=new.Timer() screen:print(200, 100, "Hello!", blue) screen:flip() timer:start() if timer==2000 then screen:print(200, 50, "Hello!", blue) screen:flip() end while true do screen.waitVblankStart() end
Not laughing at all people ask this all the time.LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-19-2006, 02:18 PM #1713QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Zitat von siqq
the break part when u hit start should work. i just tested it. and to make it stay make the while loop look like this
and get rid of the funtion for the menuCode:while true do screen:clear() screen:blit(0, 0, background, false) pad = Controls.read() if titleNumber == 1 then screen:blit(0,0,titlePlay ) end if titleNumber == 2 then screen:blit(0,0,titleInfo ) end if titleNumber == 3 then screen:blit(0,0,titleExit ) end if titleNumber < 1 or titleNumber > 3 then screen:print(0,0,"error in titleNumber", white) end if pad:start() then break end --Main Menu D-Pad Controls if pad:right() and titleNumber < 3 then titleNumber = titleNumber + 1 end if pad:left() and titleNumber > 1 then titleNumber = titleNumber - 1 end screen.flip() end
-
04-19-2006, 02:33 PM #1714
is that the code to help me or your code to get helped ?
Zitat von Altair
i tryed to put it in the windows lua but dint worked
i m using windows lua becuase i m faster with it
the "screen.waitVblankStart(3 0)" works great with me
if i put
it takes like 0.5 seconds to appearCode:blue=Color.new(0,153,225) screen.waitVblankStart(30) screen:print(200, 50, "Hello!", blue) screen:flip() while true do screen.waitVblankStart() end
the thing i want is how to make 1 appear 1st and make another word appear few seconds later with out disabling the 1st word
~EDIT~ baahh for some reason this forum is putting spaces inside () >.<Geändert von natan333 (04-19-2006 um 02:40 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 02:46 PM #1715
oh yeahhh the screen.waitVblankStart() dosent work with my lua v0.16 (dont get higher becuase i have 2.0)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 03:29 PM #1716
Hey guys, I got a quick question. (And, whoever helps me with this scores a cool 500 points)
I need to know more about object orientation, and maybe an example on how to use the variable "self". And whats a metatable?
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-19-2006, 03:44 PM #1717
Im still trying to make the text stay and make appear another one but i m stuck in thereCode:blue=Color.new(0,200,350) screen:clear() pad = Controls.read() screen.flip() screen:blit(90, 195, circle) screen:print(200, 70, "Hello!", blue) screen:flip() if pad:cross() then screen:blit(50, 228, x) screen.flip() end while true do screen.waitVblankStart() end
im also stuck at trying to make the Hello appear when i press X button
Can some one help pls
The code above is what im trying to put
The lua tutorial Is a great tutorial http://www.scriptscribbler.com/psp/lua/lesson02.htm but i dint understand the part to make buttons work to appear something ( Please Help )Geändert von natan333 (04-19-2006 um 03:47 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 04:11 PM #1718
That code is just messed up..
put the "while true do" at the top.
And put a "screen.flip()" right after "screen.waitVblankStart() " and remove ALL the other "screen.flip()"s.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-19-2006, 04:31 PM #1719
Buahahahhahahahah I love you sam Thanks so Much
the code isI have some questionsCode:while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() if pad:cross() then screen:print(200, 70, "Hello!", blue) end screen.waitVblankStart() screen.flip() end
it only shows hello when i pres X button is there a way to freeze it when i press X button?
"pad = Controls.read()" have to be in the top of the text/Object to work? or anywhere will work ?
and another question. the while to do on the top is to make it it true ? so it shows everything ?Geändert von natan333 (04-19-2006 um 04:36 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 04:46 PM #1720QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
what exactly do u mean by object orientation.
Zitat von youresam
-
04-19-2006, 04:48 PM #1721
What do i need to do for the hello to appear 1st and the GoodBye to appear some seconds later when i hold X button?
the good tutorial dosent tell it so i m
This is the code that i m stuck at
Code:while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() if pad:cross() then screen:print(200, 70, "Hello!", blue) screen.waitVblankStart(50) screen:print(200, 100, "GoodBye!", blue) end if pad:start() then break end screen.waitVblankStart() screen.flip() end
Geändert von natan333 (04-19-2006 um 04:52 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 05:13 PM #1722
Basically you can create "objects" in lua instead of just variables. FOr example, thjink of the function screen:clear(). The defined function is Image.clear() and the params (would be, but its compiled..) Image.clear(self,color) (I think)
Zitat von soadnation
That is what im asking about. And to "add" your object, you call the metatable command..I forgot what though.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-19-2006, 05:15 PM #1723
there, you forgot to flip the screen.Code:while true do blue=Color.new(0,200,350) screen:clear() pad = Controls.read() if pad:cross() then screen:print(200, 70, "Hello!", blue) screen.flip() screen.waitVblankStart(50) screen:print(200, 100, "GoodBye!", blue) screen.flip() screen.waitVblankStart(50) end if pad:start() then break end screen.waitVblankStart() screen.flip() end
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-19-2006, 05:39 PM #1724
that code sam, both blinks 1st time then the top stop blinking and the bottom keep blinking
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 05:52 PM #1725
editted
now i understand the while true do and the End thing is to make it repeats
my question is: while its reapeating the text , is there a way to add another text to not to blink with it ? so its not in the same family
I edited to explain betterCode:blue=Color.new(0,200,350) screen:clear() screen:print(200, 70, "Hello!", blue) while true do screen.flip() screen.waitVblankStart(30) screen.flip() screen.waitVblankStart(30) end
Geändert von natan333 (04-19-2006 um 06:06 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 06:49 PM #1726
Actually...that code might work.... if you put the hello on one side and goodbye on the other. And "while [condition] do" .. "end" means "while [condition] is true (correct) do this between 'while' and 'end'"
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-19-2006, 07:05 PM #1727
i kinda understand though. is it possible for you make it with the code ? so i get what you mean . srry if you get mad, i just want to know the basics, the tutorial only goes to lesson 2 and dosent teach these stuff
Zitat von youresam
Bequiet!!!
I'm learning cc©cc
-
04-19-2006, 07:16 PM #1728
I'll help you out tomorrow after school, what exactly do you want it to do?
Zitat von natan333
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-20-2006, 05:17 AM #1729Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hey youaresam, i dunt understand the math.ceil function much.. so howo can you do this? if analog stik moves LEFT, the speed = speed-1 . if analog stik moves RIGHT, then speed = speed+1. thx!
--------------------------------------------------------------------------------------
-
04-20-2006, 06:19 AM #1730QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Somehow the following code never executes my main loop.
Before this snippet are nothing but simple variable declarations.Code:function textinput() screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false) --blit the background screen:blit(x,y, highlight ,0,0, highlight:width(), highlight:height(), true) --blit the cursor if pad:right() and timer:time() > 75 then x = x + 10 timer:reset(0) timer:start() end if pad:left() and timer:time() > 75 then x = x - 10 timer:reset(0) timer:start() end if pad:down() and timer:time() > 75 then y = y + 12 x = x + 5 timer:reset(0) timer:start() end if pad:up() and timer:time() > 75 then y = y - 12 x = x - 5 timer:reset(0) timer:start() end end function Showstatus() screen:print(6,30,"x = " .. x .. "y = " .. y .. "keyboard =" .. keyboard,textColor) end --Main loop while true do Showstatus() textinput() if pad:start() then break end screen.waitVblankStart() screen.flip() end
Someone could point out the error? Thanks in advance.
(Meh, this looks too much as a kthnxplz topic)
-
04-20-2006, 06:22 AM #1731sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
can any explain how i could ask a question in my lua game? i am gonna be making a trivia game (no details) and for example i might wanna ask "who is the president of the U.S." then i would give for options for an answer (mutiple choice) so i would be like "a- george bush, b-clinton, c- bob villa, d- Bronxbomber92" can any1 help me out with this? thanks
-
04-20-2006, 06:32 AM #1732QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
well, that wouldn't be too hard. For instance, you could make a cursor, and by pressing up or down, making that move, while you increase or decrease a variable on the same time.
-
04-20-2006, 06:33 AM #1733QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
do u want them to type in a.b.c. or d? cause if u do you are going to have to put a keyboard code in.
-
04-20-2006, 06:43 AM #1734sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
no, i just want them to press up or down and select which ones.
Zitat von soadnation
but my probablem kinda is i dont know how i would set this up so they have the choice of the questions. do u guys know wat i mean?
-
04-20-2006, 06:44 AM #1735QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Well, as I said, you could by pressing up and down, increase and decrease a variable, and compare that to the answer...
-
04-20-2006, 06:45 AM #1736sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
ok ill try that, i am not to familiar with lua yet but i think i might be able to figure that out today! ill try but any more help would be appreciated still!
-
04-20-2006, 06:50 AM #1737QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
You're welcome. Though, if you can't figure that one out, I would recommend you to get yourself some basic programming language techniques and master them.
Any can help me out on my problem, see previous page, last post?
-
04-20-2006, 06:59 AM #1738sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
thanks i think i have the hang of it but i still get mixed up! lol
-
04-20-2006, 08:33 AM #1739QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Phoenix
- Beiträge
- 208
- Points
- 13.529
- Level
- 75
- Downloads
- 0
- Uploads
- 0
As you don't start the timer before the first if statement, none of the conditions will go through because the timer never actually gets started. If you need me to explain better, let me know.
Zitat von SjaakRake
-
04-20-2006, 11:58 AM #1740QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Haha, offcourse, I'm so stupid. Thanks, I oversaw that one. I thought by declaring it, it would start running right away.


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