PSP Hacks - Forums
Go Back   PSP Hacks - Forums > Tech Talk > LUA Scripting

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2007, 05:41 PM
re_animate re_animate is offline
PSP Smarty
 
Join Date: Jan 2007
Posts: 120
re_animate User Has a Beginner Reputation
Default

hey guys,
im learning PSP LUA and need some help, i want to make a start up menu for my psp game...

i have 3 images

start.png, help.png, exit.png

they are all the same just each one has the menu item it is selecting highlighted eg start.png would have the word 'start' in a different color so u know its selected etc...

how do i get the menu to scroll the picture i want by me pressing the D-Pad buttons?

and x being to select them?

plz show the code you have used many thanx
__________________
Im not a nerd! im a lvl 19 paladin


W00t
Reply With Quote
  #2  
Old 03-25-2007, 05:58 PM
splodger15 splodger15 is offline
PSP Newbie
 
Join Date: Aug 2006
Posts: 39
splodger15 User Has a Beginner Reputation
Default

Well here is a basic menu it just prints the text to the screen and allows a scrolling ability through the menu in a different colour

Code:
Black = Color.new(0, 0, 0)
Red = Color.new(255, 0, 0)

-----Loads images--------
Background = Image.load("images/menu.png")


-----loads files-----
LoadA = loadfile(".lua")
LoadB = loadfile(".lua")
LoadC = loadfile(".lua")



while true do

current = 1
oldpad = Controls.read()

while true do

pad = Controls.read()
screen:clear()

----prints to the screen-------
screen:blit(0, 0, Background)
screen:print(200, 130, "Start Game", Black)
screen:print(200, 140, "Help", Black)
screen:print(200, 150, "Exit", Black)

-----this code is so that when you highlight an option in a menu it turns red-----
if current == 1 then
screen:print(200, 130, "Start Game", Red)
end

if current == 2 then
screen:print(200, 140, "Help", Red)
end

if current == 3 then
screen:print(200, 150, "Exit", Red)
end


-----this makes it so that you can scroll through your menu----
if pad:up() and oldpad:up() ~= pad:up() then
current = current-1
end

if pad:down() and oldpad:down() ~= pad:down() then
current = current+1
end

if current == 4 then
current = 1
end

if current == 0 then
current = 3
end

-----this is to select your menu options------
if pad:cross() and current == 1 then
LoadA()
end

if pad:cross() and current == 2 then
LoadB()
end

if pad:cross() and current == 3 then
LoadC()
end

screen.waitVblankStart()
screen:flip()
oldpad = pad

end

end
__________________
Join my PSP site here: http://splodger15.forum5.com/
Reply With Quote
  #3  
Old 08-23-2008, 01:11 AM
lua scripter lua scripter is offline
PSP Newbie
 
Join Date: Aug 2008
Posts: 14
lua scripter User Has a Beginner Reputation
Default

heres one this works great

Code:
white = Color.new(255,255,255)
red = Color.new(255,0,0)
black = Color.new(0,0,0)
oldpad = Controls.read()
font = Font.load("font.ttf")

-- Font Stuff

font:setPixelSizes(0,15)



ms = 1
mms = 5



while true do
screen:clear()
pad = Controls.read()

if pad:up() and not oldpad:up() then
ms = ms - 1
end

if pad:down() and not oldpad:down() then
ms = ms + 1
end

if ms > mms then
ms = 1
elseif ms <= 0 then
ms = mms
end

mc = { white,white,white,white,white }
mc[ms] = red
screen:fontPrint(font,200,200,"New Game",mc[1])
screen:fontPrint(font,200,210,"Continue",mc[2])
screen:fontPrint(font,200,220,"Options",mc[3])
screen:fontPrint(font,200,230,"Credits",mc[4])
screen:fontPrint(font,200,240,"Quit",mc[5])

if pad:cross() and not oldpad:cross() and ms == 1 then
--First option code goes here.
end

if pad:cross() and not oldpad:cross() and ms == 2 then
--Second option code goes here.
end

if pad:cross() and not oldpad:cross() and ms == 3 then
--Third option code goes here.
end

if pad:cross() and not oldpad:cross() and ms == 4 then
--Fourth option code goes here.
end

if pad:cross() and not oldpad:cross() and ms == 5 then
--Fifth option code goes here.
end

screen.flip()
screen.waitVblankStart()
oldpad = pad
end
__________________


Email me your lua scripts ill fix them or help you fix them and Email you back on what you wanted :D
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:03 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©