Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Is there a more graceful way of doing this. Its looks very bad. edit: cool guys on channel #psplua on ...
-
10-11-2005, 02:47 PM #181Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Is there a more graceful way of doing this. Its looks very bad.
edit: cool guys on channel #psplua on irc helped me
You download luaplayer and delete eveything out of it except the eboot. Then you name your script system.lua. Im not to sure about this so correct me if im wrong.
Zitat von tenksnit
Geändert von Twenty 2 (10-11-2005 um 03:40 PM Uhr)
F.A.L.O?
-
10-12-2005, 08:46 AM #182
How do I make pushbuttons like the ones in the pspairhockey menu? ya know what I mean?
Geändert von lingon (10-12-2005 um 12:16 PM Uhr)
-
10-18-2005, 03:18 PM #183
pic loads, but when you press x nothing happens... Please help!
Code:luas = Sound.load("comp.wav") lua = Image.load("luasplash.png") screen:blit(0, 0, lua, false) screen.waitVblankStart() screen.flip() luas:play() screen.waitVblankStart(240) screen.flip() Music.volume(255) screen:clear() monopoly = Image.load("monopolyboardnew.png") screen:blit(0, 0, monopoly, false) black = Color.new(0, 0, 0) screen:print(85, 45, "Dice", black) screen.flip() while true do screen.waitVblankStart() pad = Controls.read() dice1 = math.random(6) dice2 = math.random(6) if pad:cross() then screen:print(80, 55,string.format("%d", dice1), black) screen:print(100, 55,string.format("%d", dice2), black) screen.flip() screen.waitVblankStart(360) end
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-18-2005, 03:32 PM #184QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
I'm just guessing here, but first of all:
you'de need to give it a range like math.random(1,6). Second, since the math.random is in a loop, I dont think it will ever land on a number. I'de try making a function to roll the dice, and have pad:cross() activate that funtion.Code:dice1 = math.random(6) dice2 = math.random(6)
-
10-18-2005, 05:23 PM #185
well it loaded, but it did not display the text over the picture. ( the pic takes up the whole screen...)
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-18-2005, 06:00 PM #186QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
I'm gonna guess agin, but I think its this part that's wrong:
Zitat von cools
"%d" is for digits me think. Example, "%03d" would equal 3 digits "000". You having nothing there mean no digits I think.Code:string.format("%d", dice1)
-
10-18-2005, 06:12 PM #187
still it doesnt load...
that part of script/
Code:dice = function() dice1 = math.random(6) dice2 = nath.random(6) screen:print(80, 55,string.format("%02d", dice1), black) screen:print(100, 55,string.format("%02d", dice2), black) screen.flip() screen.waitVblankStart(360) end if pad:cross() then activate = function(dice) end end
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-18-2005, 06:22 PM #188QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
What about this...
[/QUOTE]Code:function rollDice() dice1=math.random(1,6) dice2=math.random(1,6) end --declare the funtion before the main loop screen:print(80, 55,string.format("%02d", dice1), black) screen:print(100, 55,string.format("%02d", dice2), black) screen.flip() screen.waitVblankStart(360) end if pad:cross() then rollDice() end end
-
10-18-2005, 10:36 PM #189words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
60vblanks = 1sec 120vblanks = 2sec ect.
[QUOTE=SodR]Sry 2 post my question again but how do I get a text when I push a button to not disapear after I have released the button[QUOTE=SodR] dude i wudnt code if i were you i mean even with my limited comp use i still kno
screen.waitVblankStart(60 )
-
10-18-2005, 11:12 PM #190QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
[QUOTE=SG57][QUOTE=SodR]Sry 2 post my question again but how do I get a text when I push a button to not disapear after I have released the button
That was one ugly post. At least you gave an answer
Zitat von SodR
. Everybody should have a chance to learn, dont let it get to ya SodR. :)
-
10-18-2005, 11:57 PM #191
Okay, this one has had me stumped all day. I have been trying to get ball1 to bounce off of wall1 correctly. So far I have been able to get either the ball to react correctly to either the top and bottom or the left and right sides of the wall.
For example, I can get ball1 to bounce off the top and bottom of wall1 perfectly, but when it touches the sides it teleports the ball to the bottom of the wall. If I modify the code a little bit I can get the ball to bounce off the side, but it will also bounce up as if it had hit the floor, and the ball slides through the wall if it is forced into it.
I am uploading a version from before I connected the collision detection because I figured the way I did it was unnecessarily complex, but the function I used is still in the code if you want to use it.
I'd really appreciate it if someone could help me get past this roadblock. Thanks in advance.
Edit: thanks to this kickass interactive tutorial, I managed to get things working.Geändert von Lancer (10-20-2005 um 02:42 PM Uhr)
-
10-19-2005, 04:51 PM #192QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
hey kinda new here but anyways i was wondering if someone could teach me how to do self animation control and if you dont understand i mean like be able to move text and the other buttons still work for the text even though it is moved i can upload my script if you want note i had some help and learned a lot and managed to get it running after some modifications to the script and its only a simple program and when i say simple i mean extremly so could someone help just ask and i will upload it to this post or a later post and thanks
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
10-19-2005, 05:24 PM #193
XteticX- Well i got it to work, but the numbers keep loading over themselves. so it looks crazy and is impossible to tell what number has shown up :Cry:
Picture Animations........
well all u really have to do is...
load an image...
then use screen:clear()
load the next image after the first.
so
Load an Image, Clear Screen, Load next image in sequence, Clear Screen...
Do that as many times as needed. IT should look like a moving graphic.
Note: I have never done this, but it should work...
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
10-28-2005, 01:55 PM #194NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Wow... there sure are a lot of new lua threads...
BUMP"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
10-29-2005, 10:04 AM #195words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
luv ya if u no
how do u load a image if my cursor goes over a pixel

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
10-29-2005, 10:53 AM #196QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- script.lua
- Beiträge
- 426
- Points
- 6.087
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Once again I'll just guess, if its only 1 pixel, then you should be abble to do something like this:
Zitat von SG57
Blank would be a transparent image
And Item would be what you want to blit when the cursor is over the given pixel
Now you could either make a function for this, or if its only for one item then just add this in the main loop:Code:Blank=Image.load("blank.png") Item=Image.load("item.png") --Make it invisable at start up IMAGE=Blank
So that would make the Item appear when your cursor is exacly over that specific pixel, x10,y10. This will be hard to do btw. If its some kind of shell thing your doing, then give it a range and not only one single pixel to go over.Code:if cursorX>=10 and cursorY>=10 then IMAGE=Item else IMAGE=Blank end screen:blit(10,10,IMAGE,true)
Hope that gives you an idea of what I mean.Code:if cursorX>=10 and cursorX<=30 and cursorY>=10 and cursorY<=30 then IMAGE=Item else IMAGE=Blank end screen:blit(10,10,IMAGE,true)
-
10-29-2005, 12:18 PM #197Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
You just bumped a sticky :)
Zitat von MagicianFB
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
10-29-2005, 02:47 PM #198words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
i tried bliting the image stead of using else didnt work

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
10-29-2005, 03:38 PM #199Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Actually he bumped it before it was a sticky.
Zitat von Virtue
F.A.L.O?
-
10-29-2005, 03:39 PM #200Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I knew that :)
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
10-29-2005, 09:44 PM #201words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
tht pixel thing aint working help plz

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
10-30-2005, 07:30 AM #202Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
What exactly do you mean by load an image? You mean blit an image? Like if the cursor goes over something, then show a picture? Give me your code so far.
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
10-30-2005, 09:52 AM #203words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
yes and i cant post code my comp broken

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
10-30-2005, 10:16 AM #204Developer

