PDA

View Full Version : Help with Lua code...



MSX
August 14th, 2005, 01:31
I'm writing code in Lua, but I've run into a problem...the problem that I have is that when I run the code, "Press start to restart" blinks continuously at the top left. All of the code works fine, but like I said, that phrase keeps blinking, and also, sometimes the text that shows up after pressing X, O, and square blinks. When start, the PSP automatically goes into USB mode, the rest if pretty simple: it just shows text when you press O or square, and if you press X, it takes you out of USB mode. Pressing start reruns the program, so you can edit the code, press start to restart the program, and it loads your new code and brings you into USB mode again.

Here is the code, please let me know if you see anything wrong:


System.usbDiskModeActivate()

green = Color.new(0, 255, 0)
blue = Color.new(0, 0, 255)
white = Color.new(255, 255, 255)
red = Color.new(255, 0, 0)

while true do

screen:print(1, 100, "Press circle to see the best NFL team, and square to see the worst.", green)

screen.flip()

pad = Controls.read()
if pad:start() then
break
end

pad = Controls.read()
if pad:circle() then
screen:print(200, 110, "Jacksonville Jaguars", blue)
end

pad = Controls.read()
if pad:square() then
screen:print(200, 120, "San Francisco 49ers", red)
end

pad = Controls.read()
if pad:cross() then
System.usbDiskModeDeactivate()
screen:print(1, 260, "USB Mode Deactivated", white)
end

screen.waitVblankStart()

end

Thanks