So, to reiterate, no one has any idea how I can turn the screen object into an image?
Printable View
So, to reiterate, no one has any idea how I can turn the screen object into an image?
the only way that has been mentioned by me and others that we know of is to screen:save() the screen load the image and use thatZitat:
Zitat von Highsight
there may be another way but as i suggested it may work if you use a blank image as the screen
myscreen = image.createempty(480, 272)
then
myobject = myscreen
may work may not
otherwise the only way we know of is to save the image
FaT3oYCG, that's almost correct.
The screen is already an image object(although of a special type), and any image can be blitted into another image:
scrncap = image.createempty(480, 272)
scrncap:blit(0, 0, screen)
One thing though, with some versions of luaplayer this won't always work if you are using the gu to draw some of the graphics
Wow, thanks FaT3oYCG for doing that for me - i will look over it and take your advice.
Many thanks, that must have taken you a lot of time.
Will keep you updated as soon as i get time to write some more!
Oh, and one other thing - can anyone please reccomend me an IDE to i dont have to keep transferring my scripts to the PSP and rebotting it when it crashes (which happens allot!)?
Many thanks!
Ohhh, so close. I already tried this once and I ended up getting an: "Image Expected, got Table" error. >_< Thanks anyway guys, I guess I'll just have to settle for a fading effect. :)Zitat:
Zitat von Merick
That error is just because I forgot to capitalize a couple of letters: image.createempty instead of Image.createEmpty
Er, when I did it I capitialized it correctly. :P It is giving me that error when I am blitting. ;) Here's the exact code:Zitat:
Zitat von Merick
And the error:Code:zoomOut = Image.createEmpty(480,272) --Line 115
zoomOut:blit(0,0,screen) --The Offending Line (Line 116)
If I were to guess, screen is a structure, and the image is some sort of variable in the structure, the only problem is, I don't know the variable name. Does anyone know a way I could find out what the variable name is? I ran a table.getn on the screen objects, it has 0 elements. >_<Code:error: INDEX.LUA:116: bad argument #2 to 'blit' (Image expected, got table)
Error: No script file found.
Press start to restart
i explained why you cant do something like that in one of my other posts read over it again
Code:copyofscreenimage = screen
screen:blit(0,0,copyofscreenimage)
we must be using different versions of lua player, it works in 0.20
As for screen, it's not a table but is what in lua terms is called userdata. Basically, instead of being a reference to data held inside the luaVM, a userdata object is a pointer to a memory structure that is controlled by the underlying (non-lua) code of the interpreter. The screen functions (clear, flip, etc...) are not regular table elements as such, but are instead what are called metamethods, which is why they don't show up with table.getn
following that up as i tried to explainZitat:
Zitat von Merick
think of the screen as a box not a table the items are put in the box but not in a specific order the items are not put in any particular location in the box but the location where they are placed is remembered by the screen - basically the memory adress
we can use the items from the screen but as they are not layed out in any specific order we cannot class the screen as one object as it contains these items
thanks
Umm, no.
In the PSP Luaplayer, the screen is a variable which acts as both a table and an image - most often an image in functions like screen:clear() and screen:blit(), but as a table in screen.flip() and screen.waitVblankStart(). Your attempt to explain it makes no sense at all, and I'm sure merick understands how the screen variable works anyways - he's made some good stuff.
ok i seem to be getting an error hen trying to use luaplaer on my pc, never tried this before so im not sure what im doing wrong heres the error message:
http://i84.photobucket.com/albums/k3...5/Noname-2.jpg
so i guess if someone could tell me how im supposed to work this thing lol that would be great :)
1. Get PSP and USB cable
2. Plug USB cable into computer and PSP
3. Put your script on your PSP and run it on the luaplayer it's meant to be run on instead of the windows one that leaves out many functions and is buggy and is an emulator in the first place.
4. Don't use windows luaplayer because it gets errors that have no fix/are related to bad code in general/require rewriting your script
wow thnx for the useless post. :tup: i didnt ask an opinion, i can use the luaplayer on my psp but id rather use the one for windows. so if anyone can help me get it to work that would be great :)
Listen to him.Zitat:
Zitat von %chrono trigger%
It wasn't an opinion, its facts. LuaPlayer for windows sucks and is incomplete. you miss alot of functions. Just run it on LuaPlayer for your PSP.
i did and he explained how to play a script on my psp well thats really not what i want so for arguments sake i dont have a psp. how then would i get lua player for windows to work on my pc?
First you say you can use it on your PSP, now you say you dont have a PSP.
Well, I don't know what that error means.
Maybe your using code that isn't in LuaPlayer for windows?
lol i said i didnt have a psp so that we would not begin something that need not be started hence the phrase "for arguments sake". anyway is there a guide you all know of for it then?
mhmm.Zitat:
Zitat von %chrono trigger%
Well, I dont think their is a guide as I never saw one but why not google it?
i have and did not find a definite answer that i liked so i thought mybe the nice people at qj might know
alright srry for the double post, but i think ill get a better answer to my questionthis way
theres my code and my problem is i traded my phat psp for a slim this code above was working on my 3.71m33-4 phat psp, but it wont work now on my slim 3.80m33-4. My question is is it because of my firmware or type of psp that it wont run? By the way there are no error messages just a black screen, and to my knowledge i havent change the code. So any help is appreciatedCode:System.usbDiskModeActivate()
red = Color.new(0,0,255)
green = Color.new(0,255,0)
ground = Image.createEmpty(480,5)
ground:clear(green)
oldpad = Controls.read()
currentBullet = 0
direction = "right"
floor = Image.load("background.png")
pic1 = Image.load("enemy.png")
pic2 = Image.load("pic2.png")
shell = Image.load("bullet.png")
Floor = {}
Floor.x = 0
Floor.y = 0
Pic = { }
Pic[1] = { x = 286, y = 107}
Mine = { }
Mine[1] = { x = 275, y = 143, h = pic2:height(), w = pic2:width() }
Pic = { }
Pic[1] = { x= 286, y = 107, h = pic1:height(), w = pic1:width() }
Player = {}
Player[1] = { oldx = 50, oldy = 107 }
Player.gravity = 107
Player.y = 10
Player.x = 20
Player.jumpspeed = 10
Player.jumpstate = "ground"
Player.weapon = "gun"
Player.img = {
["gun"] = Image.load("player_gun.png"),
["none"] = Image.load("player.png"),
["flame"] = Image.load("player_flame.png"),
["machine"] = Image.load("player_machine.png"),
["crouch"] = Image.load("player_crouch.png"),
["kneel"] = Image.load("player_crouch2.png")}
BulletInfo = {}
BulletInfo[1] = { pic = shell, firing = false, direction = "right", x = Player.x + 32,
y = Player.y + 16, h = shell:height(), w = shell:width() }
playerHeight = 90
playerWidth = 90
function movePlayer()
pad = Controls.read()
if pad:left() then
Player.x = Player.x - 1
end
if pad:right() then
Player.x = Player.x + 1
end
end
Player.x = Player[1].oldx
Player.y = Player[1].oldy
function bulletSetup()
if direction == "left" then
BulletInfo[1].x = Player.x
BulletInfo[1].y = Player.y + 16
end
if direction == "right" then
BulletInfo[1].x = Player.x + 32
BulletInfo[1].y = Player.y + 16
end
BulletInfo[1].direction = direction
BulletInfo[1].firing = true
end
function bulletFire()
if BulletInfo[1].firing == true then
if BulletInfo[1].direction == "right" then BulletInfo[1].x = BulletInfo[1].x + 10 end
if BulletInfo[1].direction == "left" then BulletInfo[1].x = BulletInfo[1].x - 10 end
screen:blit(BulletInfo[1].x,BulletInfo[1].y,BulletInfo[1].pic)
end
if BulletInfo[1].x < 0 or BulletInfo[1].x > 480 then
BulletInfo[1].firing = false
end
end
alpha = true
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,262,ground)
screen:blit(Floor.x, Floor.y,floor)
screen:blit(Pic[1].x,Pic[1].y,pic1)
screen:blit(Player.x,Player.y,Player.img[Player.weapon])
if pad:left() and Player.x > 0 then
Player.x = Player.x - 2
end
if pad:right() and Player.x < 480 then
Player.x = Player.x + 2
end
if pad:up() then
Player.weapon = "kneel"
end
if pad:down() then
Player.weapon = "crouch"
end
if pad:r() then
Player.weapon = "gun"
end
if pad:l()
then
Player.weapon = "machine"
end
if pad:cross() and Player.jumpstate == "ground" then Player.jumpstate = "jumping"
end
if Player.jumpstate == "jumping" then
Player.jumpspeed = Player.jumpspeed - 0.5
Player.gravity = Player.gravity - Player.jumpspeed
end
if Player.gravity < 0 then
Player.jumpstate = "falling"
end
if Player.gravity < 107 and Player.jumpstate == "falling" then
Player.gravity = Player.gravity + (Player.jumpspeed + 3)
end
if Player.gravity == 107 then
Player.jumpspeed = 10
Player.jumpstate = "ground"
end
if Player.gravity > 107 then Player.gravity = 107
end
Player.y = Player.gravity
if Player.x == 380 then
screen:print(200,80,"you beat level 1")
screen.flip()
screen.waitVblankStart(40)
screen:clear()
end
if Player.x == 286 then
Player.x = Player[1].oldx
Player.y = Player[1].oldy and
screen:print(210,80,"you lost")
screen.flip()
screen.waitVblankStart(30)
screen:clear()
end
if pad:circle() and oldpad:circle() ~= pad:circle() then
bulletSetup()
end
bulletFire()
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
here is my copy of luaplayer for windows that works
- put all of your files for that project in the luaplayer 0.20 for windows folder edit the basic.cmd the open the main file of your project and double click basic.cmd it will run if it has an error it will show you it and if not carry on working this folder works on my computer so i dont see why it wont work on yours here you go
DL LINK
hi guys i am making myself an osk - (on screen keyboard), and since i changed some of the variables i now get an error where there previously wasn't one
here is the problematic area of code
the problem arises on the first screen:print()Code:function keyb_draw(text_colour)
screen:blit(107, 98, bg)
screen:blit(currentX,currentY, selector)
character_X = 100
character_Y = 100
for a = 1, 3 do
add_width = 0
add_height = add_height + 10
add_row = add_row + 9
for b = 1, 9 do
add_width = add_width + 10
if mode == 1 then
screen:print(character_X + add_width, character_Y + add_height, characters[b + add_row], text_colour)
elseif mode == 2 then
screen:print(character_X + add_width, character_Y + add_height, string.upper(characters[b + add_row]), text_colour)
elseif mode == 3 then
screen:print(character_X + add_width, character_Y + add_height, symbols1[b + add_row], text_colour)
elseif mode == 4 then
screen:print(character_X + add_width, character_Y + add_height, symbols2[b + add_row], text_colour)
end
end
end
add_width = 0
add_height = 0
add_row = 0
end
here is the error
error: osk.lua:54: bad argument #2 to 'print' (string expected, got nil)
- the reason i changed the variable names was to make it easier for me to understand and so that i can make it function dependent so it can be easily implemented into an lua file
anyway any help appreciated thanks
Looking at this screen:print():
With arg #2 being nil (arg count actually starts at 0 so arg # 2 is the third item, the string to be printed) I'd think either the characters table is not created (but I think if that were the case the error would relate to attempting to access an index) or the sum of b and add_row is greater than the number of items in the characters table. Basically, it's a problem with the letter it tries to print not existing.Code:screen:print(character_X + add_width, character_Y + add_height, characters[b + add_row], text_colour)
thanks turtles i fixed it myself last night but you were spot on as the program itterates over the character table i had it set to add 9 characters every row baically but it started at 9 for a reason i cant figure out so i just set it to - 9 and the other variable the height to - 10 to print in the right areaZitat:
Zitat von TurtlesPwn
thanks
Some of the Flash0 folders are hidden in 3.80 fw.
Which is messing my Flasher up, because it will not recognize the hidden "module" folder, so it's writing to the "podule" folder instead.
Ive tried defining the file path... That did not work...
Tried writing to an alternate folder, then renaming the folder to "module"... Just got an error from that...
Any ideas ??
Thanks
~
shizzy
Sort out your code.Zitat:
Zitat von %chrono trigger%
And it's pointless trying to code for something that you don't actually own.
Being hidden doesn't mean anything. That's just an attribute that Windows recognizes and hides the file. It in no way effects the PSP.Zitat:
Zitat von Mr_Shizzy
err... except that sometimes, it does. sometimes it acts like the files aren't even there.
I had the same problem but managed to find a work around,
Really? I've been told over and over again that it's a simple attribute that the PSP doesn't even recognize.Zitat:
Zitat von FreePlay
Well, in that case, go into Windows, and uncheck the hidden attribute. Then compare the hidden and shown file to find how to remove the attribute. (Then again, that would probably be easier in C.)
I thought that the folder attribute was not the problem and that it was the read only file attribute of some files that caused the problem,
Last night, I removed the "read only" and "hidden system file" attributes (from the .prx files in flash0:/vsh/module") with PSPFiler, and my script still will not recognize them...
Any ideas??
This is not a safe way to do it but...Zitat:
Zitat von Mr_Shizzy
Before over writing the file in flash0 I check there is a replacement to be flashed,
If it exists I delete the file in flash0 then write my replacement,
This was the only way I could get around the problem and I did not look into changing file attributes,
Also I don't do lua and I did this using C,
I'll look into this hibby.
I'm not sure if LuaPlayer will even be able to find it to delete it.
I'm currently learning the C basics. (Trying to get away from this lua stuff)
But in the meantime, I wanted to throw a quick theme switcher for 3.80 M33.
(I change themes a lot) :P
Does lua have any dirent functions?
You could try printing the contents of the module folder or do a file exists check to see if lua can see them,
I had several problems getting a file to flash using C,
I have found that 0x800 works well for this but not sure how lua sorts out it's module mode,
^^^ I'll try that.
I just tried removing paf.prx from module folder (no worries- I got a DC4)
It says it done it successful, but it doesn't actually remove it...
EDIT:
Is there any src to a basic (C) 3XX flasher kicking around ?
Maybe I could study that, and just forget doing it in Lua...
A 1.5 flasher in C is cake, but this .prx building (for 3xx kernel functions) is a little confusing to me (I'm still a C newb :p)
What module mode does the lua player use?
It sounds like the module mode is not correct,
I had the same thing happen when using the wrong module mode,
It would say it was successful but never really did anything to the file,
Not sure, but I can upload the src.
Hold on...
src:
http://rapidshare.com/files/86354874...yer_20_src.rar
makefile:
http://www.mediafire.com/?ems20mmn1ly