![]() |
|
#1
|
|||
|
|||
|
hello welcome to pge lua! enter your name: --osk would pop up your name is :txt: enter your birthday: --osk again --calculate age you are: X years old also on the save data script could you save a lua script so you could keep adding to it like names or phone numbers or anything? thanks |
|
#2
|
|||
|
|||
|
this would prolly get more attn in the lua programming section :)
__________________
![]() (Compliments of Chode) |
|
#3
|
|||
|
|||
|
can you move it... i dont want to double post
|
|
#4
|
||||
|
||||
|
Moved
__________________
The PSP Programming and Development Mega Thread -Rock Station- PSN: Xsjado7 Quote:
|
|
#5
|
|||
|
|||
|
You would basically just repeat the OSK sample several times, once for each event.
Make an attempt at it yourself, then come back and post code if you require further help. You can save whatever you want as savedata.
__________________
|
|
#6
|
|||
|
|||
|
okay ill try it once i get it working ill try loading some txt off the memory stick kinda like a scheduler where the saves are your tasks for the day
|
|
#7
|
|||
|
|||
|
okay im a little confused
Code:
-- Load the font, 16 pixels in height, to RAM
verdana16 = pge.font.load("verdana.ttf", 16, PGE_RAM)
-- Check the font loaded correctly
if not verdana16 then
error("Failed to load font.")
end
-- Init OSK with description, initial text and check success
if not pge.utils.oskinit("Test Description", "Initial Text") then
error("Error on osk init.")
end
-- Create two colors
white = pge.gfx.createcolor(255, 255, 255)
red = pge.gfx.createcolor(255, 0, 0)
enabled = true
done = false
text = ""
text2 = ""
x = 0
y = 0
counter = 0
-- Loop until exit requested
while pge.running() do
-- Update controls
pge.controls.update()
-- Start drawing
pge.gfx.startdrawing()
-- Clear screen (to black)
pge.gfx.clearscreen()
-- Draw a rectangle
pge.gfx.drawrect(x, y, 100, 60, red)
-- If OSK not being drawn, draw some text
if not enabled then
verdana16:activate()
verdana16:printcenter(130, white, text)
verdana16:active()
verdana16:printcenter(125, white, text2)
end
-- End drawing
pge.gfx.enddrawing()
if enabled then
-- pge.utils.oskupdate() must be called after pge.gfx.enddrawing(), but before pge.gfx.swapbuffers()
done, text = pge.utils.oskupdate()
if done then
if text == "" then
text = "User cancelled."
else
text = "User entered: " .. text
pge.utils.oskinit("Test Description", "enter second text")
text2 = pge.utils.oskupdate()
text = "user entered: " .. text2
end
end
end
-- Swap buffers
pge.gfx.swapbuffers()
-- Increment counter
counter = counter + 1
-- Set the rectangle to a random screen position
if counter >= 60 then
counter = 0
x = pge.math.randfloat(0, 380)
y = pge.math.randfloat(0, 212)
end
-- If RIGHTTRIGGER pressed, end
if pge.controls.pressed(PGE_CTRL_RTRIGGER)and pge.controls.pressed(PGE_CTRL_LTRIGGER) then
break
end
end
verdana16 = nil
white = nil
red = nil
state = nil
enabled = nil
done = nil
text = nil
text2 = nil
x = nil
y = nil
counter = nil
Code:
-- Load the font, 16 pixels in height, to RAM
verdana16 = pge.font.load("verdana.ttf", 16, PGE_RAM)
-- Check the font loaded correctly
if not verdana16 then
error("Failed to load font.")
end
-- Init OSK with description, initial text and check success
if not pge.utils.oskinit("Test Description", "Initial Text") then
error("Error on osk init.")
end
-- Create two colors
white = pge.gfx.createcolor(255, 255, 255)
red = pge.gfx.createcolor(255, 0, 0)
enabled = true
done = false
text = ""
text2 = ""
x = 0
y = 0
counter = 0
-- Loop until exit requested
while pge.running() do
-- Update controls
pge.controls.update()
-- Start drawing
pge.gfx.startdrawing()
-- Clear screen (to black)
pge.gfx.clearscreen()
-- Draw a rectangle
pge.gfx.drawrect(x, y, 100, 60, red)
-- If OSK not being drawn, draw some text
if not enabled then
verdana16:activate()
verdana16:printcenter(130, white, text)
verdana16:active()
verdana16:printcenter(125, white, text2)
end
-- End drawing
pge.gfx.enddrawing()
if enabled then
-- pge.utils.oskupdate() must be called after pge.gfx.enddrawing(), but before pge.gfx.swapbuffers()
done, text = pge.utils.oskupdate()
if done then
if text == "" then
text = "User cancelled."
else
pge.utils.oskinit("Test Description", "enter second text")
text = "User entered: " .. text
text2 = "user entered: " .. text2
end
end
end
-- Swap buffers
pge.gfx.swapbuffers()
-- Increment counter
counter = counter + 1
-- Set the rectangle to a random screen position
if counter >= 60 then
counter = 0
x = pge.math.randfloat(0, 380)
y = pge.math.randfloat(0, 212)
end
-- If RIGHTTRIGGER pressed, end
if pge.controls.pressed(PGE_CTRL_RTRIGGER)and pge.controls.pressed(PGE_CTRL_LTRIGGER) then
break
end
end
verdana16 = nil
white = nil
red = nil
state = nil
enabled = nil
done = nil
text = nil
text2 = nil
x = nil
y = nil
counter = nil
|
![]() |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|