![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Originally Posted by Twenty 2 Ok i fixed the == part and I forgot to put a % in front ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#151 | |
![]() NDS Mod
|
Quote:
Code:
while true do screen.waitVblankStart(5) -- add this
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#153 | |
![]() NDS Mod
|
Quote:
Code:
m = 1
ran = math.random(100)
blue = Color.new(0, 0, 225)
while true do
pad = Controls.read()
if pad:up() then
m = m+1
screen:clear()
screen:print(230, 136, string.format("%d", m), blue)
screen:flip() end
if pad:down() then
m = m-1
screen:clear()
screen:print(230, 136, string.format("%d", m), blue)
screen:flip() end
if pad:cross() and m == ran then
screen:clear()
screen:print(230, 136, string.format("%d", m), blue)
screen:print(230, 136, "You guessed correctly!", blue)
screen:flip() end
if pad:start() then
break end
end
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#155 | |
![]() NDS Mod
|
Quote:
Example: screen.waitVblanKStark(8) make it wait 8/60 of a second. Use this at the beginning of the while loop to slow it down.
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#156 |
![]() |
hi am on the 2nd Tutorials in Lua and i get
error: script:127: \end/ expected (to close \while/ at line 65) near \<eof>/ here is the code http://www.filefactory.com/get/f2.ph...3dda454f100e57 |
|
|
|
|
|
#157 |
![]() NDS Mod
|
As the error suggest, you left out an
Code:
end
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
#159 | |
![]() NDS Mod
|
Quote:
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#161 | |
![]() NDS Mod
|
Quote:
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#162 |
![]() |
This is supposed to be a timer program but I cant really get it to work. I suspect it has something to do with the tostring because I dont know much about these kinda things.
Code:
--Ett tidtagningsprogram
--Definiera färger
svart = Color.new(0, 0, 0)
vit = Color.new(255, 255, 255)
Timer = Timer.new(0)
--Definiera bilder
lua = Image.load("lua.png")
luasplash = Image.load("luasplash.png")
klocka = Image.load("klocka.png")
function menu()
screen:blit(0, 0, lua, false)
screen:print(220, 170, "Carls tidtagningsprogramm", svart)
screen:print(220, 190, "X:Info", svart)
screen:print(220, 200, "O:Gå vidare till tidtagningen", svart)
screen:print(220, 210, "Select: Avsluta", svart)
screen.flip()
while true do
pad = Controls.read()
if pad:cross() then
screen:blit(0, 0,lua, false)
screen:print(50, 200, "Detta program tillåter dig att ta tid.", svart)
screen:print(50, 210, "Det skapades av Carl den 8 Okt 2005", svart)
screen:print(220, 170, "Triangel:Tillbaka", svart)
screen:print(220, 180, "Select: Avsluta", svart)
screen.flip()
end
if pad:triangle() then
menu()
screen.waitVblankStart()
screen.flip()
end
if pad:circle() then
menua()
end
end
end
function menua()
screen:blit(0, 0, klocka, false)
screen:print(150, 180, "tryck R för att starta, L för att Stoppa och R+L för att återställa", svart)
while true do
pad = Controls.read()
screen:print(220, 133, tostring(math.floor(Timer:time()/1000/60) .. ":" .. math.floor((Timer:time()/1000/60-math.floor(Timer:time()/1000/60))*60) .. ":" .. string.sub(tostring(math.floor(Timer:time()/10)), -2)), svart)
screen.flip()
if pad:r() then
Timer:start()
Timer:reset(0)
end
if pad:l() then
Timer:stop()
break
end
if pad:triangle() then
menu()
end
end
end
screen:blit(0, 0, luasplash, false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(180)
menu()
I think I'm gonna start making my programs in english from now on =) Last edited by lingon; 10-09-2005 at 09:40 AM.. |
|
|
|
|
|
#164 |
![]() |
Haha, hur stor är chansen för det? Det är inte så många som heter Carl/Karl nuförtiden.
Hursomhelst, Lua fixar ju inte å, ä, ö men jag funderar på om man skulle ta och göra två versioner utav ens programm, dom som blir bra asså. En svensk och en engelsk, om man orkar. Förresten, hur funkade det där med wait.VblankStart som jag Pm:ade om? |
|
|
|
|
|
#167 | |
![]() ![]() Developer
|
Quote:
Code:
-- Define Colors
white = Color.new(255, 255, 255)
yellow = Color.new(255, 255, 0)
-- Print Instructions
screen:print(5, 5, "Press L to begin and R to stop.", yellow)
screen:flip()
-- Create Timer
Timer = Timer.new(0)
-- Start Main Program
while true do
screen.waitVblankStart(5)
pad = Controls.read()
if pad:l() then
Timer:reset()
Timer:start()
while true do
pad = Controls.read()
screen:clear()
screen:print(5, 5, "Press L to begin and R to stop.", yellow)
screen:print(220, 133, tostring(math.floor(Timer:time()/1000/60) .. ":" .. math.floor((Timer:time()/1000/60-math.floor(Timer:time()/1000/60))*60) .. ":" .. string.sub(tostring(math.floor(Timer:time()/10)), -2)), white)
screen:flip()
if pad:r() then
Timer:stop()
break
end
end
elseif pad:start() then
break
elseif pad:select() then
screen:save("screenshot.png")
end
end
__________________
![]() F.A.L.O?
|
|
|
|
|
|
|
#169 |
![]() ![]() Developer
|
Theres a credit scroller at http://lumo.at.tt/ but it goes from right to left.
__________________
![]() F.A.L.O?
|
|
|
|
|
|
#171 | |
![]() NDS Mod
|
Quote:
This is how you put things together: Code:
..
__________________
"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me [URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL] |
|
|
|
|
|
|
#173 | |
![]() i <3 fluffy rainbows
|
Quote:
![]() --pspmachine
|
|
|
|
|
|
|
#179 |
|
ok, sorry ill re-phrase my queston:
i have seen programs availabe for download in the file section, they say they have been written in lua, but open using an eboot file, is there a way to somehow convert the lua script to be run by an eboot e.g, run straight from the game menu, and not going through the lua player... thanks |
|
|
|
|
|
|
#180 | |
![]() Premium Member
|
Quote:
Code:
function squarecollision(sq1xpos, sq1xsize, sq1ypos, sq1ysize, sq2xpos, sq2xsize, sq2ypos, sq2ysize)
if sq1xpos <= (sq2xpos + sq2xsize) and (sq1xpos + sq1xsize) >= sq2xpos then
if sq1ypos <= (sq2ypos + sq2ysize) and (sq1ypos + sq1ysize) >= sq2ypos then
return true
else
return false
end
end
end
sq = square 1/2 = box 1 or 2 x/y = x or y axis pos = position size = size |
|
|
|
|
![]() |
| Tags |
| code , lib , lua , luaplayer , noobs , programming , psp programming , scripting , thread |
| Thread Tools | |
|
|