thanx turtlesPwn
Printable View
thanx turtlesPwn
What does the System.startOSK() function in LuaPlayerHM 6.x do? Does it start the sony OSK or some other one?
And if it uses the Sony, how do you use that OSK in a program?
PSProgramer-
It should work, I'm using this method On my PSP-SuperMarioBros. game to blit blocks :)Code:Coin_Start = 1
Coin_End = 2
Coin_1 = {}
Coin_1.x = 10
Coin_1.y = 10
Coin_1.visible = "true"
Coin_1.img = Coin
Other Variables
function Coin()
for a = Coin_Start, Coin_End
if Coin_1.visible = "true" then
screen:blit(Coin_1[a].x, Coin_1[a].y, Coin_1[a].img)
end
end
end
Other Functions
if Player.x == 10 and Player.y == 10 then
Coin_1.visible = "false"
end
Other ENDING STUFF
remember to call the function
Code:
Coin()
Zitat:
Zitat von PSPMod999
then text_output is whatever the user typed soCode:text_output = System.startOSK("name1", "name2")
would show that text on the screenCode:screen:print(10, 10, text_output)
I'm guessing name1 and name2 are variables?
no you have to put them in though otherwise it wont work i think that they are displayed when the osk is shown
I would do something like this instead;Zitat:
Zitat von dan369
you could stick the row/col calcs inline and remove two local vars, i left it in as it helps explain what I am doing, but for non tutorial code I would do it as one line of code inside the screen:blit...Code:g_Coins = {}
g_Coins[ (10 * 1000) + 10 ] = 1
other functions.......
local i
for i in pairs(g_Coins) do
local col = i % 1000
local row = (i - col) / 1000
-- the subtraction stops turning it into decimals
-- and removes need for math.floor etc
-- unless your lua is compiled for integer numbers only
screen:blit(row, col, Coin)
end
to 'delete' a coin set its entry to nil like. also you would need to do screen bounds checking etc etc etc. setting something to nil deletes that entry in the table.
thus we just deleted the coin at row 10, column 13.Code:g_Coins[ (10 * 1000) + 13 ] = nil
Oh, the 1000 stuff is assuming 1000 columns per row. If your map is < 1000 tiles wide your safe :)
why are you using true and false as strings and not the built in lua constants?
Lua's tables are powerful. use them. I hope your Zelda game isn't full of the above type of coding, all those if statements and extra table entries like your coin example. Use the power of iterators and table hashes that lua gives you!
You could just abstract g_Coins into a generic table and have each row/col entry point to its sprite, eg:
Code:g_Overlays= {}
g_Overlays[ (10 * 1000) + 10 ] = Mushroom
g_Overlays[ (10 * 1000) + 11 ] = CoinSprite
local i, sprite
for i, sprite in pairs(g_Overlays) do
screen:blit((i - (i%1000)) / 1000 , i % 1000 , sprite)
end
The name1 and name2 are the text already in the osk display, and what it says on the osk. For example, "Type text here" and "Sony's OSK". Try it out and you'll see what I mean.
df - True, it's an alternate method using math. I don't use much math, i'll gunna take a look into using some :tup:
Thx for the help, FaT3oYCG.
I keep getting this error when using my program:
:8: '=' expected near 'button'
here is line 8:
Code:System.buttonPressed(1) If button == "yes" then UMD.ripISO("ms0:/ISO/9660.ISO") end
I read many tutorials and the functions.txt that came with luaplayerHM v6.6.
Can anyone help?
Use the Lua Help Thread plz...
And you capitalized the 'If', make the I lowercase.
sorry about the thread thing and i will try what u suggested.Zitat:
Zitat von SG57
i forgot that LUA is case sensitive
Lol, you're kidding? There's actually a LUAplayer function to rip an ISO?
I wonder what Shine would have thought about making that as easy as one line.
"Lua"? heh, now don't go thinking Lua's syntax is so unique ;)
Art - Personally, I'm losing more and more respect for Lua users by the update ;)
It worked, now my program is 100% working now!!!
thanks for ur help!!!
Note: its not a bricker!
-= Double Post =-
there is, and it works 100%!!!Zitat:
Zitat von Art
dumps really fast! used it may times and i all games have worked 100%!
btw luv ur time baby app, but i have a slim, so i use time machine and it works well!
I want to make a background to my app insted of a black screen, how do I do so?
i need some codes, can anyone help out?
simply load whatever background image you want to use than have that be the first image you blit to the screen
i havent used lua in a long time so i don't remeber the load command but i do remeber the blit:
screen:blit(0, 0, bg) <--correct me if i'm wrong anyone
anyways bg is the image and simple google lua image loading commands, or go back a page or two in this thread until you see someone who has loaded an image
Well mine wasn't as simple to code as:Zitat:
"Lua"? heh, now don't go thinking Lua's syntax is so unique
I hated the idea of one on a forum. Now there can be hundreds of them.Code:RipISO(); // Please
Thanks. Funny I thought Time Machine would stuff up the graphics.Zitat:
btw luv ur time baby app, but i have a slim, so i use time machine and it works
nvm i got it already, u were right though, thx for ur help!Zitat:
Zitat von slicer4ever
no its graphics look fine compared to my friends fat PSPZitat:
Zitat von Art
Another question, i want to make it where i press a button, text appears, and then it goes away after about 3 seconds, like this for example:
I press X, and it says on the bottom:
USB mode activated!
and then it goes away after 3 seconds.
I know how to do the USB thing, but as for the txt appearing and going away....
well, can anyone help?
so are you gonna release it??
Merged with the Lua Help Thread. :)
removeUSBTextCounter = 0
while true do
if pad:cross() then showUSBText = true System.usbDiskModeActivat e() end
if showUSBText then
removeUSBTextCounter = removeUSBTextCounter + 1
if removeUSBTextCounter > 180 then showUSBText = false removeUSBTextCounter = 0
screen:print(2,260,"USB mode activated!")
end
end
thx TurtlesPwn, but now I have another question...
When I press a button, it executes the command. Then, once its done, it goes back to the menu of my program. example:
I pressed O to go back on a system message, and it went back to the menu of my app.
but when it goes back to the menu, I can an longer press any buttons, when I press a button, nothing happins, Once I press a button, its done, i can't press any more
can anyone help?
Nobody can help with the info youve given us so far
ok, ill try to be more specific:Zitat:
Zitat von TurtlesPwn
Ok, lets say I pressed O in the program I have created, and it starts to play music, now I want to shut off the music, lets say i pressed X to stop the music, but it does not work...
Here is another example:
Lets say i pressed O and it displayed a picture of... a beach. and now I want to go back, Lets say I pressed X to go back, but it doesnt go back, even though i programmed it to go back
how do I fix this problem?
why dont you just ask us to write the program for you, it would be much better than writing 10 posts on how do i do this, i learned how to do that stuff by looking at past posts, you could use the search, its there for a reasonZitat:
Zitat von omegaridley
You obviously do not understand the flow of your program, that is something we cannot help you with.
I just want a code that can loop the program so I wont have to reset the program everytime i execute a commandZitat:
Zitat von ifiwere1337
can you do that?
Please tell me youre using a while loop.....
yeah, but, i think, well, here is my coding(100% working except for the problem im having):Zitat:
Zitat von TurtlesPwn
Code:white = Color.new(255, 255, 255)
background = Image.load("SYSTEM/images/background.png")
done = false
while true do
pad = Controls.read()
if pad:cross() and done == false then
System.message("UMD ISO will be dumped in name 9660.ISO, if u have a UMD dumped by this app, rename the ISO in the memory stick. Are you ready to dump the UMD?",1)
button = System.buttonPressed(1) if button == "yes" then UMD.ripISO("ms0:/ISO/9660.ISO", green) end
button = System.buttonPressed(1) if button == "no" then System.Quit() end
done = true end
if done == false then
Ogg.load("SYSTEM/music/system.ogg")
Ogg.play()
screen:blit(0, 0, background, false)
screen:print(1, 1, "press X to Dump UMD Disk", white)
end
if pad:circle() and done == false then
System.message("Dumping a UMD video is diffrent than dumping a UMD game. To dump a UMD video, you must enter USB mode and dump it to the PC. When you have USB enabled for UMD drive, it will show up as UMD9660.iso, drag that to your PC and it will start dumping. Do you want to enable UMD USB mode now?",1)
button = System.buttonPressed(1) if button == "yes" then System.usbDevUMD() end
button = System.buttonPressed(1) if button == "no" then System.Quit() end
done = true end
if done == false then
screen:print(1, 10, "Press O to dump UMD video", white)
end
if pad:square() and done == false then
System.message("This will show the available amount of free space on your memory stick. Do you wish to continue?",1)
button = System.buttonPressed(1) if button == "yes" then System.getDevSize("ms0:") end
button = System.buttonPressed(1) if button == "no" then System.Quit() end
done = true end
if done == false then
screen:print(1, 20, "Press [] to see free space on memory stick", white)
end
if pad:start() and done == false then
System.message("WARNING! This will clock the Central Processing Unit to 20 MHz! Are you sure you want to proceed?",1)
button = System.buttonPressed(1) if button == "yes" then System.setcpuspeed(20) end
button = System.buttonPressed(1) if button == "no" then System.Quit() end
done = true end
if done == false then
screen:print(1, 30, "Press Start to clock CPU to 20 MHz", white)
end
if pad:select() and done == false then
System.message("This will clock the Central Processing Unit to 333 MHz, which is higher than default. Are you sure you want to proceed?",1)
button = System.buttonPressed(1) if button == "yes" then System.setcpuspeed(333) end
button = System.buttonPressed(1) if button == "no" then System.Quit() end
done = true end
if done == false then
screen:print(1, 40, "Press Select to Clock CPU to 333 MHz", white)
end
if pad:l() and done == false then
System.message("Are you sure you want to exit?",1)
button = System.buttonPressed(1) if button == "yes" then System.Quit() end
button = System.buttonPressed(1) if button == "no" then end
done = true end
if done == false then
screen:print(1, 50, "Press L trigger To exit", white)
end
if pad:r() and done == false then
System.message("You are about to shutdown the PSP. Do you want to proceed?",1)
button = System.buttonPressed(1) if button == "yes" then System.shutdown() end
button = System.buttonPressed(1) if button == "no" then end
done = true end
if done == false then
screen:print(1, 60, "Press R to Shutdown The system", white)
end
screen.waitVblankStart()
screen.flip()
end
I would think it's rather obvious.
The way you have it now, once you set 'done' to true, it never becomes false again, so it never accepts more input.
Try moving 'done = false' below 'while true do'.
i didnt know you knew lua freeplay, i thought you only did c++Zitat:
Zitat von FreePlay
Thx freeplay, it now works!!!Zitat:
Zitat von FreePlay
but I still have other problems...
this code is supposed to show how much space I have left on my memory stick:
but it doesnt show anything...Code:System.getDevSize("ms0:")
anyone know?
You dont have to "know" lua to look at and understand a script written in it - it looks like plain english to someone used to lowerlevel programming languages.
look, i only just turned 13, i know ALOT about programming, except for LUA.Zitat:
Zitat von TurtlesPwn
I can do LUA pretty well, but i always seem to get errors...
hi my psp screen shows up but the hud isn't working. if any one can help that would be great
You're just proving Turtle's point even more by saying that... lolZitat:
Zitat von omegaridley
scryeth - that is so vague we can't even begin to help you without atleast some code.