- Registriert seit
- Jun 2005
- Ort
- At my house...
- Beiträge
- 886
- Points
- 8.360
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Or you dont even have the code written... Why/How are you asking if your comp is broken?
F.A.L.O?
-
10-30-2005, 11:02 AM #205Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
How is your computer broken yet you are posting this? What do you mean, "it's broken"?
[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
10-30-2005, 12:16 PM #206QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Indiana
- Beiträge
- 46
- Points
- 11.125
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Is there any possible way to "Resize" an image? Can anybody make a function for me? I want to take an Image (WITHOUT RESIZING IT WITH AN EDITOR) that has dimensions of 640x480, resize it to 272x480 (So it fits on the screen) and then blit it. Example:
I know Image:Resize is not a REAL function, but can someone make this function for me? Thanks,Code:Image1=Image.load("0001.png") --Image has dimensions 640x480 Image1:Resize(480, 272) screen:blit(0, 0, Image1) screen.flip()
Josh
-
10-30-2005, 05:16 PM #207words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
um im on fired up browser and i need more ram to get windows xp

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
11-01-2005, 09:44 AM #208Advanced PSP Coder
- Registriert seit
- Oct 2005
- Ort
- Down South
- Beiträge
- 426
- Points
- 7.141
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Zitat von joreofiorio35
I highly doubt this can be done, because Lua doesn't have this kinda stuff built into it, atleast not yet. But how hard is it to go into PS, and resize it t 480 x 272? I do it all the time.[center][COLOR=Green][B]- PM Me if you need help with anything - [/B] [/COLOR]
[B][SIZE=3][COLOR=DarkOrange][U]Homebrew I've Made[/U][/COLOR][/SIZE][/B]
[B]Applications:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,17,1667]PSP Alarm v0.5[/URL] [/b]
[B]Games:
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1669] Virtual Escape DEMO[/URL] [w/ Lancer]
[URL=http://files.pspupdates.qj.net/cgi-bin/cfiles.cgi?0,0,0,0,12,1577]PSP Dodge v1.0[/URL][/b]
[img]http://img517.imageshack.us/img517/4735/sig3qu.jpg[/img][/center]
-
11-01-2005, 03:27 PM #209NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Hmmmmmmmmm... there is a way to do it... I just forget what it is.
Zitat von joreofiorio35
I'll try and find it."15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]
-
11-01-2005, 03:39 PM #210NDS Mod
- Registriert seit
- Jul 2005
- Ort
- w00+land
- Beiträge
- 645
- Points
- 18.386
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Here it is:
Lua Code Snippets"15% percent of programing is creating a program, 85% percent is getting it to work like it should." - Me
[URL=http://www.mozilla.org/products/firefox/][IMG]http://img439.imageshack.us/img439/5667/getfirefox0sr.png[/IMG][/URL]


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum